Skip to content

Commit 09e196f

Browse files
josephmjeoesteban
andcommitted
Apply suggestions from code review
Co-Authored-By: Oscar Esteban <[email protected]>
1 parent c04c4d2 commit 09e196f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

dmriprep/interfaces/images.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
LOGGER = logging.getLogger('nipype.interface')
99

1010

11-
class ExtractB0InputSpec(BaseInterfaceInputSpec):
11+
class _ExtractB0InputSpec(BaseInterfaceInputSpec):
1212
in_file = File(exists=True, mandatory=True, desc='dwi file')
1313
b0_ixs = traits.List(traits.Int, mandatory=True,
1414
desc='Index of b0s')
1515

1616

17-
class ExtractB0OutputSpec(TraitedSpec):
17+
class _ExtractB0OutputSpec(TraitedSpec):
1818
out_file = File(exists=True, desc='b0 file')
1919

2020

@@ -32,7 +32,8 @@ class ExtractB0(SimpleInterface):
3232
>>> res = extract_b0.run() # doctest: +SKIP
3333
3434
"""
35-
input_spec = ExtractB0InputSpec
35+
36+
input_spec = _ExtractB0InputSpec
3637
output_spec = ExtractB0OutputSpec
3738

3839
def _run_interface(self, runtime):
@@ -53,7 +54,7 @@ def extract_b0(in_file, b0_ixs, newpath=None):
5354
in_file, suffix='_b0', newpath=newpath)
5455

5556
img = nib.load(in_file)
56-
data = img.get_fdata()
57+
data = img.get_fdata(dtype='float32')
5758

5859
b0 = data[..., b0_ixs]
5960

@@ -65,7 +66,7 @@ def extract_b0(in_file, b0_ixs, newpath=None):
6566
return out_file
6667

6768

68-
class RescaleB0InputSpec(BaseInterfaceInputSpec):
69+
class _RescaleB0InputSpec(BaseInterfaceInputSpec):
6970
in_file = File(exists=True, mandatory=True, desc='b0s file')
7071
mask_file = File(exists=True, mandatory=True, desc='mask file')
7172

@@ -112,10 +113,10 @@ def rescale_b0(in_file, mask_file, newpath=None):
112113
in_file, suffix='_median_b0', newpath=newpath)
113114

114115
img = nib.load(in_file)
115-
data = img.get_fdata()
116+
data = img.get_fdata(dtype='float32')
116117

117118
mask_img = nib.load(mask_file)
118-
mask_data = mask_img.get_fdata()
119+
mask_data = mask_img.get_fdata(dtype='float32')
119120

120121
mean_b0_signals = data[mask_data > 0, ...].mean(axis=0)
121122

0 commit comments

Comments
 (0)