Skip to content

Commit befedde

Browse files
committed
Fixed output files hashing and returned paths.
1 parent 1b8fc66 commit befedde

File tree

5 files changed

+70
-59
lines changed

5 files changed

+70
-59
lines changed

nipype/interfaces/fsl/dti.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def _list_outputs(self):
102102

103103
class EddyCorrectInputSpec(FSLCommandInputSpec):
104104
in_file = File(exists=True, desc='4D input file', argstr='%s', position=0, mandatory=True)
105-
out_file = File(desc='4D output file', argstr='%s', position=1, genfile=True)
105+
out_file = File(desc='4D output file', argstr='%s', position=1, genfile=True, hash_files=False)
106106
ref_num = traits.Int(argstr='%d', position=2, desc='reference number', mandatory=True)
107107

108108

@@ -143,6 +143,7 @@ def _list_outputs(self):
143143
outputs['eddy_corrected'] = self.inputs.out_file
144144
if not isdefined(outputs['eddy_corrected']):
145145
outputs['eddy_corrected'] = self._gen_fname(self.inputs.in_file, suffix='_edc')
146+
outputs['eddy_corrected'] = os.path.abspath(outputs['eddy_corrected'])
146147
return outputs
147148

148149
def _gen_filename(self, name):
@@ -492,7 +493,7 @@ class VecRegInputSpec(FSLCommandInputSpec):
492493
in_file = File(exists=True, argstr='-i %s', desc='filename for input vector or tensor field',
493494
mandatory=True)
494495
out_file = File(argstr='-o %s', desc='filename for output registered vector or tensor field',
495-
genfile=True)
496+
genfile=True, hash_files=False)
496497
ref_vol = File(exists=True, argstr='-r %s', desc='filename for reference (target) volume',
497498
mandatory=True)
498499
affine_mat = File(exists=True, argstr='-t %s',
@@ -554,6 +555,7 @@ def _list_outputs(self):
554555
pth, base_name = os.path.split(self.inputs.in_file)
555556
outputs['out_file'] = self._gen_fname(base_name, cwd=os.path.abspath(pth),
556557
suffix='_vreg')
558+
outputs['out_file'] = os.path.abspath(outputs['out_file'])
557559
return outputs
558560

559561
def _gen_filename(self, name):
@@ -610,7 +612,7 @@ def _list_outputs(self):
610612
class FindTheBiggestInputSpec(FSLCommandInputSpec):
611613
in_files = traits.List(File, exists=True, argstr='%s', desc='a list of input volumes or a singleMatrixFile',
612614
position=0, mandatory=True)
613-
out_file = File(argstr='%s', desc='file with the resulting segmentation', position=2, genfile=True)
615+
out_file = File(argstr='%s', desc='file with the resulting segmentation', position=2, genfile=True, hash_files=False)
614616

615617

616618
class FindTheBiggestOutputSpec(TraitedSpec):
@@ -648,6 +650,7 @@ def _list_outputs(self):
648650
outputs['out_file'] = self.inputs.out_file
649651
if not isdefined(outputs['out_file']):
650652
outputs['out_file'] = self._gen_fname('biggestSegmentation', suffix='')
653+
outputs['out_file'] = os.path.abspath(outputs['out_file'])
651654
return outputs
652655

653656
def _gen_filename(self, name):
@@ -762,8 +765,8 @@ class DistanceMapInputSpec(FSLCommandInputSpec):
762765
desc="binary mask to contrain calculations")
763766
invert_input = traits.Bool(argstr="--invert", desc="invert input image")
764767
local_max_file = traits.Either(traits.Bool, File, argstr="--localmax=%s",
765-
desc="write an image of the local maxima")
766-
distance_map = File(genfile=True, argstr="--out=%s", desc="distance map to write")
768+
desc="write an image of the local maxima", hash_files=False)
769+
distance_map = File(genfile=True, argstr="--out=%s", desc="distance map to write", hash_files=False)
767770

768771

769772
class DistanceMapOutputSpec(TraitedSpec):
@@ -804,13 +807,15 @@ def _list_outputs(self):
804807
suffix="_dstmap",
805808
use_ext=True,
806809
newpath=os.getcwd())
810+
outputs["distance_map"] = os.path.abspath(outputs["distance_map"])
807811
if isdefined(_si.local_max_file):
808812
outputs["local_max_file"] = _si.local_max_file
809813
if isinstance(_si.local_max_file, bool):
810814
outputs["local_max_file"] = fname_presuffix(_si.in_file,
811815
suffix="_lclmax",
812816
use_ext=True,
813817
newpath=os.getcwd())
818+
outputs["local_max_file"] = os.path.abspath(outputs["local_max_file"]))
814819
return outputs
815820

816821
def _gen_filename(self, name):
@@ -905,7 +910,7 @@ class MakeDyadicVectorsInputSpec(FSLCommandInputSpec):
905910
theta_vol = File(exists=True, mandatory=True, position=0, argstr="%s")
906911
phi_vol = File(exists=True, mandatory=True, position=1, argstr="%s")
907912
mask = File(exists=True, position=2, argstr="%s")
908-
output = File("dyads", position=3, usedefault=True, argstr="%s")
913+
output = File("dyads", position=3, usedefault=True, argstr="%s", hash_files=False)
909914
perc = traits.Float(desc="the {perc}% angle of the output cone of \
910915
uncertainty (output will be in degrees)",
911916
position=4,

nipype/interfaces/fsl/maths.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class MathsInput(FSLCommandInputSpec):
1616

1717
in_file = File(position=2, argstr="%s", exists=True, mandatory=True,
1818
desc="image to operate on")
19-
out_file = File(genfile=True, position=-2, argstr="%s", desc="image to write")
19+
out_file = File(genfile=True, position=-2, argstr="%s", desc="image to write", hash_files=False)
2020
_dtypes = ["float", "char", "int", "short", "double", "input"]
2121
internal_datatype = traits.Enum(*_dtypes, position=1, argstr="-dt %s",
2222
desc="datatype to use for calculations (default is float)")
@@ -39,9 +39,10 @@ class MathsCommand(FSLCommand):
3939

4040
def _list_outputs(self):
4141
outputs = self.output_spec().get()
42-
outputs["out_file"] = os.path.abspath(self.inputs.out_file)
42+
outputs["out_file"] = self.inputs.out_file
4343
if not isdefined(self.inputs.out_file):
4444
outputs["out_file"] = self._gen_fname(self.inputs.in_file, suffix=self._suffix)
45+
outputs["out_file"] = os.path.abspath(self.inputs.out_file)
4546
return outputs
4647

4748
def _gen_filename(self, name):

nipype/interfaces/fsl/model.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,28 +1285,28 @@ class ClusterInputSpec(FSLCommandInputSpec):
12851285
desc='threshold for input volume')
12861286
out_index_file = traits.Either(traits.Bool, File,
12871287
argstr='--oindex=%s',
1288-
desc='output of cluster index (in size order)')
1288+
desc='output of cluster index (in size order)', hash_files=False)
12891289
out_threshold_file = traits.Either(traits.Bool, File,
12901290
argstr='--othresh=%s',
1291-
desc='thresholded image')
1291+
desc='thresholded image', hash_files=False)
12921292
out_localmax_txt_file = traits.Either(traits.Bool, File,
12931293
argstr='--olmax=%s',
1294-
desc='local maxima text file')
1294+
desc='local maxima text file', hash_files=False)
12951295
out_localmax_vol_file = traits.Either(traits.Bool, File,
12961296
argstr='--olmaxim=%s',
1297-
desc='output of local maxima volume')
1297+
desc='output of local maxima volume', hash_files=False)
12981298
out_size_file = traits.Either(traits.Bool, File,
12991299
argstr='--osize=%s',
1300-
desc='filename for output of size image')
1300+
desc='filename for output of size image', hash_files=False)
13011301
out_max_file = traits.Either(traits.Bool, File,
13021302
argstr='--omax=%s',
1303-
desc='filename for output of max image')
1303+
desc='filename for output of max image', hash_files=False)
13041304
out_mean_file = traits.Either(traits.Bool, File,
13051305
argstr='--omean=%s',
1306-
desc='filename for output of mean image')
1306+
desc='filename for output of mean image', hash_files=False)
13071307
out_pval_file = traits.Either(traits.Bool, File,
13081308
argstr='--opvals=%s',
1309-
desc='filename for image output of log pvals')
1309+
desc='filename for image output of log pvals', hash_files=False)
13101310
pthreshold = traits.Float(argstr='--pthresh=%.10f',
13111311
requires=['dlh', 'volume'],
13121312
desc='p-threshold for clusters')
@@ -1387,7 +1387,7 @@ def _list_outputs(self):
13871387
suffix='_' + suffix,
13881388
change_ext=change_ext)
13891389
else:
1390-
outputs[outkey] = inval
1390+
outputs[outkey] = os.pardir.abspath(inval)
13911391
return outputs
13921392

13931393
def _format_arg(self, name, spec, value):

nipype/interfaces/fsl/preprocess.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BETInputSpec(FSLCommandInputSpec):
3636
desc='input file to skull strip',
3737
argstr='%s', position=0, mandatory=True)
3838
out_file = File(desc='name of output skull stripped image',
39-
argstr='%s', position=1, genfile=True)
39+
argstr='%s', position=1, genfile=True, hash_files=False)
4040
outline = traits.Bool(desc='create surface outline image',
4141
argstr='-o')
4242
mask = traits.Bool(desc='create binary mask image',
@@ -356,10 +356,10 @@ class FLIRTInputSpec(FSLCommandInputSpec):
356356
reference = File(exists=True, argstr='-ref %s', mandatory=True,
357357
position=1, desc='reference file')
358358
out_file = File(argstr='-out %s', desc='registered output file',
359-
genfile=True, position=2)
359+
genfile=True, position=2, hash_files=False)
360360
out_matrix_file = File(argstr='-omat %s',
361361
desc='output affine matrix in 4x4 asciii format',
362-
genfile=True, position=3)
362+
genfile=True, position=3, hash_files=False)
363363
in_matrix_file = File(argstr='-init %s', desc='input 4x4 affine matrix')
364364
apply_xfm = traits.Bool(argstr='-applyxfm', requires=['in_matrix_file'],
365365
desc='apply transformation supplied by in_matrix_file')
@@ -520,7 +520,7 @@ class MCFLIRTInputSpec(FSLCommandInputSpec):
520520
in_file = File(exists=True, position=0, argstr="-in %s", mandatory=True,
521521
desc="timeseries to motion-correct")
522522
out_file = File(argstr='-out %s', genfile=True,
523-
desc="file to write")
523+
desc="file to write", hash_files=False)
524524
cost = traits.Enum('mutualinfo', 'woods', 'corratio', 'normcorr', 'normmi', 'leastsquares',
525525
argstr='-cost %s', desc="cost function to optimize")
526526
bins = traits.Int(argstr='-bins %d', desc="number of histogram bins")
@@ -623,7 +623,7 @@ def _gen_outfilename(self):
623623
if not isdefined(out_file) and isdefined(self.inputs.in_file):
624624
out_file = self._gen_fname(self.inputs.in_file,
625625
suffix='_mcf')
626-
return out_file
626+
return os.path.abspath(out_file)
627627

628628

629629
class FNIRTInputSpec(FSLCommandInputSpec):
@@ -641,24 +641,24 @@ class FNIRTInputSpec(FSLCommandInputSpec):
641641
fieldcoeff_file = traits.Either(traits.Bool, File, argstr='--cout=%s',
642642
desc='name of output file with field coefficients or true')
643643
warped_file = File(argstr='--iout=%s',
644-
desc='name of output image', genfile=True)
644+
desc='name of output image', genfile=True, hash_files=False)
645645
field_file = traits.Either(traits.Bool, File,
646646
argstr='--fout=%s',
647-
desc='name of output file with field or true')
647+
desc='name of output file with field or true', hash_files=False)
648648
jacobian_file = traits.Either(traits.Bool, File,
649649
argstr='--jout=%s',
650650
desc='name of file for writing out the Jacobian'\
651-
'of the field (for diagnostic or VBM purposes)')
651+
'of the field (for diagnostic or VBM purposes)', hash_files=False)
652652
modulatedref_file = traits.Either(traits.Bool, File,
653653
argstr='--refout=%s',
654654
desc='name of file for writing out intensity modulated'\
655-
'--ref (for diagnostic purposes)')
655+
'--ref (for diagnostic purposes)', hash_files=False)
656656
out_intensitymap_file = traits.Either(traits.Bool, File,
657657
argstr='--intout=%s',
658658
desc='name of files for writing information pertaining '\
659-
'to intensity mapping')
659+
'to intensity mapping', hash_files=False)
660660
log_file = File(argstr='--logout=%s',
661-
desc='Name of log-file', genfile=True)
661+
desc='Name of log-file', genfile=True, hash_files=False)
662662
config_file = File(exists=True, argstr='--config=%s',
663663
desc='Name of config file specifying command line arguments')
664664
refmask_file = File(exists=True, argstr='--refmask=%s',
@@ -806,7 +806,7 @@ def _list_outputs(self):
806806
suffix='_' + suffix,
807807
change_ext=change_ext)
808808
else:
809-
outputs[key] = inval
809+
outputs[key] = os.path.abspath(inval)
810810
return outputs
811811

812812
def _format_arg(self, name, spec, value):
@@ -843,7 +843,7 @@ class ApplyWarpInputSpec(FSLCommandInputSpec):
843843
mandatory=True,
844844
desc='image to be warped')
845845
out_file = File(argstr='--out=%s', genfile=True,
846-
desc='output filename')
846+
desc='output filename', hash_files=False)
847847
ref_file = File(exists=True, argstr='--ref=%s',
848848
mandatory=True,
849849
desc='reference image')
@@ -920,7 +920,7 @@ class SliceTimerInputSpec(FSLCommandInputSpec):
920920
mandatory=True, position=0,
921921
desc='filename of input timeseries')
922922
out_file = File(argstr='--out=%s', genfile=True,
923-
desc='filename of output timeseries')
923+
desc='filename of output timeseries', hash_files=False)
924924
index_dir = traits.Bool(argstr='--down',
925925
desc='slice indexing from top to bottom')
926926
time_repetition = traits.Float(argstr='--repeat=%f',
@@ -997,7 +997,7 @@ class SUSANInputSpec(FSLCommandInputSpec):
997997
'value for any brightness threshold will auto-set the '
998998
'threshold at 10% of the robust range')
999999
out_file = File(argstr='%s', position=-1, genfile=True,
1000-
desc='output file name')
1000+
desc='output file name', hash_files=False)
10011001

10021002

10031003
class SUSANOutputSpec(TraitedSpec):
@@ -1056,7 +1056,7 @@ class FUGUEInputSpec(FSLCommandInputSpec):
10561056
in_file = File(exists=True, argstr='--in=%s',
10571057
desc='filename of input volume')
10581058
unwarped_file = File(argstr='--unwarp=%s', genfile=True,
1059-
desc='apply unwarping and save as filename')
1059+
desc='apply unwarping and save as filename', hash_files=False)
10601060
phasemap_file = File(exists=True, argstr='--phasemap=%s',
10611061
desc='filename for input phase image')
10621062
dwell_to_asym_ratio = traits.Float(argstr='--dwelltoasym=%.10f',
@@ -1066,11 +1066,11 @@ class FUGUEInputSpec(FSLCommandInputSpec):
10661066
asym_se_time = traits.Float(argstr='--asym=%.10f',
10671067
desc='set the fieldmap asymmetric spin echo time (sec)')
10681068
fmap_out_file = File(argstr='--savefmap=%s',
1069-
desc='filename for saving fieldmap (rad/s)')
1069+
desc='filename for saving fieldmap (rad/s)', hash_files=False)
10701070
fmap_in_file = File(exists=True, argstr='--loadfmap=%s',
10711071
desc='filename for loading fieldmap (rad/s)')
10721072
shift_out_file = File(argstr='--saveshift=%s',
1073-
desc='filename for saving pixel shift volume')
1073+
desc='filename for saving pixel shift volume', hash_files=False)
10741074
shift_in_file = File(exists=True, argstr='--loadshift=%s',
10751075
desc='filename for reading pixel shift volume')
10761076
median_2dfilter = traits.Bool(argstr='--median',
@@ -1108,12 +1108,12 @@ class FUGUEInputSpec(FSLCommandInputSpec):
11081108
traits.File,
11091109
argstr='--unmaskfmap=%s',
11101110
requires=['fmap_out_file'],
1111-
desc='saves the unmasked fieldmap when using --savefmap')
1111+
desc='saves the unmasked fieldmap when using --savefmap', hash_files=False)
11121112
save_unmasked_shift = traits.Either(traits.Bool,
11131113
traits.File,
11141114
argstr='--unmaskshift=%s',
11151115
requires=['shift_out_file'],
1116-
desc='saves the unmasked shiftmap when using --saveshift')
1116+
desc='saves the unmasked shiftmap when using --saveshift', hash_files=False)
11171117
nokspace = traits.Bool(argstr='--nokspace', desc='do not use k-space forward warping')
11181118

11191119

@@ -1168,7 +1168,7 @@ class PRELUDEInputSpec(FSLCommandInputSpec):
11681168
desc='raw phase file')
11691169
unwrapped_phase_file = File(genfile=True,
11701170
argstr='--unwrap=%s',
1171-
desc='file containing unwrapepd phase')
1171+
desc='file containing unwrapepd phase', hash_files=False)
11721172
num_partitions = traits.Int(argstr='--numphasesplit=%d',
11731173
desc='number of phase partitions to use')
11741174
labelprocess2d = traits.Bool(argstr='--labelslices',
@@ -1188,11 +1188,11 @@ class PRELUDEInputSpec(FSLCommandInputSpec):
11881188
end = traits.Int(argstr='--end=%d',
11891189
desc='final image number to process (default Inf)')
11901190
savemask_file = File(argstr='--savemask=%s',
1191-
desc='saving the mask volume')
1191+
desc='saving the mask volume', hash_files=False)
11921192
rawphase_file = File(argstr='--rawphase=%s',
1193-
desc='saving the raw phase output')
1193+
desc='saving the raw phase output', hash_files=False)
11941194
label_file = File(argstr='--labels=%s',
1195-
desc='saving the area labels output')
1195+
desc='saving the area labels output', hash_files=False)
11961196
removeramps = traits.Bool(argstr='--removeramps',
11971197
desc='remove phase ramps during unwrapping')
11981198

@@ -1244,7 +1244,7 @@ class FIRSTInputSpec(FSLCommandInputSpec):
12441244
desc='input data file')
12451245
out_file = File('segmented', usedefault=True, mandatory=True, position=-1,
12461246
argstr='-o %s',
1247-
desc='output data file')
1247+
desc='output data file', hash_files=False)
12481248
verbose = traits.Bool(argstr='-v', position=1,
12491249
desc="Use verbose logging.")
12501250
brain_extracted = traits.Bool(argstr='-b', position=2,

0 commit comments

Comments
 (0)