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

-x flag not working on PAR file #818

Closed
madeleinebarter opened this issue May 1, 2024 · 3 comments
Closed

-x flag not working on PAR file #818

madeleinebarter opened this issue May 1, 2024 · 3 comments

Comments

@madeleinebarter
Copy link

Describe the bug

I am trying to run dcm2niix using the following command:
dcm2niix -x y -z y -f ${bids_stnm}_${session_nb}_T1w -o ${bids_test_dir}/${session_nb}/anat ${file}

All of the flags work except -x. The resulting nifti file is neither cropped, nor re-oriented.

Expected behavior

I would expect a cropped and re-oriented nifti file.

Output log

Chris Rorden's dcm2niiX version v1.0.20240202 Clang16.0.6 ARM (64-bit MacOS)
Warning: dcm2niix PAR is not actively supported (hint: use dicm2nii)
Done reading PAR header version 4.2, with 200 slices
Philips Scaling Values RS:RI:SS = 1:0:0.00287659 (see PMC3998685)
Convert 1 DICOM as /Volumes/clippdata/CAP/bids_test/sub-001/ses-baseline/anat/sub-001_ses-baseline_T1w (256x256x200x1)
Conversion required 1.622296 seconds (0.766511 for core code).
created /Volumes/clippdata/CAP/bids_test/sub-001/ses-baseline/anat/sub-001_ses-baseline_T1w.nii.gz

Version

Please report the complete version string:

dcm2niiX version v1.0.20240202 Clang16.0.6 ARM (64-bit MacOS)

@neurolabusc
Copy link
Collaborator

dcm2niix will only crop and rotate acquisitions if it is confident that the image is a 3D acquisition. The reason for this is that 2D slice timing and bvec directions require us to retain the slice order. PAR/REC files are less verbose than DICOM files, and while your acquisition might be 3D, dcm2niix is not able to establish that.

@madeleinebarter
Copy link
Author

Is there a way to tell dcm2niix that it is a 3D file so that it will crop and rotate?

@neurolabusc
Copy link
Collaborator

dcm2niix is open source and has minimal dependencies, so you can make a fork and override any behavior you wish. The rotation is lossless, so any tool that applies the NIfTI orientation information will not see any difference between the orginal and reoriented result. The cropping is fairly crude and most modern tools should be robust for excess neck in MRI scans. I am a huge proponent of SynthStrip that can work with any modality, and provides far more sophisticated results - this will remove excess tissue and deface the image for anonymization (though if subsequent processing does intensity homogeneity bias correction you may want to choose a wide border setting).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants