-
Notifications
You must be signed in to change notification settings - Fork 530
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
dcm2niix node does not error out whenever dcm2niix exits with 1 #3592
Comments
nipype/nipype/interfaces/dcm2nii.py Lines 449 to 450 in ca27e51
IIRC, dcm2niix uses (used?) 1 return codes for warnings (but conversion still occurred), and 2+ for serious problems where conversion was not possible. |
might be... from rordenlab/dcm2niix#733 (comment) by @neurolabusc
so I guess I will quickly send a PR. |
seems to be not the case: when we took a philips dicoms series and removed only 10 (out of 60) of the last dynamic via
processing the entire sequence with all volumes exits with 0 and has following output❯ dcm2niix -z y -b y *dcm && echo allgood || echo "error $?"
Chris Rorden's dcm2niiX version v1.0.20220720 (JP2:OpenJPEG) GCC13.2.0 x86-64 (64-bit Linux)
Warning: only processing last of 22980 input files (recompile with 'myEnableMultipleInputs' to recursively process multiple files)
Found 22980 DICOM file(s)
Philips Scaling Values RS:RI:SS = 0.869353:0:0.0562237 (see PMC3998685)
Convert 22980 DICOM as /tmp/ABCD/ABCD-Like-Subject/rest/DICOM/DICOM_rsfMRI_1_20171207103014_701 (96x96x60x383)
Compress: "/usr/bin/pigz" -b 960 -n -f -6 "/tmp/ABCD/ABCD-Like-Subject/rest/DICOM/DICOM_rsfMRI_1_20171207103014_701.nii"
Conversion required 6.737152 seconds (4.909542 for core code).
dcm2niix -z y -b y *dcm 32.28s user 1.03s system 485% cpu 6.863 total
allgood
and removing entire last dynamic (60 files) causes a Warning but then exits with 0❯ dcm2niix -z y -b y *dcm && echo allgood || echo "error $?"
Chris Rorden's dcm2niiX version v1.0.20220720 (JP2:OpenJPEG) GCC13.2.0 x86-64 (64-bit Linux)
Warning: only processing last of 22920 input files (recompile with 'myEnableMultipleInputs' to recursively process multiple files)
Found 22920 DICOM file(s)
Warning: Expected 382 volumes but found spatial position repeats 383 times.
Error: Check sorted order: 4D dataset has 382 volumes, but volume index ranges from 1..383
Philips Scaling Values RS:RI:SS = 0.869353:0:0.0562237 (see PMC3998685)
Convert 22920 DICOM as /tmp/ABCD/ABCD-Like-Subject/rest/DICOM/DICOM_rsfMRI_1_20171207103014_701 (96x96x60x382)
Compress: "/usr/bin/pigz" -b 960 -n -f -6 "/tmp/ABCD/ABCD-Like-Subject/rest/DICOM/DICOM_rsfMRI_1_20171207103014_701.nii"
Conversion required 6.526654 seconds (4.682719 for core code).
dcm2niix -z y -b y *dcm 33.81s user 0.92s system 523% cpu 6.632 total
allgood
|
To clarify, dcm2niix returns a 0 on success, and non-zero for failure. The error codes are here:
You can see that removing a slice does cause an error (exit 1). In a situation like this, dcm2niix will return exit 10 if the DICOM files explicitly report the number of volumes in the series, but 1 if it is unclear if this was intended.
Removing an entire volume will typically not generate an error, as most DICOM files do not explicitly report the number of volumes expected in the series. One would expect identical DICOMs for a series with 59 volumes as from a series with 60 volumes where the sequence was aborted before the last volume was acquired. |
the problem here is that we have behavior of dcm2niix depending on when/how operator interrupted the scan -- if the full dynamic was acquired, (but not all dynamics), dcm2niix issues just an Error to stderr but completes the conversion and exits with 0. So, once in 60 (numbers of slices) cases we would succeed when otherwise would fail. |
@yarikoptic dcm2niix is limited to information from the files it is provided. I suggest you work with your Philips clinical scientist to see if the number of volumes can be included in future DICOMs. Happy to update dcm2niix if this information is encoded. |
Summary
Originally observed by @dnkennedy while running
heudiconv
on what appears to be incomplete series. then reproduced on some shorter case of 3 slices dicoms picked up from 10k of them (can't share, didn't find any public ones).Actual behavior
The point is that if we have
reproducing execution with nipype:
which produces
so -- it runs, dcm2niix exits with 1, nipype does not fail it, as it does e.g. when dcm2niix exits with 2:
Expected behavior
have an exception similar to when exits with code 2
How to replicate the behavior
see above by BYOBD (bring your own broken dicom)
The text was updated successfully, but these errors were encountered: