8000 Fix reading DICOM files with extra tags in the file meta information group by amoerie · Pull Request #1377 · fo-dicom/fo-dicom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix reading DICOM files with extra tags in the file meta information group #1377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2022

Conversation

amoerie
Copy link
Collaborator
@amoerie amoerie commented Apr 22, 2022

Fixes #1376

Checklist

  • The pull request branch is in sync with latest commit on the fo-dicom/development branch
  • I have updated API documentation
  • I have included unit tests
  • I have updated the change log
  • I am listed in the CONTRIBUTORS file

Changes proposed in this pull request:

  • Stop reading file meta information when encountering an tag of group 2 with a lower element value than the previous tag
  • To implement this, I also have to keep track of the previous DICOM tag in DicomReader. Then, I updated the FileMetaInformationStop method to also stop when the nex 8000 t tag is suddenly a lower element than the previous tag. This fixes reading the faulty file.

amoerie added 3 commits April 22, 2022 11:58
Stop reading file meta information when encountering an tag of group 2 with a lower element value than the previous tag
@codecov
Copy link
codecov bot commented Apr 22, 2022

Codecov Report

Merging #1377 (fecf645) into development (247d3aa) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@               Coverage Diff               @@
##           development    #1377      +/-   ##
===============================================
+ Coverage        80.05%   80.15%   +0.09%     
===============================================
  Files              266      266              
  Lines            24332    24334       +2     
===============================================
+ Hits             19480    19505      +25     
+ Misses            4852     4829      -23     
Impacted Files Coverage Δ
FO-DICOM.Core/DicomFile.cs 90.38% <ø> (ø)
FO-DICOM.Core/IO/Reader/DicomFileReader.cs 97.32% <100.00%> (+0.02%) ⬆️
FO-DICOM.Core/IO/Reader/DicomReader.cs 87.67% <100.00%> (+0.03%) ⬆️
FO-DICOM.Core/Network/DicomService.cs 80.72% <0.00%> (-1.21%) ⬇️
...Codec/JpegLossless/DicomJpegLosslessDecoderImpl.cs 71.63% <0.00%> (+2.86%) ⬆️
FO-DICOM.Core/Imaging/ImageBase.cs 72.00% <0.00%> (+4.00%) ⬆️
FO-DICOM.Core/Setup.cs 93.47% <0.00%> (+19.56%) ⬆️
FO-DICOM.Core/ServiceProviderHost.cs 100.00% <0.00%> (+100.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 247d3aa...fecf645. Read the comment docs.

Copy link
Collaborator
@mrbean-bremen mrbean-bremen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

{
_result = DicomReaderResult.Stopped;
return false;
}

_previousTag = _tag;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to this PR: I wonder if we can use _previousTag to generally check for tags that are less than the previous ones (and ignore these tags). I have previously encountered such data, produced by a big vendor, which crashed dcmtk storescp.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exactly the idea that fixed the extraneous file meta information issue that is being solved here :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this PR fixes the problem in the meta data, while I meant the same check for the actual dataset (where I have seen that problem).

@amoerie
Copy link
Collaborator Author
amoerie commented Jun 9, 2022

I suppose this small PR has been open long enough, and there are no objections, so I'll merge this.

@amoerie amoerie merged commit 18a33fa into development Jun 9, 2022
@amoerie amoerie deleted the GH-1376 branch June 9, 2022 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When a DICOM file contains two meta information segments, the second segment overwrites the first
2 participants
0