-
Notifications
You must be signed in to change notification settings - Fork 521
/
fiberprocess.py
119 lines (104 loc) · 6.1 KB
/
fiberprocess.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
# -*- 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 fiberprocessInputSpec(CommandLineInputSpec):
fiber_file = File(desc="DTI fiber file", exists=True, argstr="--fiber_file %s")
fiber_output = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Output fiber file. May be warped or updated with new data depending on other options used.",
argstr="--fiber_output %s",
)
tensor_volume = File(
desc="Interpolate tensor values from the given field",
exists=True,
argstr="--tensor_volume %s",
)
h_field = File(
desc="HField for warp and statistics lookup. If this option is used tensor-volume must also be specified.",
exists=True,
argstr="--h_field %s",
)
displacement_field = File(
desc="Displacement Field for warp and statistics lookup. If this option is used tensor-volume must also be specified.",
exists=True,
argstr="--displacement_field %s",
)
saveProperties = traits.Bool(
desc="save the tensor property as scalar data into the vtk (only works for vtk fiber files). ",
argstr="--saveProperties ",
)
no_warp = traits.Bool(
desc="Do not warp the geometry of the tensors only obtain the new statistics.",
argstr="--no_warp ",
)
fiber_radius = traits.Float(
desc="set radius of all fibers to this value", argstr="--fiber_radius %f"
)
index_space = traits.Bool(
desc="Use index-space for fiber output coordinates, otherwise us world space for fiber output coordinates (from tensor file).",
argstr="--index_space ",
)
voxelize = traits.Either(
traits.Bool,
File(),
hash_files=False,
desc="Voxelize fiber into a label map (the labelmap filename is the argument of -V). The tensor file must be specified using -T for information about the size, origin, spacing of the image. The deformation is applied before the voxelization ",
argstr="--voxelize %s",
)
voxelize_count_fibers = traits.Bool(
desc="Count number of fibers per-voxel instead of just setting to 1",
argstr="--voxelize_count_fibers ",
)
voxel_label = traits.Int(
desc="Label for voxelized fiber", argstr="--voxel_label %d"
)
verbose = traits.Bool(desc="produce verbose output", argstr="--verbose ")
noDataChange = traits.Bool(desc="Do not change data ??? ", argstr="--noDataChange ")
class fiberprocessOutputSpec(TraitedSpec):
fiber_output = File(
desc="Output fiber file. May be warped or updated with new data depending on other options used.",
exists=True,
)
voxelize = File(
desc="Voxelize fiber into a label map (the labelmap filename is the argument of -V). The tensor file must be specified using -T for information about the size, origin, spacing of the image. The deformation is applied before the voxelization ",
exists=True,
)
class fiberprocess(SEMLikeCommandLine):
"""title: FiberProcess (DTIProcess)
category: Diffusion.Tractography
description: fiberprocess is a tool that manage fiber files extracted from the fibertrack tool or any fiber tracking algorithm. It takes as an input .fib and .vtk files (--fiber_file) and saves the changed fibers (--fiber_output) into the 2 same formats. The main purpose of this tool is to deform the fiber file with a transformation field as an input (--displacement_field or --h_field depending if you deal with dfield or hfield). To use that option you need to specify the tensor field from which the fiber file was extracted with the option --tensor_volume. The transformation applied on the fiber file is the inverse of the one input. If the transformation is from one case to an atlas, fiberprocess assumes that the fiber file is in the atlas space and you want it in the original case space, so it's the inverse of the transformation which has been computed.
You have 2 options for fiber modification. You can either deform the fibers (their geometry) into the space OR you can keep the same geometry but map the diffusion properties (fa, md, lbd's...) of the original tensor field along the fibers at the corresponding locations. This is triggered by the --no_warp option. To use the previous example: when you have a tensor field in the original space and the deformed tensor field in the atlas space, you want to track the fibers in the atlas space, keeping this geometry but with the original case diffusion properties. Then you can specify the transformations field (from original case -> atlas) and the original tensor field with the --tensor_volume option.
With fiberprocess you can also binarize a fiber file. Using the --voxelize option will create an image where each voxel through which a fiber is passing is set to 1. The output is going to be a binary image with the values 0 or 1 by default but the 1 value voxel can be set to any number with the --voxel_label option. Finally you can create an image where the value at the voxel is the number of fiber passing through. (--voxelize_count_fibers)
version: 1.0.0
documentation-url: http://www.slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/DTIProcess
license: Copyright (c) Casey Goodlett. All rights reserved.
See http://www.ia.unc.edu/dev/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
contributor: Casey Goodlett
"""
input_spec = fiberprocessInputSpec
output_spec = fiberprocessOutputSpec
_cmd = " fiberprocess "
_outputs_filenames = {
"fiber_output": "fiber_output.vtk",
"voxelize": "voxelize.nii",
}
_redirect_x = False