brainvisa / aims-free

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

AimsFileConvert for DICOM #109

Closed Hboni closed 4 months ago

Hboni commented 6 months ago

Describe the bug In the dicom_converter command in soma-io, you have the possibility to convert NM DICOM, when alone, with AimsFileConvert command. However, when I try to use it through dicom_converter or manually, I cannot convert single NM DICOM file into nifti. I get the error : FDF file has not a consistent extension. Some years ago we already converted NM DICOM. I do not know when the issue appeared as we do not convert those type of files often.

To Reproduce Steps to reproduce the behavior:

  1. run `AimsFileConvert -i /path/to/single/file.dcm -o /path/output

I can give you an example of single NM DICOM through neurospin if needed to try.

Environment:

Hboni commented 5 months ago

@denisri any idea?

denisri commented 5 months ago

Hi, Well, the dicom IO has been coded by Fabrice, who has changed job since - but we might still ask for his help if we cannot find a solution on our own. I even don't know what is NM Dicom. I will need an example of it at least to have a look. By the way I have modified the dicom reader yesterday (last night actually) to allow it to work in a threaded context (it used to crash when used concurrently in different threads). I hope I haven't broken anything doing this. Tests seem to pass.

denisri commented 4 months ago

The issue is fixed by brainvisa/soma-io@cce8acdb1c49f4c7453c4a68e9cfef652881bf28, cc714c2601c2cc799f22d6fd4a62d681e623f46b and c06e6b55ecd280acc70e953214c0857c20a3b57c. The problem was actually that the dicom reader was filling the image header with dicom tags, one of them being "referential", which happens to ab a list of strings here (I don't know the meaning of if). However in Aims "referential" is already used with a different meaning: it is the identifier of the coordinates system and is a single string. In the master branch (5.2) this "referential" property has become a builtin (a typed C++ field) which is part of the new Referential object in volumes. So there is now a type incompatibility, hence the failure. I have renamed in the dicom reader "referential" to "dicom_referential". Plus I have added an option in the headers copy to catch errors and copy the rest of the header (before eventually throwing an exception at the end). The exception is catched now, so such a problem will print a warning but will not make the whole reader fail.