Skip to content
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

skip pixel data validation if tag is not present #456

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rkm
Copy link
Member

@rkm rkm commented Feb 28, 2024

Fixes #455

@howff
Copy link

howff commented Feb 28, 2024

You could also check whether any of the 16 overlaydata tags are present?

If overlays are present but PixelData is not present then the file should be considered useless and this should never happen. However it's technically possible for it to happen, and if it's possible then someone will have done it ;-) for example removing PixelData to anonymise the file but forgetting to remove the overldaydata.

But it depends on what IsIdentifiable is actually checking, I don't know if it even looks at overlays anyway.

@rkm
Copy link
Member Author

rkm commented Feb 28, 2024

We do scan the overlay frames if they exist, however this logic is baked into the existing method so I'll have to refactor this a bit more:

void ValidateDicomPixelData(IFileInfo fi, DicomFile dicomFile, DicomDataset ds, string? modality, string?[] imageTypeArr)

...

// Process all of the Overlays and all of their frames
// Get a set of 'group' identifiers from 0x6000 to 0x60FE if group.0x0010 exists.
// Each group will be an overlay. Note only even numbers exist, so max 16 overlays.
var groups = new List<ushort>();
groups.AddRange(ds.Where(x => x.Tag.Group >= 0x6000 && x.Tag.Group <= 0x60FF &&
x.Tag.Element == 0x0010).Select(x => x.Tag.Group));
foreach (var group in groups)

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.

crash when scanning MRSpectroscopyStorage image
2 participants