/
ukftractography.py
181 lines (165 loc) · 7.5 KB
/
ukftractography.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
# -*- 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 UKFTractographyInputSpec(CommandLineInputSpec):
dwiFile = File(desc="Input DWI volume", exists=True, argstr="--dwiFile %s")
seedsFile = File(
desc="Seeds for diffusion. If not specified, full brain tractography will be performed, and the algorithm will start from every voxel in the brain mask where the Generalized Anisotropy is bigger than 0.18",
exists=True,
argstr="--seedsFile %s",
)
labels = InputMultiPath(
traits.Int,
desc="A vector of the ROI labels to be used",
sep=",",
argstr="--labels %s",
)
maskFile = File(
desc="Mask for diffusion tractography", exists=True, argstr="--maskFile %s"
)
tracts = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Tracts generated, with first tensor output",
argstr="--tracts %s",
)
writeAsciiTracts = traits.Bool(
desc="Write tract file as a VTK binary data file", argstr="--writeAsciiTracts "
)
writeUncompressedTracts = traits.Bool(
desc="Write tract file as a VTK uncompressed data file",
argstr="--writeUncompressedTracts ",
)
seedsPerVoxel = traits.Int(
desc=" Each seed generates a fiber, thus using more seeds generates more fibers. In general use 1 or 2 seeds, and for a more thorough result use 5 or 10 (depending on your machine this may take up to 2 days to run)., ",
argstr="--seedsPerVoxel %d",
)
numTensor = traits.Enum(
"1", "2", desc="Number of tensors used", argstr="--numTensor %s"
)
freeWater = traits.Bool(
desc="Adds a term for free water difusion to the model. (Note for experts: if checked, the 1T simple model is forced) ",
argstr="--freeWater ",
)
recordFA = traits.Bool(
desc="Whether to store FA. Attaches field 'FA', and 'FA2' for 2-tensor case to fiber. ",
argstr="--recordFA ",
)
recordFreeWater = traits.Bool(
desc="Whether to store the fraction of free water. Attaches field 'FreeWater' to fiber.",
argstr="--recordFreeWater ",
)
recordTrace = traits.Bool(
desc="Whether to store Trace. Attaches field 'Trace', and 'Trace2' for 2-tensor case to fiber.",
argstr="--recordTrace ",
)
recordTensors = traits.Bool(
desc="Recording the tensors enables Slicer to color the fiber bundles by FA, orientation, and so on. The fields will be called 'TensorN', where N is the tensor number. ",
argstr="--recordTensors ",
)
recordNMSE = traits.Bool(
desc="Whether to store NMSE. Attaches field 'NMSE' to fiber. ",
argstr="--recordNMSE ",
)
recordState = traits.Bool(
desc="Whether to attach the states to the fiber. Will generate field 'state'.",
argstr="--recordState ",
)
recordCovariance = traits.Bool(
desc="Whether to store the covariance. Will generate field 'covariance' in fiber.",
argstr="--recordCovariance ",
)
recordLength = traits.Float(
desc="Record length of tractography, in millimeters", argstr="--recordLength %f"
)
minFA = traits.Float(
desc="Abort the tractography when the Fractional Anisotropy is less than this value",
argstr="--minFA %f",
)
minGA = traits.Float(
desc="Abort the tractography when the Generalized Anisotropy is less than this value",
argstr="--minGA %f",
)
fullTensorModel = traits.Bool(
desc="Whether to use the full tensor model. If unchecked, use the default simple tensor model",
argstr="--fullTensorModel ",
)
numThreads = traits.Int(
desc="Number of threads used during computation. Set to the number of cores on your workstation for optimal speed. If left undefined the number of cores detected will be used. ",
argstr="--numThreads %d",
)
stepLength = traits.Float(
desc="Step length of tractography, in millimeters", argstr="--stepLength %f"
)
maxHalfFiberLength = traits.Float(
desc="The max length limit of the half fibers generated during tractography. Here the fiber is 'half' because the tractography goes in only one direction from one seed point at a time",
argstr="--maxHalfFiberLength %f",
)
seedFALimit = traits.Float(
desc="Seed points whose FA are below this value are excluded",
argstr="--seedFALimit %f",
)
Qm = traits.Float(desc="Process noise for angles/direction", argstr="--Qm %f")
Ql = traits.Float(desc="Process noise for eigenvalues", argstr="--Ql %f")
Qw = traits.Float(
desc="Process noise for free water weights, ignored if no free water estimation",
argstr="--Qw %f",
)
Rs = traits.Float(desc="Measurement noise", argstr="--Rs %f")
maxBranchingAngle = traits.Float(
desc="Maximum branching angle, in degrees. When using multiple tensors, a new branch will be created when the tensors' major directions form an angle between (minBranchingAngle, maxBranchingAngle). Branching is supressed when this maxBranchingAngle is set to 0.0",
argstr="--maxBranchingAngle %f",
)
minBranchingAngle = traits.Float(
desc="Minimum branching angle, in degrees. When using multiple tensors, a new branch will be created when the tensors' major directions form an angle between (minBranchingAngle, maxBranchingAngle)",
argstr="--minBranchingAngle %f",
)
tractsWithSecondTensor = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Tracts generated, with second tensor output (if there is one)",
argstr="--tractsWithSecondTensor %s",
)
storeGlyphs = traits.Bool(
desc="Store tensors' main directions as two-point lines in a separate file named glyphs_{tracts}. When using multiple tensors, only the major tensors' main directions are stored",
argstr="--storeGlyphs ",
)
class UKFTractographyOutputSpec(TraitedSpec):
tracts = File(desc="Tracts generated, with first tensor output", exists=True)
tractsWithSecondTensor = File(
desc="Tracts generated, with second tensor output (if there is one)",
exists=True,
)
class UKFTractography(SEMLikeCommandLine):
"""title: UKF Tractography
category: Diffusion.Tractography
description: This module traces fibers in a DWI Volume using the multiple tensor unscented Kalman Filter methology. For more informations check the documentation.
version: 1.0
documentation-url: http://www.nitrc.org/plugins/mwiki/index.php/ukftractography:MainPage
contributor: Yogesh Rathi, Stefan Lienhard, Yinpeng Li, Martin Styner, Ipek Oguz, Yundi Shi, Christian Baumgartner, Kent Williams, Hans Johnson, Peter Savadjiev, Carl-Fredrik Westin.
acknowledgements: The development of this module was supported by NIH grants R01 MH097979 (PI Rathi), R01 MH092862 (PIs Westin and Verma), U01 NS083223 (PI Westin), R01 MH074794 (PI Westin) and P41 EB015902 (PI Kikinis).
"""
input_spec = UKFTractographyInputSpec
output_spec = UKFTractographyOutputSpec
_cmd = " UKFTractography "
_outputs_filenames = {
"tracts": "tracts.vtp",
"tractsWithSecondTensor": "tractsWithSecondTensor.vtp",
}
_redirect_x = False