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

dcm2niix -c "STRING" will not modify "aux_file" if DICOM data has ImageComments #691

Closed
cookpa opened this issue Mar 16, 2023 · 3 comments
Closed

Comments

@cookpa
Copy link

cookpa commented Mar 16, 2023

Describe the bug

dcm2niix -c "STRING" usage says

   -c : comment stored in NIfTI aux_file (provide up to 24 characters e.g. '-c first_visit')

But the comment is not placed in the NIFTI file if the DICOM ImageComments tag has a non-null value.

To reproduce

Steps to reproduce the behavior:

fieldmap.zip

  1. unzip fieldmap.zip
  2. dcm2niix -c "ANONYMIZED" -f "%d_%s" -o . SpinEchoFieldMap_AP
  3. fslhd SpinEchoFieldMap_AP_10.nii | grep aux_file

Expected behavior

The aux_file to contain "ANONYMIZED".

The "-c" option works as expected if the DICOM tag 0020,4000 ImageComments is emptied or deleted.

Output log

% dcm2niix -c "ANONYMIZED" -f "%d_%s" -o . SpinEchoFieldMap_AP
Chris Rorden's dcm2niiX version v1.0.20220720  (JP2:OpenJPEG) Clang14.0.0 x86-64 (64-bit MacOS)
Found 3 DICOM file(s)
Convert 3 DICOM as ./SpinEchoFieldMap_AP_10 (104x104x72x3)
Conversion required 0.096838 seconds (0.073371 for core code).

Version

Please report the complete version string:

  • dcm2niiX version v1.0.20220720 (JP2:OpenJPEG) Clang14.0.0 x86-64 (64-bit MacOS)

  • I tried building the development branch binary, but it produced a segmentation fault when I tried to run

@cookpa
Copy link
Author

cookpa commented Mar 16, 2023

The background here is that DICOM "ImageComments" contains study and site identifiers that we use internally to route data into our storage system, but we don't want those embedded in the NIFTI data.

The JSON sidecar contains both fields,

	"ImageComments": "DECODE_phantest1@cnds:DecodeDemo",
	"ConversionComments": "ANONYMIZED",

so I think it wouldn't be bad for aux_file to be set to whatever the user sets with "-c".

@neurolabusc
Copy link
Collaborator

@cookpa why don't you test out the latest commit on the development branch.

It also includes a new option, where if you set the comment to be empty the the image comments (0020,4000) are removed from both the NIfTI and the JSON, which may be what you were after in the first place:

dcm2niix -f %S -c "" /path/to/DICOMs

@cookpa
Copy link
Author

cookpa commented Mar 16, 2023

That works

dcm2niix -f %S -c "" /path/to/DICOMs - empties aux_file, json has no ImageComments entry

dcm2niix -f %S -c "STRING" /path/to/DICOMs - aux_file = STRING, json has original ImageComments and ConversionComments = STRING.

Thanks very much!

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

No branches or pull requests

2 participants