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

Windows file paths #83

Closed
kousu opened this issue May 26, 2020 · 0 comments
Closed

Windows file paths #83

kousu opened this issue May 26, 2020 · 0 comments

Comments

@kousu
Copy link
Contributor

kousu commented May 26, 2020

dcm2bids crashes if given filepaths with backslashes in it. They get erased.

Reproduction

On Windows, I installed from master

C:\Users\user\src\Dcm2bids>git branch --show-current
master
C:\Users\user\src\Dcm2bids>pip install -e .
Obtaining file:///C:/Users/user/src/Dcm2bids
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: future>=0.17.1 in c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages (from dcm2bids==2.1.4) (0.18.2)
Installing collected packages: dcm2bids
  Found existing installation: dcm2bids 2.1.4
    Uninstalling dcm2bids-2.1.4:
      Successfully uninstalled dcm2bids-2.1.4
  Running setup.py develop for dcm2bids
Successfully installed dcm2bids
WARNING: You are using pip version 19.2.3, however version 20.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\user\src\Dcm2bids>dcm2bids
usage: dcm2bids [-h] -d DICOM_DIR [DICOM_DIR ...] -p PARTICIPANT [-s SESSION] -c CONFIG [-o OUTPUT_DIR] [--forceDcm2niix] [--clobber]
                [-l {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [-a]
dcm2bids: error: the following arguments are required: -d/--dicom_dir, -p/--participant, -c/--config

(I'm surprised pip install -e . worked, where python setup.py install didn't ?? #76)

Get this testing dataset:

C:\Users\user\src\Dcm2bids>curl -JLO "https://osf.io/7d2j5/?action=download&version=3"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   469  100   469    0     0    469      0  0:00:01 --:--:--  0:00:01  1155
100 14.2M  100 14.2M    0     0  2434k      0  0:00:06  0:00:06 --:--:-- 3135k
curl: Saved to filename 'data_testing.zip'

C:\Users\user\src\Dcm2bids>rem And then manually extract data_testing.zip using the Windows GUI.

Then try to run it:

C:\Users\user\src\Dcm2bids>mkdir output

C:\Users\user\src\Dcm2bids>dcm2bids -d data_testing\data_testing\dicom_unsorted -o output -p "" -c example\config.json
INFO:dcm2bids.dcm2bids:--- dcm2bids start ---
INFO:dcm2bids.dcm2bids:OS:version: Windows-10-10.0.18362-SP0
INFO:dcm2bids.dcm2bids:python:version: 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
INFO:dcm2bids.dcm2bids:dcm2bids:version: 2.1.4
INFO:dcm2bids.dcm2bids:dcm2niix:version: v1.0.20200331
INFO:dcm2bids.dcm2bids:participant: sub-
INFO:dcm2bids.dcm2bids:session:
INFO:dcm2bids.dcm2bids:config: C:\Users\user\src\Dcm2bids\example\config.json
INFO:dcm2bids.dcm2bids:BIDS directory: C:\Users\user\src\Dcm2bids\output
INFO:dcm2bids.utils:Running dcm2niix -b y -ba y -z y -f '%3s_%f_%p_%t' -o output\tmp_dcm2bids\sub- data_testing\data_testing\dicom_unsorted
Error: Input folder invalid: data_testingdata_testingdicom_unsorted
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\Scripts\dcm2bids-script.py", line 11, in <module>
    load_entry_point('dcm2bids', 'console_scripts', 'dcm2bids')()
  File "c:\users\user\src\dcm2bids\dcm2bids\dcm2bids.py", line 290, in main
    return app.run()
  File "c:\users\user\src\dcm2bids\dcm2bids\dcm2bids.py", line 120, in run
    dcm2niix.run(self.forceDcm2niix)
  File "c:\users\user\src\dcm2bids\dcm2bids\dcm2niix.py", line 90, in run
    self.execute()
  File "c:\users\user\src\dcm2bids\dcm2bids\dcm2niix.py", line 100, in execute
    output = run_shell_command(cmd)
  File "c:\users\user\src\dcm2bids\dcm2bids\utils.py", line 112, in run_shell_command
    return check_output(shlex.split(commandLine))
  File "c:\users\user\appdata\local\programs\python\python38-32\lib\subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "c:\users\user\appdata\local\programs\python\python38-32\lib\subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dcm2niix', '-b', 'y', '-ba', 'y', '-z', 'y', '-f', '%3s_%f_%p_%t', '-o', 'outputtmp_dcm2bidssub-', 'data_testingdata_testingdicom_unsorted']' returned non-zero exit status 5.
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

Successfully merging a pull request may close this issue.

2 participants