Skip to content

Commit 267f1ab

Browse files
committed
OPEN - task 790: Add MIPAV support
http://github.com/nipy/nipype/issues/issue/790
1 parent 6da8f17 commit 267f1ab

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

nipype/interfaces/mipav/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from developer import edu.jhu.bme.smile.demo.RandomVol

nipype/interfaces/mipav/developer.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf8 -*-
2+
"""Autogenerated file - DO NOT EDIT
3+
If you spot a bug, please report it on the mailing list and/or change the generator."""
4+
5+
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
6+
import os
7+
8+
9+
class edu.jhu.bme.smile.demo.RandomVolInputSpec(CommandLineInputSpec):
10+
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
11+
inSize = traits.Int(desc="Size of Volume in X direction", argstr="--inSize %d")
12+
inSize2 = traits.Int(desc="Size of Volume in Y direction", argstr="--inSize2 %d")
13+
inSize3 = traits.Int(desc="Size of Volume in Z direction", argstr="--inSize3 %d")
14+
inSize4 = traits.Int(desc="Size of Volume in t direction", argstr="--inSize4 %d")
15+
inStandard = traits.Int(desc="Standard Deviation for Normal Distribution", argstr="--inStandard %d")
16+
inLambda = traits.Float(desc="Lambda Value for Exponential Distribution", argstr="--inLambda %f")
17+
inMaximum = traits.Int(desc="Maximum Value", argstr="--inMaximum %d")
18+
inMinimum = traits.Int(desc="Minimum Value", argstr="--inMinimum %d")
19+
inField = traits.Enum(""Uniform"", ""Normal"", ""Exponential"", desc="Field", argstr="--inField %s")
20+
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
21+
outRand1 = traits.Either(traits.Bool, File(), hash_files=False, desc="Rand1", argstr="--outRand1 %s")
22+
outExecution = traits.Str(desc="Execution Time", argstr="--outExecution %s")
23+
24+
25+
class edu.jhu.bme.smile.demo.RandomVolOutputSpec(TraitedSpec):
26+
outRand1 = File(desc="Rand1", exists=True)
27+
28+
29+
class edu.jhu.bme.smile.demo.RandomVol(SEMLikeCommandLine):
30+
"""title: Random_Volume_Generator
31+
32+
category:
33+
Developer Tools
34+
35+
36+
description:
37+
Generate a random scalar volume.
38+
39+
40+
41+
version: 1.11.RC
42+
43+
documentation-url:
44+
http://www.nitrc.org/projects/jist/
45+
46+
47+
contributor:
48+
49+
50+
51+
"""
52+
53+
input_spec = edu.jhu.bme.smile.demo.RandomVolInputSpec
54+
output_spec = edu.jhu.bme.smile.demo.RandomVolOutputSpec
55+
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.bme.smile.demo.RandomVol "
56+
_outputs_filenames = {'outRand1':'outRand1.nii'}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from nipype.interfaces.slicer.generate_classes import generate_all_classes
2+
3+
if __name__ == "__main__":
4+
## NOTE: For now either the launcher needs to be found on the default path, or
5+
## every tool in the modules list must be found on the default path
6+
## AND calling the module with --xml must be supported and compliant.
7+
modules_list = ['edu.jhu.bme.smile.demo.RandomVol']
8+
9+
## SlicerExecutionModel compliant tools that are usually statically built, and don't need the Slicer3 --launcher
10+
generate_all_classes(modules_list=modules_list,launcher=["java edu.jhu.ece.iacl.jist.cli.run" ])
11+
## Tools compliant with SlicerExecutionModel called from the Slicer environment (for shared lib compatibility)
12+
#launcher = ['/home/raid3/gorgolewski/software/slicer/Slicer', '--launch']
13+
#generate_all_classes(modules_list=modules_list, launcher=launcher)
14+
#generate_all_classes(modules_list=['BRAINSABC'], launcher=[] )])
15+
## Tools compliant with SlicerExecutionModel called from the Slicer environment (for shared lib compatibility)
16+
#launcher = ['/home/raid3/gorgolewski/software/slicer/Slicer', '--launch']
17+
#generate_all_classes(modules_list=modules_list, launcher=launcher)
18+
#generate_all_classes(modules_list=['BRAINSABC'], launcher=[] )

nipype/interfaces/slicer/generate_classes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,9 @@ def grab_xml(module, launcher):
304304
final_command = " ".join(command_list)
305305
xmlReturnValue = subprocess.Popen(
306306
final_command, stdout=subprocess.PIPE, shell=True).communicate()[0]
307+
#workaround for a JIST bug https://www.nitrc.org/tracker/index.php?func=detail&aid=7233&group_id=228&atid=942
308+
if xmlReturnValue.strip().endswith("XML"):
309+
xmlReturnValue = xmlReturnValue.strip()[:-3]
307310
return xml.dom.minidom.parseString(xmlReturnValue)
308311
# if ret.runtime.returncode == 0:
309312
# return xml.dom.minidom.parseString(ret.runtime.stdout)

0 commit comments

Comments
 (0)