-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add File organization
and DICOM to NIfTI conversion
sections
#3
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
…mpts the user to provide paths to the nifti images.
…xists, if so, warn the user and exit
…ing from the list of images
I drafted a script for the DICOM to NIfTI (BIDS) conversion in my latest commits. The script can be run by: python ~/code/balgrist-sci/file_loader.py \
-dicom-folder ~/data/experiments/balgrist-sci/source_data/dir_20231010 \
-bids-folder ~/data/experiments/balgrist-sci/bids \
-participant sub-001 \
-session ses-01 \
-contrasts T2w dwi Then, the script prints info to the user and starts the dcm2nii conversion: ----------------------------------------------------------------------------------------------------
Dicom folder: /Users/valosek/data/experiments/balgrist-sci/source_data/dir_20231010
BIDS folder: /Users/valosek/data/experiments/balgrist-sci/bids
Participant ID: sub-001
Session ID: ses-01
Log file will be stored in: /Users/valosek/data/experiments/balgrist-sci/bids/logs/dicom_to_nifti_sub-001_ses-01_20240904_132303.log
----------------------------------------------------------------------------------------------------
Info: Converted NIfTI images will be stored in: /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01
Info: Creating a temporary folder for NIfTI images: /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01/temp_dcm2niix
Info: Starting DICOM to NIfTI conversion using dcm2niix.
Compression will be faster with 'pigz' installed http://macappstore.org/pigz/
Chris Rorden's dcm2niiX version v1.0.20230411 Clang15.0.7 ARM (64-bit MacOS)
Found 56 DICOM file(s)
... After the dcm2nii conversion, the script prompts the user to select the images for further processing. In this case, the script asks for T2w and DWI images. ...
----------------------------------------------------------------------------------------------------
DICOM to NIfTI is done. Please review the images and select images for further processing.
----------------------------------------------------------------------------------------------------
File Name Dimensions Pixel Size
0 t2_sag_tse_stir_5.nii.gz 896 x 896 x 15 0.36 mm x 0.36 mm x 3.00 mm
1 DWI_ZOOMit_8.nii.gz 96 x 36 x 15 0.90 mm x 0.90 mm x 5.00 mm
2 t1_sag_flair_2D_4.nii.gz 864 x 864 x 15 0.37 mm x 0.37 mm x 3.00 mm
3 t1_sag_flair_2D_3.nii.gz 864 x 864 x 8 0.37 mm x 0.37 mm x 3.00 mm
4 t2_sag_tse_stir_6.nii.gz 896 x 896 x 15 0.36 mm x 0.36 mm x 3.00 mm
5 t2_sag_tse_2D_2.nii.gz 928 x 928 x 19 0.34 mm x 0.34 mm x 3.00 mm
6 t2_tra_me_2D_7.nii.gz 512 x 512 x 30 0.35 mm x 0.35 mm x 3.30 mm
Please specify the row number of the T2w image you want to use: 5
Selected T2w image: t2_sag_tse_2D_2.nii.gz
Please specify the row number of the dwi image you want to use: 1
Selected dwi image: DWI_ZOOMit_8.nii.gz
Info: Copying /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01/temp_dcm2niix/t2_sag_tse_2D_2.nii.gz to /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01/anat/sub-001_ses-01_T2w.nii.gz
Info: Copying /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01/temp_dcm2niix/DWI_ZOOMit_8.nii.gz to /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01/dwi/sub-001_ses-01_dwi.nii.gz
Info: Removing the temporary folder /Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01/temp_dcm2niix
----------------------------------------------------------------------------------------------------
All files have been successfully converted and validated. You can find the following images in the BIDS folder:
/Users/valosek/data/experiments/balgrist-sci/bids/sub-001/ses-01
---------------------------------------------------------------------------------------------------- The output file structure then looks like this: valosek@macbook-pro:~/data/experiments/balgrist-sci$ tree
.
├── bids
│ └── sub-001
│ └── ses-01
│ ├── anat
│ │ ├── sub-001_ses-01_T2w.json
│ │ └── sub-001_ses-01_T2w.nii.gz
│ └── dwi
│ ├── sub-001_ses-01_dwi.bval
│ ├── sub-001_ses-01_dwi.bvec
│ ├── sub-001_ses-01_dwi.json
│ └── sub-001_ses-01_dwi.nii.gz
└── source_data
└── dir_20231010
├── MRc.1.3.12.2.543543
├── ...
└── SRe. 1.3.12.2.5432233
|
Do you have some dicoms to test it out with? |
Unfortunately not publicly available. Maybe you can pick some dicoms from |
I don't thinl they are publicly available, they are probably not defaced, and usually dicoms contains some HIPAA identifyers (identifying data) ... |
I'll take something on duke |
File organization
and DICOM to NIfTI conversion
sections
…e name before the .nii.gz extension)
… message and exit
- add new args for sex and age
- add 'Getting Started' - move 'Dependencies' and 'Installation' under 'Getting Started'
…ontrast with different orientation, e.g. 'acq-axial_T2w' and 'acq-sag_T2w'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving!
Merging! I'll continue with the code for further analysis in a new branch. |
This PR:
File organization
andDICOM to NIfTI conversion
sections #3 (comment)Related: #1