diff --git a/nipype/interfaces/petpvc.py b/nipype/interfaces/petpvc.py index 00dbbfb3ea..6149dc594f 100644 --- a/nipype/interfaces/petpvc.py +++ b/nipype/interfaces/petpvc.py @@ -6,81 +6,8 @@ >>> filepath = os.path.dirname( os.path.realpath( __file__ ) ) >>> datadir = os.path.realpath(os.path.join(filepath, '../testing/data')) >>> os.chdir(datadir) - -Nipype interface for PETPVC. - -PETPVC is a software from the Nuclear Medicine Department -of the UCL University Hospital, London, UK. - -Its source code is here: https://github.com/UCL/PETPVC - -The methods that it implement are explained here: -K. Erlandsson, I. Buvat, P. H. Pretorius, B. A. Thomas, and B. F. Hutton, -"A review of partial volume correction techniques for emission tomography -and their applications in neurology, cardiology and oncology," Phys. Med. -Biol., vol. 57, no. 21, p. R119, 2012. - -There is a publication waiting to be accepted for this software tool. - - -Its command line help shows this: - - -i --input < filename > - = PET image file - -o --output < filename > - = Output file - [ -m --mask < filename > ] - = Mask image file - -p --pvc < keyword > - = Desired PVC method - -x < X > - = The full-width at half maximum in mm along x-axis - -y < Y > - = The full-width at half maximum in mm along y-axis - -z < Z > - = The full-width at half maximum in mm along z-axis - [ -d --debug ] - = Prints debug information - [ -n --iter [ Val ] ] - = Number of iterations - With: Val (Default = 10) - [ -k [ Val ] ] - = Number of deconvolution iterations - With: Val (Default = 10) - [ -a --alpha [ aval ] ] - = Alpha value - With: aval (Default = 1.5) - [ -s --stop [ stopval ] ] - = Stopping criterion - With: stopval (Default = 0.01) - ----------------------------------------------- -Technique - keyword - -Geometric transfer matrix - "GTM" -Labbe approach - "LABBE" -Richardson-Lucy - "RL" -Van-Cittert - "VC" -Region-based voxel-wise correction - "RBV" -RBV with Labbe - "LABBE+RBV" -RBV with Van-Cittert - "RBV+VC" -RBV with Richardson-Lucy - "RBV+RL" -RBV with Labbe and Van-Cittert - "LABBE+RBV+VC" -RBV with Labbe and Richardson-Lucy- "LABBE+RBV+RL" -Multi-target correction - "MTC" -MTC with Labbe - "LABBE+MTC" -MTC with Van-Cittert - "MTC+VC" -MTC with Richardson-Lucy - "MTC+RL" -MTC with Labbe and Van-Cittert - "LABBE+MTC+VC" -MTC with Labbe and Richardson-Lucy- "LABBE+MTC+RL" -Iterative Yang - "IY" -Iterative Yang with Van-Cittert - "IY+VC" -Iterative Yang with Richardson-Lucy - "IY+RL" -Muller Gartner - "MG" -Muller Gartner with Van-Cittert - "MG+VC" -Muller Gartner with Richardson-Lucy - "MG+RL" - """ + from __future__ import print_function from __future__ import division @@ -144,6 +71,76 @@ class PETPVCOutputSpec(TraitedSpec): class PETPVC(CommandLine): """ Use PETPVC for partial volume correction of PET images. + PETPVC is a software from the Nuclear Medicine Department + of the UCL University Hospital, London, UK. + + Its source code is here: https://github.com/UCL/PETPVC + + The methods that it implement are explained here: + K. Erlandsson, I. Buvat, P. H. Pretorius, B. A. Thomas, and B. F. Hutton, + "A review of partial volume correction techniques for emission tomography + and their applications in neurology, cardiology and oncology," Phys. Med. + Biol., vol. 57, no. 21, p. R119, 2012. + + There is a publication waiting to be accepted for this software tool. + + Its command line help shows this: + + -i --input < filename > + = PET image file + -o --output < filename > + = Output file + [ -m --mask < filename > ] + = Mask image file + -p --pvc < keyword > + = Desired PVC method + -x < X > + = The full-width at half maximum in mm along x-axis + -y < Y > + = The full-width at half maximum in mm along y-axis + -z < Z > + = The full-width at half maximum in mm along z-axis + [ -d --debug ] + = Prints debug information + [ -n --iter [ Val ] ] + = Number of iterations + With: Val (Default = 10) + [ -k [ Val ] ] + = Number of deconvolution iterations + With: Val (Default = 10) + [ -a --alpha [ aval ] ] + = Alpha value + With: aval (Default = 1.5) + [ -s --stop [ stopval ] ] + = Stopping criterion + With: stopval (Default = 0.01) + + ---------------------------------------------- + Technique - keyword + + Geometric transfer matrix - "GTM" + Labbe approach - "LABBE" + Richardson-Lucy - "RL" + Van-Cittert - "VC" + Region-based voxel-wise correction - "RBV" + RBV with Labbe - "LABBE+RBV" + RBV with Van-Cittert - "RBV+VC" + RBV with Richardson-Lucy - "RBV+RL" + RBV with Labbe and Van-Cittert - "LABBE+RBV+VC" + RBV with Labbe and Richardson-Lucy- "LABBE+RBV+RL" + Multi-target correction - "MTC" + MTC with Labbe - "LABBE+MTC" + MTC with Van-Cittert - "MTC+VC" + MTC with Richardson-Lucy - "MTC+RL" + MTC with Labbe and Van-Cittert - "LABBE+MTC+VC" + MTC with Labbe and Richardson-Lucy- "LABBE+MTC+RL" + Iterative Yang - "IY" + Iterative Yang with Van-Cittert - "IY+VC" + Iterative Yang with Richardson-Lucy - "IY+RL" + Muller Gartner - "MG" + Muller Gartner with Van-Cittert - "MG+VC" + Muller Gartner with Richardson-Lucy - "MG+RL" + Examples -------- >>> from ..testing import example_data diff --git a/nipype/interfaces/tests/test_utility.py b/nipype/interfaces/tests/test_utility.py index b9b61fbf0f..0e9f8ad66c 100644 --- a/nipype/interfaces/tests/test_utility.py +++ b/nipype/interfaces/tests/test_utility.py @@ -63,7 +63,6 @@ def increment_array(in_array): f2 = pe.MapNode(utility.Function(input_names=['in_array'], output_names=['out_array'], function=increment_array), name='increment_array', iterfield=['in_array']) wf.connect(f1, 'random_array', f2, 'in_array') - wf.run() # Clean up @@ -167,3 +166,57 @@ def test_csvReader(): yield assert_equal, out.outputs.column_1, ['hello', 'world', 'goodbye'] yield assert_equal, out.outputs.column_2, ['300.1', '5', '0.3'] os.unlink(name) + + +def test_aux_connect_function(): + """ This tests excution nodes with multiple inputs and auxiliary + function inside the Workflow connect function. + """ + tempdir = os.path.realpath(mkdtemp()) + origdir = os.getcwd() + os.chdir(tempdir) + + wf = pe.Workflow(name="test_workflow") + + def _gen_tuple(size): + return [1, ] * size + + def _sum_and_sub_mul(a, b, c): + return (a+b)*c, (a-b)*c + + def _inc(x): + return x + 1 + + params = pe.Node(utility.IdentityInterface(fields=['size', 'num']), name='params') + params.inputs.num = 42 + params.inputs.size = 1 + + gen_tuple = pe.Node(utility.Function(input_names=['size'], + output_names=['tuple'], + function=_gen_tuple), + name='gen_tuple') + + ssm = pe.Node(utility.Function(input_names=['a', 'b', 'c'], + output_names=['sum', 'sub'], + function=_sum_and_sub_mul), + name='sum_and_sub_mul') + + split = pe.Node(utility.Split(splits=[1, 1], + squeeze=True), + name='split') + + + wf.connect([ + (params, gen_tuple, [(("size", _inc), "size")]), + (params, ssm, [(("num", _inc), "c")]), + (gen_tuple, split, [("tuple", "inlist")]), + (split, ssm, [(("out1", _inc), "a"), + ("out2", "b"), + ]), + ]) + + wf.run() + + # Clean up + os.chdir(origdir) + shutil.rmtree(tempdir) diff --git a/nipype/pipeline/engine/workflows.py b/nipype/pipeline/engine/workflows.py index b14d73a307..0fce4f328b 100644 --- a/nipype/pipeline/engine/workflows.py +++ b/nipype/pipeline/engine/workflows.py @@ -690,7 +690,7 @@ def _configure_exec_nodes(self, graph): node.input_source = {} for edge in graph.in_edges_iter(node): data = graph.get_edge_data(*edge) - for sourceinfo, field in sorted(data['connect']): + for sourceinfo, field in data['connect']: node.input_source[field] = \ (op.join(edge[0].output_dir(), 'result_%s.pklz' % edge[0].name),