From 1f50ebe397b692356dc4b34c646685badae85223 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 23 Jan 2015 11:29:11 -0500 Subject: [PATCH 1/2] Test Overlap not included before --- nipype/algorithms/tests/test_auto_Overlap.py | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 nipype/algorithms/tests/test_auto_Overlap.py diff --git a/nipype/algorithms/tests/test_auto_Overlap.py b/nipype/algorithms/tests/test_auto_Overlap.py new file mode 100644 index 0000000000..507b826812 --- /dev/null +++ b/nipype/algorithms/tests/test_auto_Overlap.py @@ -0,0 +1,46 @@ +# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT +from nipype.testing import assert_equal +from nipype.algorithms.misc import Overlap + +def test_Overlap_inputs(): + input_map = dict(bg_overlap=dict(mandatory=True, + usedefault=True, + ), + ignore_exception=dict(nohash=True, + usedefault=True, + ), + mask_volume=dict(), + out_file=dict(usedefault=True, + ), + vol_units=dict(mandatory=True, + usedefault=True, + ), + volume1=dict(mandatory=True, + ), + volume2=dict(mandatory=True, + ), + weighting=dict(usedefault=True, + ), + ) + inputs = Overlap.input_spec() + + for key, metadata in input_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(inputs.traits()[key], metakey), value + +def test_Overlap_outputs(): + output_map = dict(dice=dict(), + diff_file=dict(), + jaccard=dict(), + labels=dict(), + roi_di=dict(), + roi_ji=dict(), + roi_voldiff=dict(), + volume_difference=dict(), + ) + outputs = Overlap.output_spec() + + for key, metadata in output_map.items(): + for metakey, value in metadata.items(): + yield assert_equal, getattr(outputs.traits()[key], metakey), value + From c25657e549f0048494c9ee3a8bc624d527f29996 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 20 Feb 2015 19:01:19 -0500 Subject: [PATCH 2/2] Corrected Camino interface out_file auto-naming --- nipype/algorithms/metrics.py | 2 +- nipype/algorithms/tests/test_auto_ErrorMap.py | 3 ++- nipype/algorithms/tests/test_errormap.py | 6 +++--- nipype/interfaces/ants/registration.py | 2 +- nipype/interfaces/camino/dti.py | 6 +++++- nipype/testing/data/von-ray_errmap.nii.gz | Bin 0 -> 107 bytes nipype/testing/data/von_errmap.nii.gz | Bin 0 -> 96 bytes 7 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 nipype/testing/data/von-ray_errmap.nii.gz create mode 100644 nipype/testing/data/von_errmap.nii.gz diff --git a/nipype/algorithms/metrics.py b/nipype/algorithms/metrics.py index bffce04161..b26e63639a 100644 --- a/nipype/algorithms/metrics.py +++ b/nipype/algorithms/metrics.py @@ -572,7 +572,7 @@ def _run_interface(self, runtime): nb.Nifti1Image(errmap.astype(np.float32), nii_ref.get_affine(), hdr).to_filename(self._out_file) - return runtime + return runtime def _list_outputs(self): outputs = self.output_spec().get() diff --git a/nipype/algorithms/tests/test_auto_ErrorMap.py b/nipype/algorithms/tests/test_auto_ErrorMap.py index 99048aea9c..e729d7bd0a 100644 --- a/nipype/algorithms/tests/test_auto_ErrorMap.py +++ b/nipype/algorithms/tests/test_auto_ErrorMap.py @@ -23,7 +23,8 @@ def test_ErrorMap_inputs(): yield assert_equal, getattr(inputs.traits()[key], metakey), value def test_ErrorMap_outputs(): - output_map = dict(out_map=dict(), + output_map = dict(distance=dict(), + out_map=dict(), ) outputs = ErrorMap.output_spec() diff --git a/nipype/algorithms/tests/test_errormap.py b/nipype/algorithms/tests/test_errormap.py index 5c6110a020..46f23a9ed9 100644 --- a/nipype/algorithms/tests/test_errormap.py +++ b/nipype/algorithms/tests/test_errormap.py @@ -32,7 +32,7 @@ def test_errormap(): errmap.inputs.in_ref = os.path.join(tempdir, 'alan.nii.gz') errmap.out_map = os.path.join(tempdir, 'out_map.nii.gz') result = errmap.run() - yield assert_equal, result.outputs.distance, 1.125 + yield assert_equal, result.outputs.distance, 1.125 # Square metric errmap.inputs.metric = 'sqeuclidean' @@ -42,9 +42,9 @@ def test_errormap(): # Linear metric errmap.inputs.metric = 'euclidean' result = errmap.run() - yield assert_equal, result.outputs.distance, 0.875 + yield assert_equal, result.outputs.distance, 0.875 - # Masked + # Masked errmap.inputs.mask = os.path.join(tempdir, 'mask.nii.gz') result = errmap.run() yield assert_equal, result.outputs.distance, 1.0 diff --git a/nipype/interfaces/ants/registration.py b/nipype/interfaces/ants/registration.py index c8f51ec4ca..7f56764d71 100644 --- a/nipype/interfaces/ants/registration.py +++ b/nipype/interfaces/ants/registration.py @@ -395,7 +395,7 @@ class Registration(ANTSCommand): >>> outputs = reg4._list_outputs() >>> print outputs #doctest: +ELLIPSIS {'reverse_invert_flags': [], 'inverse_composite_transform': ['.../nipype/testing/data/output_InverseComposite.h5'], 'warped_image': '.../nipype/testing/data/output_warped_image.nii.gz', 'inverse_warped_image': , 'forward_invert_flags': [], 'reverse_transforms': [], 'composite_transform': ['.../nipype/testing/data/output_Composite.h5'], 'forward_transforms': []} - + >>> # Test collapse transforms flag >>> reg4b = copy.deepcopy(reg4) >>> reg4b.inputs.write_composite_transform = False diff --git a/nipype/interfaces/camino/dti.py b/nipype/interfaces/camino/dti.py index 1e6d42a288..7f12c915d3 100644 --- a/nipype/interfaces/camino/dti.py +++ b/nipype/interfaces/camino/dti.py @@ -549,7 +549,11 @@ class Track(CommandLine): def _list_outputs(self): outputs = self.output_spec().get() - outputs['tracked'] = os.path.abspath(self._gen_outfilename()) + if isdefined(self.inputs.out_file): + out_file_path = os.path.abspath(self.inputs.out_file) + else: + out_file_path = os.path.abspath(self._gen_outfilename()) + outputs['tracked'] = out_file_path return outputs def _gen_filename(self, name): diff --git a/nipype/testing/data/von-ray_errmap.nii.gz b/nipype/testing/data/von-ray_errmap.nii.gz new file mode 100644 index 0000000000000000000000000000000000000000..de7d3985d377326cb89a150464b003a61b902ddf GIT binary patch literal 107 zcmV-x0F?h9iwFp>$mdi7|8{R~EplObUuAM~ZDDXOZfR)%i(zD7Ff?Nz2$&g|z>tvv z0#P*xFercp8tfSu@Zk;45P4MH1IJ^+V>QSh=zv%;28KLsL$K!0EL*Xd!@vL%-*&j& N0RaEE!jOOg007c+D|Y|@ literal 0 HcmV?d00001 diff --git a/nipype/testing/data/von_errmap.nii.gz b/nipype/testing/data/von_errmap.nii.gz new file mode 100644 index 0000000000000000000000000000000000000000..8e79a46d128e3181c2aaa8c32b84fbd0902476bc GIT binary patch literal 96 zcmV-m0H6OKiwFp>$mdi7|8{R~UuAM~ZDDXOZfR)%i(zD7Ff?Nz2$&g|z>tvv0#P*x zFercp8tfSu@Zk;45P4MH1IJ^+V>QSh=zv%;28KLsLzrd<7z34tgcAUGrDr&R0RRBx C+#=5a literal 0 HcmV?d00001