Skip to content

Commit 70d8290

Browse files
committed
Added LesionTOADS
1 parent f1f8355 commit 70d8290

File tree

3 files changed

+215
-5
lines changed

3 files changed

+215
-5
lines changed

nipype/interfaces/mipav/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from developer import MedicAlgorithmSPECTRE2010, JistIntensityMp2rageMasking
1+
from developer import MedicAlgorithmLesionToads, JistCortexSurfaceMeshInflation, MedicAlgorithmImageCalculator, JistBrainMp2rageDuraEstimation, MedicAlgorithmSPECTRE2010, JistBrainPartialVolumeFilter, JistIntensityMp2rageMasking

nipype/interfaces/mipav/developer.py

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,183 @@
66
import os
77

88

9+
class MedicAlgorithmLesionToadsInputSpec(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+
inT1_MPRAGE = File(desc="T1_MPRAGE Image", exists=True, argstr="--inT1_MPRAGE %s")
12+
inT1_SPGR = File(desc="T1_SPGR Image", exists=True, argstr="--inT1_SPGR %s")
13+
inFLAIR = File(desc="FLAIR Image", exists=True, argstr="--inFLAIR %s")
14+
inAtlas = traits.Enum("With Lesion", "No Lesion", desc="Atlas to Use", argstr="--inAtlas %s")
15+
inOutput = traits.Enum("hard segmentation", "hard segmentation+memberships", "cruise inputs", "dura removal inputs", desc="Output images", argstr="--inOutput %s")
16+
inOutput2 = traits.Enum("true", "false", desc="Output the hard classification using maximum membership (not neceesarily topologically correct)", argstr="--inOutput2 %s")
17+
inCorrect = traits.Enum("true", "false", desc="Correct MR field inhomogeneity.", argstr="--inCorrect %s")
18+
inOutput3 = traits.Enum("true", "false", desc="Output the estimated inhomogeneity field", argstr="--inOutput3 %s")
19+
inAtlas2 = File(desc="Atlas File - With Lesions", exists=True, argstr="--inAtlas2 %s")
20+
inAtlas3 = File(desc="Atlas File - No Lesion - T1 and FLAIR", exists=True, argstr="--inAtlas3 %s")
21+
inAtlas4 = File(desc="Atlas File - No Lesion - T1 Only", exists=True, argstr="--inAtlas4 %s")
22+
inMaximum = traits.Int(desc="Maximum distance from the interventricular WM boundary to downweight the lesion membership to avoid false postives", argstr="--inMaximum %d")
23+
inMaximum2 = traits.Int(desc="Maximum Ventircle Distance", argstr="--inMaximum2 %d")
24+
inMaximum3 = traits.Int(desc="Maximum InterVentricular Distance", argstr="--inMaximum3 %d")
25+
inInclude = traits.Enum("true", "false", desc="Include lesion in WM class in hard classification", argstr="--inInclude %s")
26+
inAtlas5 = traits.Float(desc="Controls the effect of the statistical atlas on the segmentation", argstr="--inAtlas5 %f")
27+
inSmooting = traits.Float(desc="Controls the effect of neighberhood voxels on the membership", argstr="--inSmooting %f")
28+
inMaximum4 = traits.Float(desc="Maximum amount of relative change in the energy function considered as the convergence criteria", argstr="--inMaximum4 %f")
29+
inMaximum5 = traits.Int(desc="Maximum iterations", argstr="--inMaximum5 %d")
30+
inAtlas6 = traits.Enum("rigid", "multi_fully_affine", desc="Atlas alignment", argstr="--inAtlas6 %s")
31+
inConnectivity = traits.Enum("(26,6)", "(6,26)", "(6,18)", "(18,6)", desc="Connectivity (foreground,background)", argstr="--inConnectivity %s")
32+
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
33+
outHard = traits.Either(traits.Bool, File(), hash_files=False, desc="Hard segmentation", argstr="--outHard %s")
34+
outHard2 = traits.Either(traits.Bool, File(), hash_files=False, desc="Hard segmentationfrom memberships", argstr="--outHard2 %s")
35+
outInhomogeneity = traits.Either(traits.Bool, File(), hash_files=False, desc="Inhomogeneity Field", argstr="--outInhomogeneity %s")
36+
outMembership = traits.Either(traits.Bool, File(), hash_files=False, desc="Membership Functions", argstr="--outMembership %s")
37+
outLesion = traits.Either(traits.Bool, File(), hash_files=False, desc="Lesion Segmentation", argstr="--outLesion %s")
38+
outSulcal = traits.Either(traits.Bool, File(), hash_files=False, desc="Sulcal CSF Membership", argstr="--outSulcal %s")
39+
outCortical = traits.Either(traits.Bool, File(), hash_files=False, desc="Cortical GM Membership", argstr="--outCortical %s")
40+
outFilled = traits.Either(traits.Bool, File(), hash_files=False, desc="Filled WM Membership", argstr="--outFilled %s")
41+
outWM = traits.Either(traits.Bool, File(), hash_files=False, desc="WM Mask", argstr="--outWM %s")
42+
outExecution = traits.Str(desc="Execution Time", argstr="--outExecution %s")
43+
44+
45+
class MedicAlgorithmLesionToadsOutputSpec(TraitedSpec):
46+
outHard = File(desc="Hard segmentation", exists=True)
47+
outHard2 = File(desc="Hard segmentationfrom memberships", exists=True)
48+
outInhomogeneity = File(desc="Inhomogeneity Field", exists=True)
49+
outMembership = File(desc="Membership Functions", exists=True)
50+
outLesion = File(desc="Lesion Segmentation", exists=True)
51+
outSulcal = File(desc="Sulcal CSF Membership", exists=True)
52+
outCortical = File(desc="Cortical GM Membership", exists=True)
53+
outFilled = File(desc="Filled WM Membership", exists=True)
54+
outWM = File(desc="WM Mask", exists=True)
55+
56+
57+
class MedicAlgorithmLesionToads(SEMLikeCommandLine):
58+
"""title: Lesion TOADS
59+
60+
category: Developer Tools
61+
62+
description: Algorithm for simulataneous brain structures and MS lesion segmentation of MS Brains. The brain segmentation is topologically consistent and the algorithm can use multiple MR sequences as input data.
63+
N. Shiee, P.-L. Bazin, A.Z. Ozturk, P.A. Calabresi, D.S. Reich, D.L. Pham, "A Topology-Preserving Approach to the Segmentation of Brain Images with Multiple Sclerosis", NeuroImage, vol. 49, no. 2, pp. 1524-1535, 2010.
64+
65+
version: 1.7.R
66+
67+
contributor: Navid Shiee ([email protected]) http://iacl.ece.jhu.edu/~nshiee/
68+
69+
"""
70+
71+
input_spec = MedicAlgorithmLesionToadsInputSpec
72+
output_spec = MedicAlgorithmLesionToadsOutputSpec
73+
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmLesionToads "
74+
_outputs_filenames = {'outWM':'outWM.nii','outHard':'outHard.nii','outFilled':'outFilled.nii','outMembership':'outMembership.nii','outInhomogeneity':'outInhomogeneity.nii','outCortical':'outCortical.nii','outHard2':'outHard2.nii','outLesion':'outLesion.nii','outSulcal':'outSulcal.nii'}
75+
_redirect_x = True
76+
77+
78+
class JistCortexSurfaceMeshInflationInputSpec(CommandLineInputSpec):
79+
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
80+
inLevelset = File(desc="Levelset Image", exists=True, argstr="--inLevelset %s")
81+
inSOR = traits.Float(desc="SOR Parameter", argstr="--inSOR %f")
82+
inMean = traits.Float(desc="Mean Curvature Threshold", argstr="--inMean %f")
83+
inStep = traits.Int(desc="Step Size", argstr="--inStep %d")
84+
inMax = traits.Int(desc="Max Iterations", argstr="--inMax %d")
85+
inLorentzian = traits.Enum("true", "false", desc="Lorentzian Norm", argstr="--inLorentzian %s")
86+
inTopology = traits.Enum("26/6", "6/26", "18/6", "6/18", "6/6", "wcs", "wco", "no", desc="Topology", argstr="--inTopology %s")
87+
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
88+
outOriginal = traits.Either(traits.Bool, File(), hash_files=False, desc="Original Surface", argstr="--outOriginal %s")
89+
outInflated = traits.Either(traits.Bool, File(), hash_files=False, desc="Inflated Surface", argstr="--outInflated %s")
90+
outExecution = traits.Str(desc="Execution Time", argstr="--outExecution %s")
91+
92+
93+
class JistCortexSurfaceMeshInflationOutputSpec(TraitedSpec):
94+
outOriginal = File(desc="Original Surface", exists=True)
95+
outInflated = File(desc="Inflated Surface", exists=True)
96+
97+
98+
class JistCortexSurfaceMeshInflation(SEMLikeCommandLine):
99+
"""title: Surface Mesh Inflation
100+
101+
category: Developer Tools
102+
103+
description: Inflates a cortical surface mesh.
104+
D. Tosun, M. E. Rettmann, X. Han, X. Tao, C. Xu, S. M. Resnick, D. Pham, and J. L. Prince, Cortical Surface Segmentation and Mapping, NeuroImage, vol. 23, pp. S108--S118, 2004.
105+
106+
version: 3.0.RC
107+
108+
contributor: Duygu Tosun
109+
110+
"""
111+
112+
input_spec = JistCortexSurfaceMeshInflationInputSpec
113+
output_spec = JistCortexSurfaceMeshInflationOutputSpec
114+
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.cortex.JistCortexSurfaceMeshInflation "
115+
_outputs_filenames = {'outOriginal':'outOriginal','outInflated':'outInflated'}
116+
_redirect_x = True
117+
118+
119+
class MedicAlgorithmImageCalculatorInputSpec(CommandLineInputSpec):
120+
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
121+
inVolume = File(desc="Volume 1", exists=True, argstr="--inVolume %s")
122+
inVolume2 = File(desc="Volume 2", exists=True, argstr="--inVolume2 %s")
123+
inOperation = traits.Enum("Add", "Subtract", "Multiply", "Divide", "Min", "Max", desc="Operation", argstr="--inOperation %s")
124+
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
125+
outResult = traits.Either(traits.Bool, File(), hash_files=False, desc="Result Volume", argstr="--outResult %s")
126+
outExecution = traits.Str(desc="Execution Time", argstr="--outExecution %s")
127+
128+
129+
class MedicAlgorithmImageCalculatorOutputSpec(TraitedSpec):
130+
outResult = File(desc="Result Volume", exists=True)
131+
132+
133+
class MedicAlgorithmImageCalculator(SEMLikeCommandLine):
134+
"""title: Image Calculator
135+
136+
category: Developer Tools
137+
138+
description: Perform simple image calculator operations on two images. The operations include 'Add', 'Subtract', 'Multiply', and 'Divide'
139+
140+
version: 1.10.RC
141+
142+
documentation-url: http://www.iacl.ece.jhu.edu/
143+
144+
"""
145+
146+
input_spec = MedicAlgorithmImageCalculatorInputSpec
147+
output_spec = MedicAlgorithmImageCalculatorOutputSpec
148+
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.utilities.math.MedicAlgorithmImageCalculator "
149+
_outputs_filenames = {'outResult':'outResult.nii'}
150+
_redirect_x = True
151+
152+
153+
class JistBrainMp2rageDuraEstimationInputSpec(CommandLineInputSpec):
154+
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
155+
inSecond = File(desc="Second inversion (Inv2) Image", exists=True, argstr="--inSecond %s")
156+
inSkull = File(desc="Skull Stripping Mask", exists=True, argstr="--inSkull %s")
157+
inDistance = traits.Float(desc="Distance to background (mm)", argstr="--inDistance %f")
158+
inoutput = traits.Enum("dura_region", "boundary", "dura_prior", "bg_prior", "intens_prior", desc="Outputs an estimate of the dura / CSF boundary or an estimate of the entire dura region.", argstr="--inoutput %s")
159+
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
160+
outDura = traits.Either(traits.Bool, File(), hash_files=False, desc="Dura Image", argstr="--outDura %s")
161+
outExecution = traits.Str(desc="Execution Time", argstr="--outExecution %s")
162+
163+
164+
class JistBrainMp2rageDuraEstimationOutputSpec(TraitedSpec):
165+
outDura = File(desc="Dura Image", exists=True)
166+
167+
168+
class JistBrainMp2rageDuraEstimation(SEMLikeCommandLine):
169+
"""title: MP2RAGE Dura Estimation
170+
171+
category: Developer Tools
172+
173+
description: Filters a MP2RAGE brain image to obtain a probability map of dura matter.
174+
175+
version: 3.0.RC
176+
177+
"""
178+
179+
input_spec = JistBrainMp2rageDuraEstimationInputSpec
180+
output_spec = JistBrainMp2rageDuraEstimationOutputSpec
181+
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.brain.JistBrainMp2rageDuraEstimation "
182+
_outputs_filenames = {'outDura':'outDura.nii'}
183+
_redirect_x = True
184+
185+
9186
class MedicAlgorithmSPECTRE2010InputSpec(CommandLineInputSpec):
10187
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
11188
inInput = File(desc="Input volume to be skullstripped.", exists=True, argstr="--inInput %s")
@@ -96,6 +273,38 @@ class MedicAlgorithmSPECTRE2010(SEMLikeCommandLine):
96273
_redirect_x = True
97274

98275

276+
class JistBrainPartialVolumeFilterInputSpec(CommandLineInputSpec):
277+
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
278+
inInput = File(desc="Input Image", exists=True, argstr="--inInput %s")
279+
inPV = traits.Enum("bright", "dark", "both", desc="Outputs the raw intensity values or a probability score for the partial volume regions.", argstr="--inPV %s")
280+
inoutput = traits.Enum("probability", "intensity", desc="output", argstr="--inoutput %s")
281+
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
282+
outPartial = traits.Either(traits.Bool, File(), hash_files=False, desc="Partial Volume Image", argstr="--outPartial %s")
283+
outExecution = traits.Str(desc="Execution Time", argstr="--outExecution %s")
284+
285+
286+
class JistBrainPartialVolumeFilterOutputSpec(TraitedSpec):
287+
outPartial = File(desc="Partial Volume Image", exists=True)
288+
289+
290+
class JistBrainPartialVolumeFilter(SEMLikeCommandLine):
291+
"""title: Partial Volume Filter
292+
293+
category: Developer Tools
294+
295+
description: Filters an image for regions of partial voluming assuming a ridge-like model of intensity.
296+
297+
version: 2.0.RC
298+
299+
"""
300+
301+
input_spec = JistBrainPartialVolumeFilterInputSpec
302+
output_spec = JistBrainPartialVolumeFilterOutputSpec
303+
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.brain.JistBrainPartialVolumeFilter "
304+
_outputs_filenames = {'outPartial':'outPartial.nii'}
305+
_redirect_x = True
306+
307+
99308
class JistIntensityMp2rageMaskingInputSpec(CommandLineInputSpec):
100309
maxMemoryUsage = traits.Int(desc="Maximum Memory Allowed (in MegaBytes). Increase or decrease this depending on java virtual machine heap size requirements.", argstr="--maxMemoryUsage %d")
101310
inSecond = File(desc="Second inversion (Inv2) Image", exists=True, argstr="--inSecond %s")

nipype/interfaces/mipav/generate_classes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
'de.mpg.cbs.jist.modules.JistModuleRelabelSegmentation',
3535
'de.mpg.cbs.jist.modules.JistModuleAggregativeSliceClustering',
3636
#'de.mpg.cbs.jist.modules.JistModuleMgdmMultiSegmentation',
37-
'de.mpg.cbs.jist.modules.JistModuleCorticalProfileFeatures',
37+
#'de.mpg.cbs.jist.modules.JistModuleCorticalProfileFeatures',
3838
'de.mpg.cbs.jist.modules.JistModuleCorticalProfileMeshSampling',
3939
'de.mpg.cbs.jist.modules.JistModuleIntensityBounds',
4040
'de.mpg.cbs.jist.modules.JistModuleCorticalMeshMapping',
@@ -75,7 +75,7 @@
7575
#'de.mpg.cbs.jist.modules.JistModuleCorticalInflation',
7676
'de.mpg.cbs.jist.modules.JistModuleExtractBrainRegion',
7777
'de.mpg.cbs.jist.modules.JistModuleAtlasBasedSimulator',
78-
'de.mpg.cbs.jist.modules.JistModuleProbabilityToLevelset',
78+
#'de.mpg.cbs.jist.modules.JistModuleProbabilityToLevelset',
7979
#'de.mpg.cbs.jist.modules.JistModuleROISimilarity',
8080
'de.mpg.cbs.jist.modules.JistModuleROIMembership',
8181
'de.mpg.cbs.jist.modules.JistModuleRenameImage',
@@ -116,15 +116,16 @@
116116
#'de.mpg.cbs.jist.modules.JistModuleCopyData', XML not well formed
117117
#'de.mpg.cbs.jist.tools.JistToolsIntensityNormalization',
118118
#'de.mpg.cbs.jist.tools.JistToolsExtractBrainRegion',
119-
'edu.jhu.ece.iacl.plugins.utilities.volume.MedicAlgorithmThresholdToBinaryMask',# XML not well formed
119+
#'edu.jhu.ece.iacl.plugins.utilities.volume.MedicAlgorithmThresholdToBinaryMask',# XML not well formed
120120
#'de.mpg.cbs.jist.cortex.JistCortexFullCRUISE',
121121
'de.mpg.cbs.jist.cortex.JistCortexSurfaceMeshInflation']
122122

123123
modules_from_julia = ['de.mpg.cbs.jist.intensity.JistIntensityMp2rageMasking',
124124
'edu.jhu.ece.iacl.plugins.segmentation.skull_strip.MedicAlgorithmSPECTRE2010']
125+
modules_from_leaonie = ['edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmLesionToads']
125126

126127
#modules_list = list(set(modules_list).union(set(modules_from_chris)))
127-
modules_list = modules_from_julia
128+
modules_list = list(set(modules_from_chris).union(set(modules_from_leaonie)).union(set(modules_from_julia)))
128129

129130
## SlicerExecutionModel compliant tools that are usually statically built, and don't need the Slicer3 --launcher
130131
generate_all_classes(modules_list=modules_list,launcher=["java edu.jhu.ece.iacl.jist.cli.run" ], redirect_x = True)

0 commit comments

Comments
 (0)