1
1
2
-
2
+
3
3
4
4
__all__ = ['resample_image' ,
5
5
'resample_image_to_target' ]
11
11
12
12
def resample_image (image , resample_params , use_voxels = False , interp_type = 1 ):
13
13
"""
14
- Resample image by spacing or number of voxels with
14
+ Resample image by spacing or number of voxels with
15
15
various interpolators. Works with multi-channel images.
16
16
17
17
ANTsR function: `resampleImage`
@@ -20,14 +20,14 @@ def resample_image(image, resample_params, use_voxels=False, interp_type=1):
20
20
---------
21
21
image : ANTsImage
22
22
input image
23
-
23
+
24
24
resample_params : tuple/list
25
25
vector of size dimension with numeric values
26
-
26
+
27
27
use_voxels : boolean
28
28
True means interpret resample params as voxel counts
29
-
30
- interp_type : integer
29
+
30
+ interp_type : integer
31
31
one of 0 (linear), 1 (nearest neighbor), 2 (gaussian), 3 (windowed sinc), 4 (bspline)
32
32
33
33
Returns
@@ -58,20 +58,20 @@ def resample_image(image, resample_params, use_voxels=False, interp_type=1):
58
58
59
59
def resample_image_to_target (image , target , interp_type = 'linear' , imagetype = 0 , verbose = False , ** kwargs ):
60
60
"""
61
- Resample image by using another image as target reference.
62
- This function uses ants.apply_transform with an identity matrix
61
+ Resample image by using another image as target reference.
62
+ This function uses ants.apply_transform with an identity matrix
63
63
to achieve proper resampling.
64
-
64
+
65
65
ANTsR function: `resampleImageToTarget`
66
66
67
67
Arguments
68
68
---------
69
69
image : ANTsImage
70
70
image to resample
71
-
71
+
72
72
target : ANTsImage
73
73
image of reference, the output will be in this space
74
-
74
+
75
75
interp_type : string
76
76
Choice of interpolator. Supports partial matching.
77
77
linear
@@ -84,16 +84,16 @@ def resample_image_to_target(image, target, interp_type='linear', imagetype=0, v
84
84
hammingWindowedSinc
85
85
lanczosWindowedSinc
86
86
genericLabel use this for label images
87
-
88
- imagetype : integer
87
+
88
+ imagetype : integer
89
89
choose 0/1/2/3 mapping to scalar/vector/tensor/time-series
90
-
90
+
91
91
verbose : boolean
92
92
print command and run verbose application of transform.
93
-
93
+
94
94
kwargs : keyword arguments
95
95
additional arugment passed to antsApplyTransforms C code
96
-
96
+
97
97
Returns
98
98
-------
99
99
ANTsImage
@@ -145,15 +145,6 @@ def resample_image_to_target(image, target, interp_type='linear', imagetype=0, v
145
145
146
146
myargs = utils ._int_antsProcessArguments (args )
147
147
148
- # NO CLUE WHAT THIS DOES OR WHY IT'S NEEDED
149
- for jj in range (len (myargs )):
150
- if myargs [jj ] is not None :
151
- if myargs [jj ] == '-' :
152
- myargs2 = [None ]* (len (myargs )- 1 )
153
- myargs2 [:(jj - 1 )] = myargs [:(jj - 1 )]
154
- myargs2 [jj :(len (myargs )- 1 )] = myargs [(jj + 1 ):(len (myargs ))]
155
- myargs = myargs2
156
-
157
148
myverb = int (verbose )
158
149
159
150
processed_args = myargs + ['-z' , str (1 ), '-v' , str (myverb ), '--float' , str (1 ), '-e' , str (imagetype )]
0 commit comments