/
registration.py
687 lines (592 loc) · 29.9 KB
/
registration.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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
# -*- 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 BSplineDeformableRegistrationInputSpec(CommandLineInputSpec):
iterations = traits.Int(desc="Number of iterations", argstr="--iterations %d")
gridSize = traits.Int(
desc="Number of grid points on interior of the fixed image. Larger grid sizes allow for finer registrations.",
argstr="--gridSize %d",
)
histogrambins = traits.Int(
desc="Number of histogram bins to use for Mattes Mutual Information. Reduce the number of bins if a deformable registration fails. If the number of bins is too large, the estimated PDFs will be a field of impulses and will inhibit reliable registration estimation.",
argstr="--histogrambins %d",
)
spatialsamples = traits.Int(
desc="Number of spatial samples to use in estimating Mattes Mutual Information. Larger values yield more accurate PDFs and improved registration quality.",
argstr="--spatialsamples %d",
)
constrain = traits.Bool(
desc="Constrain the deformation to the amount specified in Maximum Deformation",
argstr="--constrain ",
)
maximumDeformation = traits.Float(
desc="If Constrain Deformation is checked, limit the deformation to this amount.",
argstr="--maximumDeformation %f",
)
default = traits.Int(
desc="Default pixel value used if resampling a pixel outside of the volume.",
argstr="--default %d",
)
initialtransform = File(
desc="Initial transform for aligning the fixed and moving image. Maps positions in the fixed coordinate frame to positions in the moving coordinate frame. This transform should be an affine or rigid transform. It is used an a bulk transform for the BSpline. Optional.",
exists=True,
argstr="--initialtransform %s",
)
FixedImageFileName = File(
position=-2, desc="Fixed image to which to register", exists=True, argstr="%s"
)
MovingImageFileName = File(
position=-1, desc="Moving image", exists=True, argstr="%s"
)
outputtransform = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Transform calculated that aligns the fixed and moving image. Maps positions from the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--outputtransform %s",
)
outputwarp = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Vector field that applies an equivalent warp as the BSpline. Maps positions from the fixed coordinate frame to the moving coordinate frame. Optional.",
argstr="--outputwarp %s",
)
resampledmovingfilename = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Resampled moving image to fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--resampledmovingfilename %s",
)
class BSplineDeformableRegistrationOutputSpec(TraitedSpec):
outputtransform = File(
desc="Transform calculated that aligns the fixed and moving image. Maps positions from the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
outputwarp = File(
desc="Vector field that applies an equivalent warp as the BSpline. Maps positions from the fixed coordinate frame to the moving coordinate frame. Optional.",
exists=True,
)
resampledmovingfilename = File(
desc="Resampled moving image to fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
class BSplineDeformableRegistration(SEMLikeCommandLine):
"""title: BSpline Deformable Registration
category: Legacy.Registration
description: Registers two images together using BSpline transform and mutual information.
version: 0.1.0.$Revision: 19608 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/BSplineDeformableRegistration
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 = BSplineDeformableRegistrationInputSpec
output_spec = BSplineDeformableRegistrationOutputSpec
_cmd = "BSplineDeformableRegistration "
_outputs_filenames = {
"resampledmovingfilename": "resampledmovingfilename.nii",
"outputtransform": "outputtransform.txt",
"outputwarp": "outputwarp.nrrd",
}
class AffineRegistrationInputSpec(CommandLineInputSpec):
fixedsmoothingfactor = traits.Int(
desc="Amount of smoothing applied to fixed image prior to registration. Default is 0 (none). Range is 0-5 (unitless). Consider smoothing the input data if there is considerable amounts of noise or the noise pattern in the fixed and moving images is very different.",
argstr="--fixedsmoothingfactor %d",
)
movingsmoothingfactor = traits.Int(
desc="Amount of smoothing applied to moving image prior to registration. Default is 0 (none). Range is 0-5 (unitless). Consider smoothing the input data if there is considerable amounts of noise or the noise pattern in the fixed and moving images is very different.",
argstr="--movingsmoothingfactor %d",
)
histogrambins = traits.Int(
desc="Number of histogram bins to use for Mattes Mutual Information. Reduce the number of bins if a registration fails. If the number of bins is too large, the estimated PDFs will be a field of impulses and will inhibit reliable registration estimation.",
argstr="--histogrambins %d",
)
spatialsamples = traits.Int(
desc="Number of spatial samples to use in estimating Mattes Mutual Information. Larger values yield more accurate PDFs and improved registration quality.",
argstr="--spatialsamples %d",
)
iterations = traits.Int(desc="Number of iterations", argstr="--iterations %d")
translationscale = traits.Float(
desc="Relative scale of translations to rotations, i.e. a value of 100 means 10mm = 1 degree. (Actual scale used is 1/(TranslationScale^2)). This parameter is used to 'weight' or 'standardized' the transform parameters and their effect on the registration objective function.",
argstr="--translationscale %f",
)
initialtransform = File(
desc="Initial transform for aligning the fixed and moving image. Maps positions in the fixed coordinate frame to positions in the moving coordinate frame. Optional.",
exists=True,
argstr="--initialtransform %s",
)
FixedImageFileName = File(
position=-2, desc="Fixed image to which to register", exists=True, argstr="%s"
)
MovingImageFileName = File(
position=-1, desc="Moving image", exists=True, argstr="%s"
)
outputtransform = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Transform calculated that aligns the fixed and moving image. Maps positions in the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--outputtransform %s",
)
resampledmovingfilename = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Resampled moving image to the fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--resampledmovingfilename %s",
)
class AffineRegistrationOutputSpec(TraitedSpec):
outputtransform = File(
desc="Transform calculated that aligns the fixed and moving image. Maps positions in the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
resampledmovingfilename = File(
desc="Resampled moving image to the fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
class AffineRegistration(SEMLikeCommandLine):
"""title: Affine Registration
category: Legacy.Registration
description: Registers two images together using an affine transform and mutual information. This module is often used to align images of different subjects or images of the same subject from different modalities.
This module can smooth images prior to registration to mitigate noise and improve convergence. Many of the registration parameters require a working knowledge of the algorithm although the default parameters are sufficient for many registration tasks.
version: 0.1.0.$Revision: 19608 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/AffineRegistration
contributor: Daniel Blezek (GE)
acknowledgements: This module was developed by Daniel Blezek while at GE Research with contributions from Jim Miller.
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 = AffineRegistrationInputSpec
output_spec = AffineRegistrationOutputSpec
_cmd = "AffineRegistration "
_outputs_filenames = {
"resampledmovingfilename": "resampledmovingfilename.nii",
"outputtransform": "outputtransform.txt",
}
class MultiResolutionAffineRegistrationInputSpec(CommandLineInputSpec):
fixedImage = File(
position=-2,
desc="Image which defines the space into which the moving image is registered",
exists=True,
argstr="%s",
)
movingImage = File(
position=-1,
desc="The transform goes from the fixed image's space into the moving image's space",
exists=True,
argstr="%s",
)
resampledImage = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Registration results",
argstr="--resampledImage %s",
)
saveTransform = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Save the output transform from the registration",
argstr="--saveTransform %s",
)
fixedImageMask = File(
desc="Label image which defines a mask of interest for the fixed image",
exists=True,
argstr="--fixedImageMask %s",
)
fixedImageROI = traits.List(
desc="Label image which defines a ROI of interest for the fixed image",
argstr="--fixedImageROI %s",
)
numIterations = traits.Int(
desc="Number of iterations to run at each resolution level.",
argstr="--numIterations %d",
)
numLineIterations = traits.Int(
desc="Number of iterations to run at each resolution level.",
argstr="--numLineIterations %d",
)
stepSize = traits.Float(
desc="The maximum step size of the optimizer in voxels", argstr="--stepSize %f"
)
stepTolerance = traits.Float(
desc="The maximum step size of the optimizer in voxels",
argstr="--stepTolerance %f",
)
metricTolerance = traits.Float(argstr="--metricTolerance %f")
class MultiResolutionAffineRegistrationOutputSpec(TraitedSpec):
resampledImage = File(desc="Registration results", exists=True)
saveTransform = File(
desc="Save the output transform from the registration", exists=True
)
class MultiResolutionAffineRegistration(SEMLikeCommandLine):
"""title: Robust Multiresolution Affine Registration
category: Legacy.Registration
description: Provides affine registration using multiple resolution levels and decomposed affine transforms.
version: 0.1.0.$Revision: 2104 $(alpha)
documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/MultiResolutionAffineRegistration
contributor: Casey B Goodlett (Utah)
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 = MultiResolutionAffineRegistrationInputSpec
output_spec = MultiResolutionAffineRegistrationOutputSpec
_cmd = "MultiResolutionAffineRegistration "
_outputs_filenames = {
"resampledImage": "resampledImage.nii",
"saveTransform": "saveTransform.txt",
}
class RigidRegistrationInputSpec(CommandLineInputSpec):
fixedsmoothingfactor = traits.Int(
desc="Amount of smoothing applied to fixed image prior to registration. Default is 0 (none). Range is 0-5 (unitless). Consider smoothing the input data if there is considerable amounts of noise or the noise pattern in the fixed and moving images is very different.",
argstr="--fixedsmoothingfactor %d",
)
movingsmoothingfactor = traits.Int(
desc="Amount of smoothing applied to moving image prior to registration. Default is 0 (none). Range is 0-5 (unitless). Consider smoothing the input data if there is considerable amounts of noise or the noise pattern in the fixed and moving images is very different.",
argstr="--movingsmoothingfactor %d",
)
testingmode = traits.Bool(
desc="Enable testing mode. Input transform will be used to construct floating image. The floating image will be ignored if passed.",
argstr="--testingmode ",
)
histogrambins = traits.Int(
desc="Number of histogram bins to use for Mattes Mutual Information. Reduce the number of bins if a registration fails. If the number of bins is too large, the estimated PDFs will be a field of impulses and will inhibit reliable registration estimation.",
argstr="--histogrambins %d",
)
spatialsamples = traits.Int(
desc="Number of spatial samples to use in estimating Mattes Mutual Information. Larger values yield more accurate PDFs and improved registration quality.",
argstr="--spatialsamples %d",
)
iterations = InputMultiPath(
traits.Int,
desc="Comma separated list of iterations. Must have the same number of elements as the learning rate.",
sep=",",
argstr="--iterations %s",
)
learningrate = InputMultiPath(
traits.Float,
desc="Comma separated list of learning rates. Learning rate is a scale factor on the gradient of the registration objective function (gradient with respect to the parameters of the transformation) used to update the parameters of the transformation during optimization. Smaller values cause the optimizer to take smaller steps through the parameter space. Larger values are typically used early in the registration process to take large jumps in parameter space followed by smaller values to home in on the optimum value of the registration objective function. Default is: 0.01, 0.005, 0.0005, 0.0002. Must have the same number of elements as iterations.",
sep=",",
argstr="--learningrate %s",
)
translationscale = traits.Float(
desc="Relative scale of translations to rotations, i.e. a value of 100 means 10mm = 1 degree. (Actual scale used 1/(TranslationScale^2)). This parameter is used to 'weight' or 'standardized' the transform parameters and their effect on the registration objective function.",
argstr="--translationscale %f",
)
initialtransform = File(
desc="Initial transform for aligning the fixed and moving image. Maps positions in the fixed coordinate frame to positions in the moving coordinate frame. Optional.",
exists=True,
argstr="--initialtransform %s",
)
FixedImageFileName = File(
position=-2, desc="Fixed image to which to register", exists=True, argstr="%s"
)
MovingImageFileName = File(
position=-1, desc="Moving image", exists=True, argstr="%s"
)
outputtransform = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Transform calculated that aligns the fixed and moving image. Maps positions in the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--outputtransform %s",
)
resampledmovingfilename = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Resampled moving image to the fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--resampledmovingfilename %s",
)
class RigidRegistrationOutputSpec(TraitedSpec):
outputtransform = File(
desc="Transform calculated that aligns the fixed and moving image. Maps positions in the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
resampledmovingfilename = File(
desc="Resampled moving image to the fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
class RigidRegistration(SEMLikeCommandLine):
"""title: Rigid Registration
category: Legacy.Registration
description: Registers two images together using a rigid transform and mutual information.
This module was originally distributed as "Linear registration" but has been renamed to eliminate confusion with the "Affine registration" module.
This module is often used to align images of different subjects or images of the same subject from different modalities.
This module can smooth images prior to registration to mitigate noise and improve convergence. Many of the registration parameters require a working knowledge of the algorithm although the default parameters are sufficient for many registration tasks.
version: 0.1.0.$Revision: 19608 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/RigidRegistration
contributor: Daniel Blezek (GE)
acknowledgements: This module was developed by Daniel Blezek while at GE Research with contributions from Jim Miller.
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 = RigidRegistrationInputSpec
output_spec = RigidRegistrationOutputSpec
_cmd = "RigidRegistration "
_outputs_filenames = {
"resampledmovingfilename": "resampledmovingfilename.nii",
"outputtransform": "outputtransform.txt",
}
class LinearRegistrationInputSpec(CommandLineInputSpec):
fixedsmoothingfactor = traits.Int(
desc="Amount of smoothing applied to fixed image prior to registration. Default is 0 (none). Range is 0-5 (unitless). Consider smoothing the input data if there is considerable amounts of noise or the noise pattern in the fixed and moving images is very different.",
argstr="--fixedsmoothingfactor %d",
)
movingsmoothingfactor = traits.Int(
desc="Amount of smoothing applied to moving image prior to registration. Default is 0 (none). Range is 0-5 (unitless). Consider smoothing the input data if there is considerable amounts of noise or the noise pattern in the fixed and moving images is very different.",
argstr="--movingsmoothingfactor %d",
)
histogrambins = traits.Int(
desc="Number of histogram bins to use for Mattes Mutual Information. Reduce the number of bins if a registration fails. If the number of bins is too large, the estimated PDFs will be a field of impulses and will inhibit reliable registration estimation.",
argstr="--histogrambins %d",
)
spatialsamples = traits.Int(
desc="Number of spatial samples to use in estimating Mattes Mutual Information. Larger values yield more accurate PDFs and improved registration quality.",
argstr="--spatialsamples %d",
)
iterations = InputMultiPath(
traits.Int,
desc="Comma separated list of iterations. Must have the same number of elements as the learning rate.",
sep=",",
argstr="--iterations %s",
)
learningrate = InputMultiPath(
traits.Float,
desc="Comma separated list of learning rates. Learning rate is a scale factor on the gradient of the registration objective function (gradient with respect to the parameters of the transformation) used to update the parameters of the transformation during optimization. Smaller values cause the optimizer to take smaller steps through the parameter space. Larger values are typically used early in the registration process to take large jumps in parameter space followed by smaller values to home in on the optimum value of the registration objective function. Default is: 0.01, 0.005, 0.0005, 0.0002. Must have the same number of elements as iterations.",
sep=",",
argstr="--learningrate %s",
)
translationscale = traits.Float(
desc="Relative scale of translations to rotations, i.e. a value of 100 means 10mm = 1 degree. (Actual scale used 1/(TranslationScale^2)). This parameter is used to 'weight' or 'standardized' the transform parameters and their effect on the registration objective function.",
argstr="--translationscale %f",
)
initialtransform = File(
desc="Initial transform for aligning the fixed and moving image. Maps positions in the fixed coordinate frame to positions in the moving coordinate frame. Optional.",
exists=True,
argstr="--initialtransform %s",
)
FixedImageFileName = File(
position=-2, desc="Fixed image to which to register", exists=True, argstr="%s"
)
MovingImageFileName = File(
position=-1, desc="Moving image", exists=True, argstr="%s"
)
outputtransform = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Transform calculated that aligns the fixed and moving image. Maps positions in the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--outputtransform %s",
)
resampledmovingfilename = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Resampled moving image to the fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
argstr="--resampledmovingfilename %s",
)
class LinearRegistrationOutputSpec(TraitedSpec):
outputtransform = File(
desc="Transform calculated that aligns the fixed and moving image. Maps positions in the fixed coordinate frame to the moving coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
resampledmovingfilename = File(
desc="Resampled moving image to the fixed image coordinate frame. Optional (specify an output transform or an output volume or both).",
exists=True,
)
class LinearRegistration(SEMLikeCommandLine):
"""title: Linear Registration
category: Legacy.Registration
description: Registers two images together using a rigid transform and mutual information.
version: 0.1.0.$Revision: 19608 $(alpha)
documentation-url: http://wiki.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/LinearRegistration
contributor: Daniel Blezek (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 = LinearRegistrationInputSpec
output_spec = LinearRegistrationOutputSpec
_cmd = "LinearRegistration "
_outputs_filenames = {
"resampledmovingfilename": "resampledmovingfilename.nii",
"outputtransform": "outputtransform.txt",
}
class ExpertAutomatedRegistrationInputSpec(CommandLineInputSpec):
fixedImage = File(
position=-2,
desc="Image which defines the space into which the moving image is registered",
exists=True,
argstr="%s",
)
movingImage = File(
position=-1,
desc="The transform goes from the fixed image's space into the moving image's space",
exists=True,
argstr="%s",
)
resampledImage = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Registration results",
argstr="--resampledImage %s",
)
loadTransform = File(
desc="Load a transform that is immediately applied to the moving image",
exists=True,
argstr="--loadTransform %s",
)
saveTransform = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Save the transform that results from registration",
argstr="--saveTransform %s",
)
initialization = traits.Enum(
"None",
"Landmarks",
"ImageCenters",
"CentersOfMass",
"SecondMoments",
desc="Method to prime the registration process",
argstr="--initialization %s",
)
registration = traits.Enum(
"None",
"Initial",
"Rigid",
"Affine",
"BSpline",
"PipelineRigid",
"PipelineAffine",
"PipelineBSpline",
desc="Method for the registration process",
argstr="--registration %s",
)
metric = traits.Enum(
"MattesMI",
"NormCorr",
"MeanSqrd",
desc="Method to quantify image match",
argstr="--metric %s",
)
expectedOffset = traits.Float(
desc="Expected misalignment after initialization", argstr="--expectedOffset %f"
)
expectedRotation = traits.Float(
desc="Expected misalignment after initialization",
argstr="--expectedRotation %f",
)
expectedScale = traits.Float(
desc="Expected misalignment after initialization", argstr="--expectedScale %f"
)
expectedSkew = traits.Float(
desc="Expected misalignment after initialization", argstr="--expectedSkew %f"
)
verbosityLevel = traits.Enum(
"Silent",
"Standard",
"Verbose",
desc="Level of detail of reporting progress",
argstr="--verbosityLevel %s",
)
sampleFromOverlap = traits.Bool(
desc="Limit metric evaluation to the fixed image region overlapped by the moving image",
argstr="--sampleFromOverlap ",
)
fixedImageMask = File(
desc="Image which defines a mask for the fixed image",
exists=True,
argstr="--fixedImageMask %s",
)
randomNumberSeed = traits.Int(
desc="Seed to generate a consistent random number sequence",
argstr="--randomNumberSeed %d",
)
numberOfThreads = traits.Int(
desc="Number of CPU threads to use", argstr="--numberOfThreads %d"
)
minimizeMemory = traits.Bool(
desc="Reduce the amount of memory required at the cost of increased computation time",
argstr="--minimizeMemory ",
)
interpolation = traits.Enum(
"NearestNeighbor",
"Linear",
"BSpline",
desc="Method for interpolation within the optimization process",
argstr="--interpolation %s",
)
fixedLandmarks = InputMultiPath(
traits.List(traits.Float(), minlen=3, maxlen=3),
desc="Ordered list of landmarks in the fixed image",
argstr="--fixedLandmarks %s...",
)
movingLandmarks = InputMultiPath(
traits.List(traits.Float(), minlen=3, maxlen=3),
desc="Ordered list of landmarks in the moving image",
argstr="--movingLandmarks %s...",
)
rigidMaxIterations = traits.Int(
desc="Maximum number of rigid optimization iterations",
argstr="--rigidMaxIterations %d",
)
rigidSamplingRatio = traits.Float(
desc="Portion of the image to use in computing the metric during rigid registration",
argstr="--rigidSamplingRatio %f",
)
affineMaxIterations = traits.Int(
desc="Maximum number of affine optimization iterations",
argstr="--affineMaxIterations %d",
)
affineSamplingRatio = traits.Float(
desc="Portion of the image to use in computing the metric during affine registration",
argstr="--affineSamplingRatio %f",
)
bsplineMaxIterations = traits.Int(
desc="Maximum number of bspline optimization iterations",
argstr="--bsplineMaxIterations %d",
)
bsplineSamplingRatio = traits.Float(
desc="Portion of the image to use in computing the metric during BSpline registration",
argstr="--bsplineSamplingRatio %f",
)
controlPointSpacing = traits.Int(
desc="Number of pixels between control points",
argstr="--controlPointSpacing %d",
)
class ExpertAutomatedRegistrationOutputSpec(TraitedSpec):
resampledImage = File(desc="Registration results", exists=True)
saveTransform = File(
desc="Save the transform that results from registration", exists=True
)
class ExpertAutomatedRegistration(SEMLikeCommandLine):
"""title: Expert Automated Registration
category: Legacy.Registration
description: Provides rigid, affine, and BSpline registration methods via a simple GUI
version: 0.1.0.$Revision: 2104 $(alpha)
documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/4.1/Modules/ExpertAutomatedRegistration
contributor: Stephen R Aylward (Kitware), Casey B Goodlett (Kitware)
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 = ExpertAutomatedRegistrationInputSpec
output_spec = ExpertAutomatedRegistrationOutputSpec
_cmd = "ExpertAutomatedRegistration "
_outputs_filenames = {
"resampledImage": "resampledImage.nii",
"saveTransform": "saveTransform.txt",
}