-
Notifications
You must be signed in to change notification settings - Fork 532
Fix/dcm2niix #2498
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
Fix/dcm2niix #2498
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2498 +/- ##
==========================================
- Coverage 66.86% 48.36% -18.5%
==========================================
Files 327 119 -208
Lines 42474 24162 -18312
Branches 5271 0 -5271
==========================================
- Hits 28400 11686 -16714
+ Misses 13373 12476 -897
+ Partials 701 0 -701
Continue to review full report at Codecov.
|
looks like same issue as ReproNim/neurodocker#148 I'll save including |
>>> converter.inputs.compression = 5 | ||
>>> converter.inputs.output_dir = 'ds005' | ||
>>> converter.cmdline | ||
'dcm2niix -b y -z y -5 -x n -t n -m n -o ds005 -s n -v n dicomdir' |
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.
perhaps add:
>>> converter.run() # doctest: +SKIP
after this
Is this targeting 1.0.2? |
@mgxd Is this ready for review? |
@effigies yes |
nipype/interfaces/dcm2nii.py
Outdated
|
||
>>> flags = '-'.join([val.strip() + ' ' for val in sorted(' '.join(converter.cmdline.split()[1:-1]).split('-'))]) | ||
>>> flags | ||
' -b y -f %t%p -m n -o . -s y -t n -v n -x n -z i ' | ||
' -5 -b y -m n -o ds005 -s n -t n -v n -x n -z y ' |
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.
What is the point of this flags
line, if we're already showing cmdline
?
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.
I'm fine to remove this as well, just kept around since it previously existed
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.
@@ -251,6 +263,8 @@ class Dcm2niixInputSpec(CommandLineInputSpec): | |||
argstr="%s", | |||
position=-1, | |||
copyfile=False, | |||
deprecated='1.0.2', | |||
new_name='source_dir', |
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.
I'm not sure why this is being deprecated. Is it no longer available in dcm2niix
, or is it simply disrecommended? Should we use max_ver
instead?
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.
usage: dcm2niix [options] <in_folder>
I would prefer to remove this entirely, as it's misleading to dcm2niix
's actual usage (I've checked as far back as version 28Aug2016
)
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.
Okay. Looks like you added this interface in the first place, so nobody else really to consult with. I'm fine with this.
nipype/interfaces/dcm2nii.py
Outdated
output_dir = Directory( | ||
exists=True, argstr='-o %s', genfile=True, desc="Output directory") | ||
os.getcwd(), |
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.
This will be evaluated at import time, and thus output to the working directory from which the python interpreter was started (usually). If you want the base directory of the node (or CWD at interface runtime), I think you'll want "."
.
nipype/interfaces/dcm2nii.py
Outdated
has_private = traits.Bool( | ||
False, | ||
argstr='-t', | ||
usedefault=True, | ||
desc="Flag if text notes includes private patient details") | ||
compression = traits.Enum( | ||
1, 2, 3, 4, 5, 6, 7, 8, 9, | ||
argstr='-%s', |
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.
-%d
?
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.
sure
nipype/interfaces/dcm2nii.py
Outdated
desc="Ignore derived, localizer and 2D images") | ||
series_numbers = InputMultiPath( | ||
traits.Str(), | ||
argstr='-n %s', |
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.
Just to check: If this is series_numbers = ["a", "b", "c"]
, is the desired output -n a b c
or -n a -n b -n c
? Right now it's coded for the former.
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.
after checking, it should be the latter, making a fix now
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.
You can just do argstr='-n %s...'
, rather than add a special case to _format_arg
.
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.
TIL, nice!
else: | ||
output_dir = self._gen_filename('output_dir') | ||
out_file = os.path.abspath(os.path.join(output_dir, fname)) | ||
out_file = os.path.abspath(fname) |
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.
Do you not want to use output_dir
at all? It no longer seems to have any effect in this interface.
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.
if omitted, dcm2niix
defaults to save within input folder, so I'd prefer to have it save within the node directory/cwd. The output_dir
is parsed from dcm2niix
's stdout as fname
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.
Ah, sorry, I misunderstood what was going on here.
nipype/interfaces/dcm2nii.py
Outdated
>>> flags = '-'.join([val.strip() + ' ' for val in sorted(' '.join(converter.cmdline.split()[1:-1]).split('-'))]) | ||
>>> flags | ||
' -5 -b y -m n -o ds005 -s n -t n -v n -x n -z y ' | ||
>>> converter.run() # doctest: +SKIP |
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.
I think we did still want the converter.run()
line, though.
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.
😅
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.
LGTM. I assume the tests pass locally?
Passing, but Circle's not updating right now. |
Fixes? #2474 .
Changes proposed in this pull request
Add dcm2niix/datalad to travis testing matrix