8
8
LOGGER = logging .getLogger ('nipype.interface' )
9
9
10
10
11
- class ExtractB0InputSpec (BaseInterfaceInputSpec ):
11
+ class _ExtractB0InputSpec (BaseInterfaceInputSpec ):
12
12
in_file = File (exists = True , mandatory = True , desc = 'dwi file' )
13
13
b0_ixs = traits .List (traits .Int , mandatory = True ,
14
14
desc = 'Index of b0s' )
15
15
16
16
17
- class ExtractB0OutputSpec (TraitedSpec ):
17
+ class _ExtractB0OutputSpec (TraitedSpec ):
18
18
out_file = File (exists = True , desc = 'b0 file' )
19
19
20
20
@@ -32,7 +32,8 @@ class ExtractB0(SimpleInterface):
32
32
>>> res = extract_b0.run() # doctest: +SKIP
33
33
34
34
"""
35
- input_spec = ExtractB0InputSpec
35
+
36
+ input_spec = _ExtractB0InputSpec
36
37
output_spec = ExtractB0OutputSpec
37
38
38
39
def _run_interface (self , runtime ):
@@ -53,7 +54,7 @@ def extract_b0(in_file, b0_ixs, newpath=None):
53
54
in_file , suffix = '_b0' , newpath = newpath )
54
55
55
56
img = nib .load (in_file )
56
- data = img .get_fdata ()
57
+ data = img .get_fdata (dtype = 'float32' )
57
58
58
59
b0 = data [..., b0_ixs ]
59
60
@@ -65,7 +66,7 @@ def extract_b0(in_file, b0_ixs, newpath=None):
65
66
return out_file
66
67
67
68
68
- class RescaleB0InputSpec (BaseInterfaceInputSpec ):
69
+ class _RescaleB0InputSpec (BaseInterfaceInputSpec ):
69
70
in_file = File (exists = True , mandatory = True , desc = 'b0s file' )
70
71
mask_file = File (exists = True , mandatory = True , desc = 'mask file' )
71
72
@@ -112,10 +113,10 @@ def rescale_b0(in_file, mask_file, newpath=None):
112
113
in_file , suffix = '_median_b0' , newpath = newpath )
113
114
114
115
img = nib .load (in_file )
115
- data = img .get_fdata ()
116
+ data = img .get_fdata (dtype = 'float32' )
116
117
117
118
mask_img = nib .load (mask_file )
118
- mask_data = mask_img .get_fdata ()
119
+ mask_data = mask_img .get_fdata (dtype = 'float32' )
119
120
120
121
mean_b0_signals = data [mask_data > 0 , ...].mean (axis = 0 )
121
122
0 commit comments