Skip to content

Commit

Permalink
rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
celeron533 committed Nov 14, 2023
1 parent 7c21c43 commit fa91696
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions DicomGrep/Services/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void LookupDirectory(string directoryPath)
private void SearchInDicomFile(string filePath)
{
ResultDicomFile resultDicomFile = null;
bool isMatch = false;
bool anyMatch = false;
try
{
OnLoadDicomFile?.Invoke(this, new OnLoadDicomFileEventArgs(filePath));
Expand Down Expand Up @@ -169,8 +169,8 @@ private void SearchInDicomFile(string filePath)

resultDicomFile = new ResultDicomFile(filePath, sopClassName, sopClassUID?.UID, patientName,
resultDicomItems);
isMatch = resultDicomItems?.Count > 0;
if (isMatch)
anyMatch = resultDicomItems?.Count > 0;
if (anyMatch)
{
matchFilenameList.Add(filePath);
Interlocked.Increment(ref matchFileCount);
Expand All @@ -180,9 +180,6 @@ private void SearchInDicomFile(string filePath)
}
catch (Exception ex)
{
//event for error logging
//throw;

if (ex is DicomDataException) // normally caused by incorrect Dicom file format
{
logger.Error(ex, $"'{filePath}' is not a valid DICOM file.");
Expand All @@ -196,7 +193,7 @@ private void SearchInDicomFile(string filePath)
{
Interlocked.Increment(ref searchedFileCount);
OnCompletDicomFile?.Invoke(this,
new OnCompleteDicomFileEventArgs(filePath, resultDicomFile, isMatch, searchedFileCount,
new OnCompleteDicomFileEventArgs(filePath, resultDicomFile, anyMatch, searchedFileCount,
matchFileCount));
}
}
Expand All @@ -205,7 +202,7 @@ private IList<ResultDicomItem> CompareDicomTagAndValue(DicomDataset dataset, ref
{
foreach (DicomItem dicomItem in dataset)
{
// contains sub sequence
// dig into sub sequence
if (dicomItem.ValueRepresentation == DicomVR.SQ)
{
foreach (DicomDataset innerDataset in ((DicomSequence)dicomItem).Items)
Expand Down Expand Up @@ -236,6 +233,7 @@ private IList<ResultDicomItem> CompareDicomTagAndValue(DicomDataset dataset, ref
byte[] rawValue = new byte[element.Buffer.Size];
Array.Copy(element.Buffer.Data, rawValue, element.Buffer.Size);

// best guess for VR=UN
if (dicomItem.ValueRepresentation == DicomVR.UN)
{
byte[] bytes = element.Get<byte[]>();
Expand Down

0 comments on commit fa91696

Please sign in to comment.