/
utilities.py
212 lines (174 loc) · 6.37 KB
/
utilities.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
# -*- 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."""
import os
from ...base import (
CommandLine,
CommandLineInputSpec,
SEMLikeCommandLine,
TraitedSpec,
File,
Directory,
traits,
isdefined,
InputMultiPath,
OutputMultiPath,
)
class HistogramMatchingFilterInputSpec(CommandLineInputSpec):
inputVolume = File(
desc="The Input image to be computed for statistics",
exists=True,
argstr="--inputVolume %s",
)
referenceVolume = File(
desc="The Input image to be computed for statistics",
exists=True,
argstr="--referenceVolume %s",
)
outputVolume = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Output Image File Name",
argstr="--outputVolume %s",
)
referenceBinaryVolume = File(
desc="referenceBinaryVolume", exists=True, argstr="--referenceBinaryVolume %s"
)
inputBinaryVolume = File(
desc="inputBinaryVolume", exists=True, argstr="--inputBinaryVolume %s"
)
numberOfMatchPoints = traits.Int(
desc=" number of histogram matching points", argstr="--numberOfMatchPoints %d"
)
numberOfHistogramBins = traits.Int(
desc=" number of histogram bin", argstr="--numberOfHistogramBins %d"
)
writeHistogram = traits.Str(
desc=" decide if histogram data would be written with prefixe of the file name",
argstr="--writeHistogram %s",
)
histogramAlgorithm = traits.Enum(
"OtsuHistogramMatching",
desc=" histogram algrithm selection",
argstr="--histogramAlgorithm %s",
)
verbose = traits.Bool(
desc=" verbose mode running for debbuging", argstr="--verbose "
)
class HistogramMatchingFilterOutputSpec(TraitedSpec):
outputVolume = File(desc="Output Image File Name", exists=True)
class HistogramMatchingFilter(SEMLikeCommandLine):
"""title: Write Out Image Intensities
category: BRAINS.Utilities
description: For Analysis
version: 0.1
contributor: University of Iowa Department of Psychiatry, http:://www.psychiatry.uiowa.edu
"""
input_spec = HistogramMatchingFilterInputSpec
output_spec = HistogramMatchingFilterOutputSpec
_cmd = " HistogramMatchingFilter "
_outputs_filenames = {"outputVolume": "outputVolume.nii"}
_redirect_x = False
class GenerateEdgeMapImageInputSpec(CommandLineInputSpec):
inputMRVolumes = InputMultiPath(
File(exists=True),
desc="List of input structural MR volumes to create the maximum edgemap",
argstr="--inputMRVolumes %s...",
)
inputMask = File(
desc="Input mask file name. If set, image histogram percentiles will be calculated within the mask",
exists=True,
argstr="--inputMask %s",
)
minimumOutputRange = traits.Int(
desc="Map lower quantile and below to minimum output range. It should be a small number greater than zero. Default is 1",
argstr="--minimumOutputRange %d",
)
maximumOutputRange = traits.Int(
desc="Map upper quantile and above to maximum output range. Default is 255 that is the maximum range of unsigned char",
argstr="--maximumOutputRange %d",
)
lowerPercentileMatching = traits.Float(
desc="Map lower quantile and below to minOutputRange. It should be a value between zero and one",
argstr="--lowerPercentileMatching %f",
)
upperPercentileMatching = traits.Float(
desc="Map upper quantile and above to maxOutputRange. It should be a value between zero and one",
argstr="--upperPercentileMatching %f",
)
outputEdgeMap = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="output edgemap file name",
argstr="--outputEdgeMap %s",
)
outputMaximumGradientImage = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="output gradient image file name",
argstr="--outputMaximumGradientImage %s",
)
numberOfThreads = traits.Int(
desc="Explicitly specify the maximum number of threads to use.",
argstr="--numberOfThreads %d",
)
class GenerateEdgeMapImageOutputSpec(TraitedSpec):
outputEdgeMap = File(desc="(required) output file name", exists=True)
outputMaximumGradientImage = File(
desc="output gradient image file name", exists=True
)
class GenerateEdgeMapImage(SEMLikeCommandLine):
"""title: GenerateEdgeMapImage
category: BRAINS.Utilities
description: Automatic edgemap generation for edge-guided super-resolution reconstruction
version: 1.0
contributor: Ali Ghayoor
"""
input_spec = GenerateEdgeMapImageInputSpec
output_spec = GenerateEdgeMapImageOutputSpec
_cmd = " GenerateEdgeMapImage "
_outputs_filenames = {
"outputEdgeMap": "outputEdgeMap",
"outputMaximumGradientImage": "outputMaximumGradientImage",
}
_redirect_x = False
class GeneratePurePlugMaskInputSpec(CommandLineInputSpec):
inputImageModalities = InputMultiPath(
File(exists=True),
desc="List of input image file names to create pure plugs mask",
argstr="--inputImageModalities %s...",
)
threshold = traits.Float(
desc="threshold value to define class membership", argstr="--threshold %f"
)
numberOfSubSamples = InputMultiPath(
traits.Int,
desc="Number of continous index samples taken at each direction of lattice space for each plug volume",
sep=",",
argstr="--numberOfSubSamples %s",
)
outputMaskFile = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Output binary mask file name",
argstr="--outputMaskFile %s",
)
class GeneratePurePlugMaskOutputSpec(TraitedSpec):
outputMaskFile = File(desc="(required) Output binary mask file name", exists=True)
class GeneratePurePlugMask(SEMLikeCommandLine):
"""title: GeneratePurePlugMask
category: BRAINS.Utilities
description: This program gets several modality image files and returns a binary mask that defines the pure plugs
version: 1.0
contributor: Ali Ghayoor
"""
input_spec = GeneratePurePlugMaskInputSpec
output_spec = GeneratePurePlugMaskOutputSpec
_cmd = " GeneratePurePlugMask "
_outputs_filenames = {"outputMaskFile": "outputMaskFile"}
_redirect_x = False