/
developer.py
1537 lines (1388 loc) · 52.6 KB
/
developer.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
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""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 JistLaminarVolumetricLayeringInputSpec(CommandLineInputSpec):
inInner = File(
desc="Inner Distance Image (GM/WM boundary)", exists=True, argstr="--inInner %s"
)
inOuter = File(
desc="Outer Distance Image (CSF/GM boundary)",
exists=True,
argstr="--inOuter %s",
)
inNumber = traits.Int(desc="Number of layers", argstr="--inNumber %d")
inMax = traits.Int(
desc="Max iterations for narrow band evolution", argstr="--inMax %d"
)
inMin = traits.Float(
desc="Min change ratio for narrow band evolution", argstr="--inMin %f"
)
inLayering = traits.Enum(
"distance-preserving",
"volume-preserving",
desc="Layering method",
argstr="--inLayering %s",
)
inLayering2 = traits.Enum(
"outward", "inward", desc="Layering direction", argstr="--inLayering2 %s"
)
incurvature = traits.Int(
desc="curvature approximation scale (voxels)", argstr="--incurvature %d"
)
inratio = traits.Float(
desc="ratio smoothing kernel size (voxels)", argstr="--inratio %f"
)
inpresmooth = traits.Enum(
"true", "false", desc="pre-smooth cortical surfaces", argstr="--inpresmooth %s"
)
inTopology = traits.Enum(
"26/6",
"6/26",
"18/6",
"6/18",
"6/6",
"wcs",
"wco",
"no",
desc="Topology",
argstr="--inTopology %s",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outContinuous = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Continuous depth measurement",
argstr="--outContinuous %s",
)
outDiscrete = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Discrete sampled layers",
argstr="--outDiscrete %s",
)
outLayer = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Layer boundary surfaces",
argstr="--outLayer %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistLaminarVolumetricLayeringOutputSpec(TraitedSpec):
outContinuous = File(desc="Continuous depth measurement", exists=True)
outDiscrete = File(desc="Discrete sampled layers", exists=True)
outLayer = File(desc="Layer boundary surfaces", exists=True)
class JistLaminarVolumetricLayering(SEMLikeCommandLine):
"""Volumetric Layering.
Builds a continuous layering of the cortex following distance-preserving or volume-preserving
models of cortical folding.
References
----------
Waehnert MD, Dinse J, Weiss M, Streicher MN, Waehnert P, Geyer S, Turner R, Bazin PL,
Anatomically motivated modeling of cortical laminae, Neuroimage, 2013.
"""
input_spec = JistLaminarVolumetricLayeringInputSpec
output_spec = JistLaminarVolumetricLayeringOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.laminar.JistLaminarVolumetricLayering "
_outputs_filenames = {
"outContinuous": "outContinuous.nii",
"outLayer": "outLayer.nii",
"outDiscrete": "outDiscrete.nii",
}
_redirect_x = True
class JistBrainMgdmSegmentationInputSpec(CommandLineInputSpec):
inMP2RAGE = File(desc="MP2RAGE T1 Map Image", exists=True, argstr="--inMP2RAGE %s")
inMP2RAGE2 = File(
desc="MP2RAGE T1-weighted Image", exists=True, argstr="--inMP2RAGE2 %s"
)
inPV = File(desc="PV / Dura Image", exists=True, argstr="--inPV %s")
inMPRAGE = File(
desc="MPRAGE T1-weighted Image", exists=True, argstr="--inMPRAGE %s"
)
inFLAIR = File(desc="FLAIR Image", exists=True, argstr="--inFLAIR %s")
inAtlas = File(desc="Atlas file", exists=True, argstr="--inAtlas %s")
inData = traits.Float(desc="Data weight", argstr="--inData %f")
inCurvature = traits.Float(desc="Curvature weight", argstr="--inCurvature %f")
inPosterior = traits.Float(desc="Posterior scale (mm)", argstr="--inPosterior %f")
inMax = traits.Int(desc="Max iterations", argstr="--inMax %d")
inMin = traits.Float(desc="Min change", argstr="--inMin %f")
inSteps = traits.Int(desc="Steps", argstr="--inSteps %d")
inTopology = traits.Enum(
"26/6",
"6/26",
"18/6",
"6/18",
"6/6",
"wcs",
"wco",
"no",
desc="Topology",
argstr="--inTopology %s",
)
inCompute = traits.Enum(
"true", "false", desc="Compute posteriors", argstr="--inCompute %s"
)
inAdjust = traits.Enum(
"true", "false", desc="Adjust intensity priors", argstr="--inAdjust %s"
)
inOutput = traits.Enum(
"segmentation", "memberships", desc="Output images", argstr="--inOutput %s"
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outSegmented = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Segmented Brain Image",
argstr="--outSegmented %s",
)
outLevelset = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Levelset Boundary Image",
argstr="--outLevelset %s",
)
outPosterior2 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Posterior Maximum Memberships (4D)",
argstr="--outPosterior2 %s",
)
outPosterior3 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Posterior Maximum Labels (4D)",
argstr="--outPosterior3 %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistBrainMgdmSegmentationOutputSpec(TraitedSpec):
outSegmented = File(desc="Segmented Brain Image", exists=True)
outLevelset = File(desc="Levelset Boundary Image", exists=True)
outPosterior2 = File(desc="Posterior Maximum Memberships (4D)", exists=True)
outPosterior3 = File(desc="Posterior Maximum Labels (4D)", exists=True)
class JistBrainMgdmSegmentation(SEMLikeCommandLine):
"""MGDM Whole Brain Segmentation.
Estimate brain structures from an atlas for a MRI dataset (multiple input combinations
are possible).
"""
input_spec = JistBrainMgdmSegmentationInputSpec
output_spec = JistBrainMgdmSegmentationOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.brain.JistBrainMgdmSegmentation "
_outputs_filenames = {
"outSegmented": "outSegmented.nii",
"outPosterior2": "outPosterior2.nii",
"outPosterior3": "outPosterior3.nii",
"outLevelset": "outLevelset.nii",
}
_redirect_x = True
class JistLaminarProfileGeometryInputSpec(CommandLineInputSpec):
inProfile = File(desc="Profile Surface Image", exists=True, argstr="--inProfile %s")
incomputed = traits.Enum(
"thickness",
"curvedness",
"shape_index",
"mean_curvature",
"gauss_curvature",
"profile_length",
"profile_curvature",
"profile_torsion",
desc="computed measure",
argstr="--incomputed %s",
)
inregularization = traits.Enum(
"none", "Gaussian", desc="regularization", argstr="--inregularization %s"
)
insmoothing = traits.Float(desc="smoothing parameter", argstr="--insmoothing %f")
inoutside = traits.Float(desc="outside extension (mm)", argstr="--inoutside %f")
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outResult = traits.Either(
traits.Bool, File(), hash_files=False, desc="Result", argstr="--outResult %s"
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistLaminarProfileGeometryOutputSpec(TraitedSpec):
outResult = File(desc="Result", exists=True)
class JistLaminarProfileGeometry(SEMLikeCommandLine):
"""Compute various geometric quantities for a cortical layers."""
input_spec = JistLaminarProfileGeometryInputSpec
output_spec = JistLaminarProfileGeometryOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.laminar.JistLaminarProfileGeometry "
_outputs_filenames = {"outResult": "outResult.nii"}
_redirect_x = True
class JistLaminarProfileCalculatorInputSpec(CommandLineInputSpec):
inIntensity = File(
desc="Intensity Profile Image", exists=True, argstr="--inIntensity %s"
)
inMask = File(desc="Mask Image (opt, 3D or 4D)", exists=True, argstr="--inMask %s")
incomputed = traits.Enum(
"mean",
"stdev",
"skewness",
"kurtosis",
desc="computed statistic",
argstr="--incomputed %s",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outResult = traits.Either(
traits.Bool, File(), hash_files=False, desc="Result", argstr="--outResult %s"
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistLaminarProfileCalculatorOutputSpec(TraitedSpec):
outResult = File(desc="Result", exists=True)
class JistLaminarProfileCalculator(SEMLikeCommandLine):
"""Compute various moments for intensities mapped along a cortical profile."""
input_spec = JistLaminarProfileCalculatorInputSpec
output_spec = JistLaminarProfileCalculatorOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.laminar.JistLaminarProfileCalculator "
_outputs_filenames = {"outResult": "outResult.nii"}
_redirect_x = True
class MedicAlgorithmN3InputSpec(CommandLineInputSpec):
inInput = File(desc="Input Volume", exists=True, argstr="--inInput %s")
inSignal = traits.Float(
desc="Default = min + 1, Values at less than threshold are treated as part of the background",
argstr="--inSignal %f",
)
inMaximum = traits.Int(desc="Maximum number of Iterations", argstr="--inMaximum %d")
inEnd = traits.Float(
desc="Usually 0.01-0.00001, The measure used to terminate the iterations is the coefficient of variation of change in field estimates between successive iterations.",
argstr="--inEnd %f",
)
inField = traits.Float(
desc="Characteristic distance over which the field varies. The distance between adjacent knots in bspline fitting with at least 4 knots going in every dimension. The default in the dialog is one third the distance (resolution * extents) of the smallest dimension.",
argstr="--inField %f",
)
inSubsample = traits.Float(
desc="Usually between 1-32, The factor by which the data is subsampled to a lower resolution in estimating the slowly varying non-uniformity field. Reduce sampling in the finest sampling direction by the shrink factor.",
argstr="--inSubsample %f",
)
inKernel = traits.Float(
desc="Usually between 0.05-0.50, Width of deconvolution kernel used to sharpen the histogram. Larger values give faster convergence while smaller values give greater accuracy.",
argstr="--inKernel %f",
)
inWeiner = traits.Float(desc="Usually between 0.0-1.0", argstr="--inWeiner %f")
inAutomatic = traits.Enum(
"true",
"false",
desc="If true determines the threshold by histogram analysis. If true a VOI cannot be used and the input threshold is ignored.",
argstr="--inAutomatic %s",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outInhomogeneity = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Inhomogeneity Corrected Volume",
argstr="--outInhomogeneity %s",
)
outInhomogeneity2 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Inhomogeneity Field",
argstr="--outInhomogeneity2 %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class MedicAlgorithmN3OutputSpec(TraitedSpec):
outInhomogeneity = File(desc="Inhomogeneity Corrected Volume", exists=True)
outInhomogeneity2 = File(desc="Inhomogeneity Field", exists=True)
class MedicAlgorithmN3(SEMLikeCommandLine):
"""Non-parametric Intensity Non-uniformity Correction, N3, originally by J.G. Sled."""
input_spec = MedicAlgorithmN3InputSpec
output_spec = MedicAlgorithmN3OutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmN3 "
_outputs_filenames = {
"outInhomogeneity2": "outInhomogeneity2.nii",
"outInhomogeneity": "outInhomogeneity.nii",
}
_redirect_x = True
class JistLaminarROIAveragingInputSpec(CommandLineInputSpec):
inIntensity = File(
desc="Intensity Profile Image", exists=True, argstr="--inIntensity %s"
)
inROI = File(desc="ROI Mask", exists=True, argstr="--inROI %s")
inROI2 = traits.Str(desc="ROI Name", argstr="--inROI2 %s")
inMask = File(desc="Mask Image (opt, 3D or 4D)", exists=True, argstr="--inMask %s")
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outROI3 = traits.Either(
traits.Bool, File(), hash_files=False, desc="ROI Average", argstr="--outROI3 %s"
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistLaminarROIAveragingOutputSpec(TraitedSpec):
outROI3 = File(desc="ROI Average", exists=True)
class JistLaminarROIAveraging(SEMLikeCommandLine):
"""Compute an average profile over a given ROI."""
input_spec = JistLaminarROIAveragingInputSpec
output_spec = JistLaminarROIAveragingOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.laminar.JistLaminarROIAveraging "
_outputs_filenames = {"outROI3": "outROI3"}
_redirect_x = True
class MedicAlgorithmLesionToadsInputSpec(CommandLineInputSpec):
inT1_MPRAGE = File(desc="T1_MPRAGE Image", exists=True, argstr="--inT1_MPRAGE %s")
inT1_SPGR = File(desc="T1_SPGR Image", exists=True, argstr="--inT1_SPGR %s")
inFLAIR = File(desc="FLAIR Image", exists=True, argstr="--inFLAIR %s")
inAtlas = traits.Enum(
"With Lesion", "No Lesion", desc="Atlas to Use", argstr="--inAtlas %s"
)
inOutput = traits.Enum(
"hard segmentation",
"hard segmentation+memberships",
"cruise inputs",
"dura removal inputs",
desc="Output images",
argstr="--inOutput %s",
)
inOutput2 = traits.Enum(
"true",
"false",
desc="Output the hard classification using maximum membership (not neceesarily topologically correct)",
argstr="--inOutput2 %s",
)
inCorrect = traits.Enum(
"true", "false", desc="Correct MR field inhomogeneity.", argstr="--inCorrect %s"
)
inOutput3 = traits.Enum(
"true",
"false",
desc="Output the estimated inhomogeneity field",
argstr="--inOutput3 %s",
)
inAtlas2 = File(
desc="Atlas File - With Lesions", exists=True, argstr="--inAtlas2 %s"
)
inAtlas3 = File(
desc="Atlas File - No Lesion - T1 and FLAIR",
exists=True,
argstr="--inAtlas3 %s",
)
inAtlas4 = File(
desc="Atlas File - No Lesion - T1 Only", exists=True, argstr="--inAtlas4 %s"
)
inMaximum = traits.Int(
desc="Maximum distance from the interventricular WM boundary to downweight the lesion membership to avoid false positives",
argstr="--inMaximum %d",
)
inMaximum2 = traits.Int(desc="Maximum Ventircle Distance", argstr="--inMaximum2 %d")
inMaximum3 = traits.Int(
desc="Maximum InterVentricular Distance", argstr="--inMaximum3 %d"
)
inInclude = traits.Enum(
"true",
"false",
desc="Include lesion in WM class in hard classification",
argstr="--inInclude %s",
)
inAtlas5 = traits.Float(
desc="Controls the effect of the statistical atlas on the segmentation",
argstr="--inAtlas5 %f",
)
inSmooting = traits.Float(
desc="Controls the effect of neighborhood voxels on the membership",
argstr="--inSmooting %f",
)
inMaximum4 = traits.Float(
desc="Maximum amount of relative change in the energy function considered as the convergence criteria",
argstr="--inMaximum4 %f",
)
inMaximum5 = traits.Int(desc="Maximum iterations", argstr="--inMaximum5 %d")
inAtlas6 = traits.Enum(
"rigid", "multi_fully_affine", desc="Atlas alignment", argstr="--inAtlas6 %s"
)
inConnectivity = traits.Enum(
"(26,6)",
"(6,26)",
"(6,18)",
"(18,6)",
desc="Connectivity (foreground,background)",
argstr="--inConnectivity %s",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outHard = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Hard segmentation",
argstr="--outHard %s",
)
outHard2 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Hard segmentationfrom memberships",
argstr="--outHard2 %s",
)
outInhomogeneity = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Inhomogeneity Field",
argstr="--outInhomogeneity %s",
)
outMembership = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Membership Functions",
argstr="--outMembership %s",
)
outLesion = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Lesion Segmentation",
argstr="--outLesion %s",
)
outSulcal = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Sulcal CSF Membership",
argstr="--outSulcal %s",
)
outCortical = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Cortical GM Membership",
argstr="--outCortical %s",
)
outFilled = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Filled WM Membership",
argstr="--outFilled %s",
)
outWM = traits.Either(
traits.Bool, File(), hash_files=False, desc="WM Mask", argstr="--outWM %s"
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class MedicAlgorithmLesionToadsOutputSpec(TraitedSpec):
outHard = File(desc="Hard segmentation", exists=True)
outHard2 = File(desc="Hard segmentationfrom memberships", exists=True)
outInhomogeneity = File(desc="Inhomogeneity Field", exists=True)
outMembership = File(desc="Membership Functions", exists=True)
outLesion = File(desc="Lesion Segmentation", exists=True)
outSulcal = File(desc="Sulcal CSF Membership", exists=True)
outCortical = File(desc="Cortical GM Membership", exists=True)
outFilled = File(desc="Filled WM Membership", exists=True)
outWM = File(desc="WM Mask", exists=True)
class MedicAlgorithmLesionToads(SEMLikeCommandLine):
"""Algorithm for simultaneous 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.
References
----------
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.
"""
input_spec = MedicAlgorithmLesionToadsInputSpec
output_spec = MedicAlgorithmLesionToadsOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.classification.MedicAlgorithmLesionToads "
_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",
}
_redirect_x = True
class JistBrainMp2rageSkullStrippingInputSpec(CommandLineInputSpec):
inSecond = File(
desc="Second inversion (Inv2) Image", exists=True, argstr="--inSecond %s"
)
inT1 = File(desc="T1 Map (T1_Images) Image (opt)", exists=True, argstr="--inT1 %s")
inT1weighted = File(
desc="T1-weighted (UNI) Image (opt)", exists=True, argstr="--inT1weighted %s"
)
inFilter = File(desc="Filter Image (opt)", exists=True, argstr="--inFilter %s")
inSkip = traits.Enum("true", "false", desc="Skip zero values", argstr="--inSkip %s")
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outBrain = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Brain Mask Image",
argstr="--outBrain %s",
)
outMasked = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Masked T1 Map Image",
argstr="--outMasked %s",
)
outMasked2 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Masked T1-weighted Image",
argstr="--outMasked2 %s",
)
outMasked3 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Masked Filter Image",
argstr="--outMasked3 %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistBrainMp2rageSkullStrippingOutputSpec(TraitedSpec):
outBrain = File(desc="Brain Mask Image", exists=True)
outMasked = File(desc="Masked T1 Map Image", exists=True)
outMasked2 = File(desc="Masked T1-weighted Image", exists=True)
outMasked3 = File(desc="Masked Filter Image", exists=True)
class JistBrainMp2rageSkullStripping(SEMLikeCommandLine):
"""Estimate a brain mask for a MP2RAGE dataset.
At least a T1-weighted or a T1 map image is required.
"""
input_spec = JistBrainMp2rageSkullStrippingInputSpec
output_spec = JistBrainMp2rageSkullStrippingOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.brain.JistBrainMp2rageSkullStripping "
_outputs_filenames = {
"outBrain": "outBrain.nii",
"outMasked3": "outMasked3.nii",
"outMasked2": "outMasked2.nii",
"outMasked": "outMasked.nii",
}
_redirect_x = True
class JistCortexSurfaceMeshInflationInputSpec(CommandLineInputSpec):
inLevelset = File(desc="Levelset Image", exists=True, argstr="--inLevelset %s")
inSOR = traits.Float(desc="SOR Parameter", argstr="--inSOR %f")
inMean = traits.Float(desc="Mean Curvature Threshold", argstr="--inMean %f")
inStep = traits.Int(desc="Step Size", argstr="--inStep %d")
inMax = traits.Int(desc="Max Iterations", argstr="--inMax %d")
inLorentzian = traits.Enum(
"true", "false", desc="Lorentzian Norm", argstr="--inLorentzian %s"
)
inTopology = traits.Enum(
"26/6",
"6/26",
"18/6",
"6/18",
"6/6",
"wcs",
"wco",
"no",
desc="Topology",
argstr="--inTopology %s",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outOriginal = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Original Surface",
argstr="--outOriginal %s",
)
outInflated = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Inflated Surface",
argstr="--outInflated %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistCortexSurfaceMeshInflationOutputSpec(TraitedSpec):
outOriginal = File(desc="Original Surface", exists=True)
outInflated = File(desc="Inflated Surface", exists=True)
class JistCortexSurfaceMeshInflation(SEMLikeCommandLine):
"""Inflates a cortical surface mesh.
References
----------
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.
"""
input_spec = JistCortexSurfaceMeshInflationInputSpec
output_spec = JistCortexSurfaceMeshInflationOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.cortex.JistCortexSurfaceMeshInflation "
_outputs_filenames = {"outOriginal": "outOriginal", "outInflated": "outInflated"}
_redirect_x = True
class RandomVolInputSpec(CommandLineInputSpec):
inSize = traits.Int(desc="Size of Volume in X direction", argstr="--inSize %d")
inSize2 = traits.Int(desc="Size of Volume in Y direction", argstr="--inSize2 %d")
inSize3 = traits.Int(desc="Size of Volume in Z direction", argstr="--inSize3 %d")
inSize4 = traits.Int(desc="Size of Volume in t direction", argstr="--inSize4 %d")
inStandard = traits.Int(
desc="Standard Deviation for Normal Distribution", argstr="--inStandard %d"
)
inLambda = traits.Float(
desc="Lambda Value for Exponential Distribution", argstr="--inLambda %f"
)
inMaximum = traits.Int(desc="Maximum Value", argstr="--inMaximum %d")
inMinimum = traits.Int(desc="Minimum Value", argstr="--inMinimum %d")
inField = traits.Enum(
"Uniform", "Normal", "Exponential", desc="Field", argstr="--inField %s"
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outRand1 = traits.Either(
traits.Bool, File(), hash_files=False, desc="Rand1", argstr="--outRand1 %s"
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class RandomVolOutputSpec(TraitedSpec):
outRand1 = File(desc="Rand1", exists=True)
class RandomVol(SEMLikeCommandLine):
"""Generate a volume of random scalars."""
input_spec = RandomVolInputSpec
output_spec = RandomVolOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.bme.smile.demo.RandomVol "
_outputs_filenames = {"outRand1": "outRand1.nii"}
_redirect_x = True
class MedicAlgorithmImageCalculatorInputSpec(CommandLineInputSpec):
inVolume = File(desc="Volume 1", exists=True, argstr="--inVolume %s")
inVolume2 = File(desc="Volume 2", exists=True, argstr="--inVolume2 %s")
inOperation = traits.Enum(
"Add",
"Subtract",
"Multiply",
"Divide",
"Min",
"Max",
desc="Operation",
argstr="--inOperation %s",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outResult = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Result Volume",
argstr="--outResult %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class MedicAlgorithmImageCalculatorOutputSpec(TraitedSpec):
outResult = File(desc="Result Volume", exists=True)
class MedicAlgorithmImageCalculator(SEMLikeCommandLine):
"""Perform simple image calculator operations on two images.
The operations include 'Add', 'Subtract', 'Multiply', and 'Divide'
"""
input_spec = MedicAlgorithmImageCalculatorInputSpec
output_spec = MedicAlgorithmImageCalculatorOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run edu.jhu.ece.iacl.plugins.utilities.math.MedicAlgorithmImageCalculator "
_outputs_filenames = {"outResult": "outResult.nii"}
_redirect_x = True
class JistBrainMp2rageDuraEstimationInputSpec(CommandLineInputSpec):
inSecond = File(
desc="Second inversion (Inv2) Image", exists=True, argstr="--inSecond %s"
)
inSkull = File(desc="Skull Stripping Mask", exists=True, argstr="--inSkull %s")
inDistance = traits.Float(
desc="Distance to background (mm)", argstr="--inDistance %f"
)
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",
)
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outDura = traits.Either(
traits.Bool, File(), hash_files=False, desc="Dura Image", argstr="--outDura %s"
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistBrainMp2rageDuraEstimationOutputSpec(TraitedSpec):
outDura = File(desc="Dura Image", exists=True)
class JistBrainMp2rageDuraEstimation(SEMLikeCommandLine):
"""Filters a MP2RAGE brain image to obtain a probability map of dura matter."""
input_spec = JistBrainMp2rageDuraEstimationInputSpec
output_spec = JistBrainMp2rageDuraEstimationOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.brain.JistBrainMp2rageDuraEstimation "
_outputs_filenames = {"outDura": "outDura.nii"}
_redirect_x = True
class JistLaminarProfileSamplingInputSpec(CommandLineInputSpec):
inProfile = File(desc="Profile Surface Image", exists=True, argstr="--inProfile %s")
inIntensity = File(desc="Intensity Image", exists=True, argstr="--inIntensity %s")
inCortex = File(desc="Cortex Mask (opt)", exists=True, argstr="--inCortex %s")
xPrefExt = traits.Enum("nrrd", desc="Output File Type", argstr="--xPrefExt %s")
outProfilemapped = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Profile-mapped Intensity Image",
argstr="--outProfilemapped %s",
)
outProfile2 = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Profile 4D Mask",
argstr="--outProfile2 %s",
)
null = traits.Str(desc="Execution Time", argstr="--null %s")
xDefaultMem = traits.Int(
desc="Set default maximum heap size", argstr="-xDefaultMem %d"
)
xMaxProcess = traits.Int(
1,
desc="Set default maximum number of processes.",
argstr="-xMaxProcess %d",
usedefault=True,
)
class JistLaminarProfileSamplingOutputSpec(TraitedSpec):
outProfilemapped = File(desc="Profile-mapped Intensity Image", exists=True)
outProfile2 = File(desc="Profile 4D Mask", exists=True)
class JistLaminarProfileSampling(SEMLikeCommandLine):
"""Sample some intensity image along a cortical profile across layer surfaces."""
input_spec = JistLaminarProfileSamplingInputSpec
output_spec = JistLaminarProfileSamplingOutputSpec
_cmd = "java edu.jhu.ece.iacl.jist.cli.run de.mpg.cbs.jist.laminar.JistLaminarProfileSampling "
_outputs_filenames = {
"outProfile2": "outProfile2.nii",
"outProfilemapped": "outProfilemapped.nii",
}
_redirect_x = True
class MedicAlgorithmMipavReorientInputSpec(CommandLineInputSpec):
inSource = InputMultiPath(File, desc="Source", sep=";", argstr="--inSource %s")
inTemplate = File(desc="Template", exists=True, argstr="--inTemplate %s")
inNew = traits.Enum(
"Dicom axial",
"Dicom coronal",
"Dicom sagittal",
"User defined",
desc="New image orientation",
argstr="--inNew %s",
)
inUser = traits.Enum(
"Unknown",
"Patient Right to Left",
"Patient Left to Right",
"Patient Posterior to Anterior",
"Patient Anterior to Posterior",
"Patient Inferior to Superior",
"Patient Superior to Inferior",
desc="User defined X-axis orientation (image left to right)",
argstr="--inUser %s",
)
inUser2 = traits.Enum(
"Unknown",
"Patient Right to Left",
"Patient Left to Right",
"Patient Posterior to Anterior",