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

Add script/instructions to convert DICOM data to BIDS #3

Open
jcohenadad opened this issue Aug 20, 2021 · 13 comments
Open

Add script/instructions to convert DICOM data to BIDS #3

jcohenadad opened this issue Aug 20, 2021 · 13 comments
Labels
documentation Improvements or additions to documentation

Comments

@jcohenadad
Copy link
Member

The Stanford site needs a script with instructions to convert their data to BIDS format. I suggest using dcm2bids and add the custom JSON config file in this repository.

In terms of organization, I suggest creating a bids_conversion/ folder, with all JSON files enclosed and a README.md file with instructions.

The first step would be for @alexfoias to get in touch with the Stanford group to understand how their DICOM data are organized.

@kennethaweberii
Copy link

@andrewsm8 can you provide @alexfoias with a description of how your DICOM data are organized.

@andrewsm8
Copy link

Hello @kennethaweberii and @alexfoias,

I have the axial T2-weighted images organized as follows:

AxialDICOMs Project folder -> Each participant has a subfolder labeled using their 4-digit code -> ~30 axial DICOMs for each participant.

I can certainly organize in a different manner if necessary.

@jcohenadad
Copy link
Member Author

@alexfoias is currently on vacation, coming back in September 6th, and he will contact you right away to get this done

@alexfoias
Copy link

@jcohenadad I have contacted @andrewsm8 by email for more details since we are dealing with confidential information.

@andrewsm8
Copy link

@jcohenadad I have contacted @andrewsm8 by email for more details since we are dealing with confidential information.

Hello @alexfoias, I met with @kennethaweberii and we successfully installed dcm2bids. Within a Conda environment, the following to activate that environment:

source activate dcm2bids.

We then ran the following:

python curate_bids_ucd.py -i /Users/asmith034/desktop/R03/data -o OUTPUT_PATH -c config_file_ucd.txt

It appears the script gives us the .json files and .tsv, but it is not converting the DICOM files into NIFTI. We get the following error message:

INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: macOS-11.6-x86_64-i386-64bit
INFO:dcm2bids.dcm2bids:python:version: 3.9.7 | packaged by conda-forge | (default, Sep 23 2021, 07:31:23) [Clang 11.1.0 ]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.6
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20210317
INFO:dcm2bids.dcm2bids:participant: sub-5493
INFO:dcm2bids.dcm2bids:session:
INFO:dcm2bids.dcm2bids:config: /Users/asmith034/Desktop/dcm2bids-tutorial/config_file_ucd.txt
INFO:dcm2bids.dcm2bids:BIDS directory: /Users/asmith034/Desktop/dcm2bids-tutorial/OUTPUT_PATH
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o OUTPUT_PATH/tmp_dcm2bids/sub-5493 /Users/asmith034/desktop/R03/data/5493
Traceback (most recent call last):
File "/opt/anaconda3/envs/dcm2bids/bin/dcm2bids", line 10, in
sys.exit(main())
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 291, in main
return app.run()
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 120, in run
dcm2niix.run(self.forceDcm2niix)
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2niix.py", line 90, in run
self.execute()
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2niix.py", line 100, in execute
output = run_shell_command(cmd)
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/utils.py", line 113, in run_shell_command
return check_output(shlex.split(commandLine))
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dcm2niix', '-b', 'y', '-ba', 'y', '-z', 'y', '-f', '%3s_%f_%p_%t', '-o', 'OUTPUT_PATH/tmp_dcm2bids/sub-5493', '/Users/asmith034/desktop/R03/data/5493']' returned non-zero exit status 2.
Traceback (most recent call last):
File "/opt/anaconda3/envs/dcm2bids/bin/dcm2bids", line 10, in
sys.exit(main())
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 290, in main
app = Dcm2bids(**vars(args))
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 49, in init
self.dicomDirs = dicom_dir
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 90, in dicomDirs
raise FileNotFoundError(dir_not_found)
FileNotFoundError: ['/Users/asmith034/desktop/R03/data/.DS_Store']
INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: macOS-11.6-x86_64-i386-64bit
INFO:dcm2bids.dcm2bids:python:version: 3.9.7 | packaged by conda-forge | (default, Sep 23 2021, 07:31:23) [Clang 11.1.0 ]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.6
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20210317
INFO:dcm2bids.dcm2bids:participant: sub-5416
INFO:dcm2bids.dcm2bids:session:
INFO:dcm2bids.dcm2bids:config: /Users/asmith034/Desktop/dcm2bids-tutorial/config_file_ucd.txt
INFO:dcm2bids.dcm2bids:BIDS directory: /Users/asmith034/Desktop/dcm2bids-tutorial/OUTPUT_PATH
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o OUTPUT_PATH/tmp_dcm2bids/sub-5416 /Users/asmith034/desktop/R03/data/5416
Traceback (most recent call last):
File "/opt/anaconda3/envs/dcm2bids/bin/dcm2bids", line 10, in
sys.exit(main())
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 291, in main
return app.run()
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py", line 120, in run
dcm2niix.run(self.forceDcm2niix)
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2niix.py", line 90, in run
self.execute()
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2niix.py", line 100, in execute
output = run_shell_command(cmd)
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/utils.py", line 113, in run_shell_command
return check_output(shlex.split(commandLine))
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/opt/anaconda3/envs/dcm2bids/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dcm2niix', '-b', 'y', '-ba', 'y', '-z', 'y', '-f', '%3s_%f_%p_%t', '-o', 'OUTPUT_PATH/tmp_dcm2bids/sub-5416', '/Users/asmith034/desktop/R03/data/5416']' returned non-zero exit status 2.
[]

@alexfoias
Copy link

Hi @andrewsm8 ,

I had that type of issue in the past. Please see here: UNFmontreal/Dcm2Bids#139

I will right down a procedure on the PR so you can have all the dependencies properly configure.

Could you please let me know what OS are you using ? Thank you.

@andrewsm8
Copy link

@alexfoias, @kennethaweberii, yes I am using macOS Big Sur Version 11.6. Thank you!

@alexfoias
Copy link

Okay. Perfect. I will reach back to you with more details.

@alexfoias
Copy link

alexfoias commented Sep 24, 2021

@andrewsm8 I have added some instructions on the PR. Please check them out. If you still have issues, please feel free to contact me.

@jcohenadad
Copy link
Member Author

@andrewsm8 I have added some instructions on the PR. Please check them out. If you still have issues, please feel free to contact me.

@alexfoias could you please cross-reference the PR you are referring to?

@alexfoias
Copy link

Yes, I have added the link to the latest comment on the PR.

@kennethaweberii
Copy link

@jcohenadad @alexfoias We are exporting our spinal cord and lesion segmentations for our axial T2w images. Should the spinal cord segmentation contain the lesion segmentation? In other words, should the lesioned tissue be considered as part of the spinal cord? Thanks, Ken

@jcohenadad
Copy link
Member Author

@jcohenadad @alexfoias We are exporting our spinal cord and lesion segmentations for our axial T2w images. Should the spinal cord segmentation contain the lesion segmentation? In other words, should the lesioned tissue be considered as part of the spinal cord? Thanks, Ken

yes

@alexfoias alexfoias removed their assignment Mar 30, 2022
@valosekj valosekj added the documentation Improvements or additions to documentation label Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants