Installment dcm2bids

Hello,

As I am a bit new, I am experiencing some problems with the installment of dcm2bids.

If I just follow this tutorial (2. Tutorial - Dcm2Bids), it seems very clear, however, in the tutorial they ask to make a yaml file, and then this file needs to be saved inside the dcm2bids-tutorial file, however, I dont know how to create such a file…Someone has experience with this?

Thanks

Hello,

You do not need to create one. Just make an environment in Anaconda that has all the necessary dependencies.

Best,
Steven

Thank you very much Steven

Ok I managed to create the environment in conda, and thats working, however as I try to activate dcm2bids with the command ‘conda activate dcm2bids’ in my command prompt, it says that my shell has not been properly configured…

‘CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’.
If using ‘conda activate’ from a batch script, change your
invocation to ‘CALL conda.bat activate’.’

As this is the last step before installment, I dont really understand why it doesnt work, as the previous steps now all have been completed…

Oh I think I found a solution, when I tried the command ‘activate.bat dcm2bids’ I got a response and then ‘dcm2bids --help’ gave me an equal response as on the tutorial for installment, s I guess this is fixed now and Im ready to go!

Hi @SeriD,
Great to see you found your way.
We definitively need more people with windows environment to complete our dcm2bids tutorial.
Don’t hesitate to write any feedback as a github issue or even suggest a PR.
Thank you again.
Arnaud

Thank you.

Im am now doing the tutorial, but I am not sure this program works on windows…?

This step: dcm2bids_helper -d sourcedata/dcm_qa_nih/In/
does not seem to work immediately, I get some sort of filenotfounderror

Even if I alter the path ‘sourcedata/dcm_ga_nih/In’ to a more specified path with actual DCM files (‘dcm2bids_helper -d sourcedata\dcm_qa_nih\In\20180918GE\mr_0004’), I still get the same error…(all previous steps gave valid output)

@SeriD May you please provide:

  1. The contents of sourcedata/dcm_qa_nih/In/ (with the ls or dir command depending on your shell configuration)
  2. The full error message

Hi Steven:

C:\GBW_MyDownloads\Anaconda\envs\dcm2bids-tutorial\bids_project\sourcedata\dcm_qa_nih\In>dir
Volume in drive C is Windows
Volume Serial Number is 0EBB-E795

Directory of C:\GBW_MyDownloads\Anaconda\envs\dcm2bids-tutorial\bids_project\sourcedata\dcm_qa_nih\In

29/04/2022 13:27 .
29/04/2022 13:27 …
29/04/2022 13:27 20180918GE
29/04/2022 13:27 20180918Si
0 File(s) 0 bytes
4 Dir(s) 1.813.423.706.112 bytes free

C:\GBW_MyDownloads\Anaconda\envs\dcm2bids-tutorial>dcm2bids_helper -d sourcedata/dcm_qa_nih/In/
Traceback (most recent call last):
File “C:\GBW_MyDownloads\Anaconda\Scripts\dcm2bids_helper-script.py”, line 9, in
sys.exit(main())
File “C:\GBW_MyDownloads\Anaconda\lib\site-packages\dcm2bids\helper.py”, line 42, in main
rsl = app.run()
File “C:\GBW_MyDownloads\Anaconda\lib\site-packages\dcm2bids\dcm2niix.py”, line 90, in run
self.execute()
File “C:\GBW_MyDownloads\Anaconda\lib\site-packages\dcm2bids\dcm2niix.py”, line 100, in execute
output = run_shell_command(cmd)
File “C:\GBW_MyDownloads\Anaconda\lib\site-packages\dcm2bids\utils.py”, line 113, in run_shell_command
return check_output(shlex.split(commandLine))
File “C:\GBW_MyDownloads\Anaconda\lib\subprocess.py”, line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File “C:\GBW_MyDownloads\Anaconda\lib\subprocess.py”, line 505, in run
with Popen(*popenargs, **kwargs) as process:
File “C:\GBW_MyDownloads\Anaconda\lib\subprocess.py”, line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File “C:\GBW_MyDownloads\Anaconda\lib\subprocess.py”, line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

1 Like
  1. It looks like there are no dicoms in the path you specified.
  2. If you are in a windows shell, you should make sure that your paths use forward instead of back slashes.

Weirdly, there are DICOMS in that path, I believe the same way as described in the tutorial…I also tried to specify the path more toward the folder where the DICOMS really are, as shown in the picture, but I got the same error.

  1. Thanks, I also tried that indeed but no success yet

It seems that I cannot make this work on windows… If anyone else uses this in Windows let me know! I will try another program.

Hello,

I am doing the tutorial for dcm2bids (installed using anaconda env), but when I try to run dcm2bids at the end of the tutorial, I receive the following error in my terminal


bids_project % dcm2bids -d sourcedata/dcm_qa_nih/In/ -p ID01 -c code/dcm2bids_config.json
Traceback (most recent call last):
File “/Users/name/opt/anaconda3/envs/dcm2bids/bin/dcm2bids”, line 10, in
sys.exit(main())
File “/Users/name/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py”, line 247, in main
app = Dcm2bids(**vars(args))
File “/Users/name/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/dcm2bids.py”, line 56, in init
self.config = load_json(valid_path(config, type=“file”))
File “/Users/name/opt/anaconda3/envs/dcm2bids/lib/python3.9/site-packages/dcm2bids/utils.py”, line 63, in load_json
data = json.load(f, object_pairs_hook=OrderedDict)
File “/Users/name/opt/anaconda3/envs/dcm2bids/lib/python3.9/json/init.py”, line 293, in load
return loads(fp.read(),
File “/Users/name/opt/anaconda3/envs/dcm2bids/lib/python3.9/json/init.py”, line 335, in loads
raise JSONDecodeError(“Unexpected UTF-8 BOM (decode using utf-8-sig)”,
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
(dcm2bids) name bids_project %


I am not sure why this happens. If anyone has any suggestion, I am open to hearing them. Thanks!