/
arithmetic.py
274 lines (203 loc) · 8.75 KB
/
arithmetic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# -*- coding: utf-8 -*-
# -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import (
CommandLine,
CommandLineInputSpec,
SEMLikeCommandLine,
TraitedSpec,
File,
Directory,
traits,
isdefined,
InputMultiPath,
OutputMultiPath,
)
import os
class MultiplyScalarVolumesInputSpec(CommandLineInputSpec):
inputVolume1 = File(position=-3, desc="Input volume 1", exists=True, argstr="%s")
inputVolume2 = File(position=-2, desc="Input volume 2", exists=True, argstr="%s")
outputVolume = traits.Either(
traits.Bool,
File(),
position=-1,
hash_files=False,
desc="Volume1 * Volume2",
argstr="%s",
)
order = traits.Enum(
"0",
"1",
"2",
"3",
desc="Interpolation order if two images are in different coordinate frames or have different sampling.",
argstr="--order %s",
)
class MultiplyScalarVolumesOutputSpec(TraitedSpec):
outputVolume = File(position=-1, desc="Volume1 * Volume2", exists=True)
class MultiplyScalarVolumes(SEMLikeCommandLine):
"""title: Multiply Scalar Volumes
category: Filtering.Arithmetic
description: Multiplies two images. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions.
version: 0.1.0.$Revision: 8595 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Multiply
contributor: Bill Lorensen (GE)
acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
"""
input_spec = MultiplyScalarVolumesInputSpec
output_spec = MultiplyScalarVolumesOutputSpec
_cmd = "MultiplyScalarVolumes "
_outputs_filenames = {"outputVolume": "outputVolume.nii"}
class MaskScalarVolumeInputSpec(CommandLineInputSpec):
InputVolume = File(
position=-3, desc="Input volume to be masked", exists=True, argstr="%s"
)
MaskVolume = File(
position=-2, desc="Label volume containing the mask", exists=True, argstr="%s"
)
OutputVolume = traits.Either(
traits.Bool,
File(),
position=-1,
hash_files=False,
desc="Output volume: Input Volume masked by label value from Mask Volume",
argstr="%s",
)
label = traits.Int(
desc="Label value in the Mask Volume to use as the mask", argstr="--label %d"
)
replace = traits.Int(
desc="Value to use for the output volume outside of the mask",
argstr="--replace %d",
)
class MaskScalarVolumeOutputSpec(TraitedSpec):
OutputVolume = File(
position=-1,
desc="Output volume: Input Volume masked by label value from Mask Volume",
exists=True,
)
class MaskScalarVolume(SEMLikeCommandLine):
"""title: Mask Scalar Volume
category: Filtering.Arithmetic
description: Masks two images. The output image is set to 0 everywhere except where the chosen label from the mask volume is present, at which point it will retain it's original values. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions.
version: 0.1.0.$Revision: 8595 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Mask
contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH)
acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
"""
input_spec = MaskScalarVolumeInputSpec
output_spec = MaskScalarVolumeOutputSpec
_cmd = "MaskScalarVolume "
_outputs_filenames = {"OutputVolume": "OutputVolume.nii"}
class SubtractScalarVolumesInputSpec(CommandLineInputSpec):
inputVolume1 = File(position=-3, desc="Input volume 1", exists=True, argstr="%s")
inputVolume2 = File(position=-2, desc="Input volume 2", exists=True, argstr="%s")
outputVolume = traits.Either(
traits.Bool,
File(),
position=-1,
hash_files=False,
desc="Volume1 - Volume2",
argstr="%s",
)
order = traits.Enum(
"0",
"1",
"2",
"3",
desc="Interpolation order if two images are in different coordinate frames or have different sampling.",
argstr="--order %s",
)
class SubtractScalarVolumesOutputSpec(TraitedSpec):
outputVolume = File(position=-1, desc="Volume1 - Volume2", exists=True)
class SubtractScalarVolumes(SEMLikeCommandLine):
"""title: Subtract Scalar Volumes
category: Filtering.Arithmetic
description: Subtracts two images. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions.
version: 0.1.0.$Revision: 19608 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Subtract
contributor: Bill Lorensen (GE)
acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
"""
input_spec = SubtractScalarVolumesInputSpec
output_spec = SubtractScalarVolumesOutputSpec
_cmd = "SubtractScalarVolumes "
_outputs_filenames = {"outputVolume": "outputVolume.nii"}
class AddScalarVolumesInputSpec(CommandLineInputSpec):
inputVolume1 = File(position=-3, desc="Input volume 1", exists=True, argstr="%s")
inputVolume2 = File(position=-2, desc="Input volume 2", exists=True, argstr="%s")
outputVolume = traits.Either(
traits.Bool,
File(),
position=-1,
hash_files=False,
desc="Volume1 + Volume2",
argstr="%s",
)
order = traits.Enum(
"0",
"1",
"2",
"3",
desc="Interpolation order if two images are in different coordinate frames or have different sampling.",
argstr="--order %s",
)
class AddScalarVolumesOutputSpec(TraitedSpec):
outputVolume = File(position=-1, desc="Volume1 + Volume2", exists=True)
class AddScalarVolumes(SEMLikeCommandLine):
"""title: Add Scalar Volumes
category: Filtering.Arithmetic
description: Adds two images. Although all image types are supported on input, only signed types are produced. The two images do not have to have the same dimensions.
version: 0.1.0.$Revision: 19608 $(alpha)
documentation-url: http://slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Add
contributor: Bill Lorensen (GE)
acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
"""
input_spec = AddScalarVolumesInputSpec
output_spec = AddScalarVolumesOutputSpec
_cmd = "AddScalarVolumes "
_outputs_filenames = {"outputVolume": "outputVolume.nii"}
class CastScalarVolumeInputSpec(CommandLineInputSpec):
InputVolume = File(
position=-2, desc="Input volume, the volume to cast.", exists=True, argstr="%s"
)
OutputVolume = traits.Either(
traits.Bool,
File(),
position=-1,
hash_files=False,
desc="Output volume, cast to the new type.",
argstr="%s",
)
type = traits.Enum(
"Char",
"UnsignedChar",
"Short",
"UnsignedShort",
"Int",
"UnsignedInt",
"Float",
"Double",
desc="Type for the new output volume.",
argstr="--type %s",
)
class CastScalarVolumeOutputSpec(TraitedSpec):
OutputVolume = File(
position=-1, desc="Output volume, cast to the new type.", exists=True
)
class CastScalarVolume(SEMLikeCommandLine):
"""title: Cast Scalar Volume
category: Filtering.Arithmetic
description: Cast a volume to a given data type.
Use at your own risk when casting an input volume into a lower precision type!
Allows casting to the same type as the input volume.
version: 0.1.0.$Revision: 2104 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/Cast
contributor: Nicole Aucoin (SPL, BWH), Ron Kikinis (SPL, BWH)
acknowledgements: This work is part of the National Alliance for Medical Image Computing (NAMIC), funded by the National Institutes of Health through the NIH Roadmap for Medical Research, Grant U54 EB005149.
"""
input_spec = CastScalarVolumeInputSpec
output_spec = CastScalarVolumeOutputSpec
_cmd = "CastScalarVolume "
_outputs_filenames = {"OutputVolume": "OutputVolume.nii"}