brainvisa / aims-free

Analysis of Images and Signal for neuroimaging
Other
6 stars 3 forks source link

AimsFileInfo crashes with some DICOM files #87

Open sapetnioc opened 1 year ago

sapetnioc commented 1 year ago

Describe the bug Downloaded some DICOM from a head scan of my mother. Unzipped the archive and launches AimsFileInfowith one of the files in parameter. Got a segfault.

Environment:

Additional context Note that dcm2niix does not support the DICOM format. I have many of these errors: Unsupported transfer syntax '1.2.840.10008.1.2.4.80' (decode with 'dcmdjpls jpg.dcm raw.dcm' or 'gdcmconv -w jpg.dcm raw.dcm', or recompile dcm2niix with JPEGLS support)

denisri commented 1 year ago

I have fixed a problem which actually caused the crash, but there are still strange things happening: in the reader (the checker actually) a vector is allocated for slices, with the number of slices as the number of elements. But then things are stored in this vector with slice position as index. In the small dataset I have, there are 3 slices, but positions are 0, 1 and 4. Thus 4 was after the end of the vector. I have added a test to resize the vector when this occurs, but I don't know how these things are used later, and it probably produces unexpected things (plus, some items in this vector thus remain unassigned and uninitialized). So: for me I can load the small dataset, it doesn't crash anymore, but I'm not sure things are OK. Moreover the 3 slices in my dataset are not in the same orientation, and now I have a volume with 3 slices of the dimensions of the 1st one - patently wrong also. Anyway the problem in the first place is probably that these slices should not be identified as part of a single volume. Either the slices selection in the reader is wrong (but I don't know the criterions), or the image header is wrong and has the same identifier (or whatever) for slices which should be separated. Can you retry with the full dataset ?

denisri commented 2 months ago

Does the fix for #109 also fix this one ?