Skip to content

Commit 32db8f2

Browse files
committed
RF: Finish purging get_data() from algorithms
1 parent dc50f92 commit 32db8f2

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

nipype/algorithms/icc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ class ICC(BaseInterface):
4141
output_spec = ICCOutputSpec
4242

4343
def _run_interface(self, runtime):
44-
maskdata = nb.load(self.inputs.mask).get_data()
44+
maskdata = nb.load(self.inputs.mask).get_fdata()
4545
maskdata = np.logical_not(np.logical_or(maskdata == 0, np.isnan(maskdata)))
4646

4747
session_datas = [
4848
[
49-
nb.load(fname, mmap=NUMPY_MMAP).get_data()[maskdata].reshape(-1, 1)
49+
nb.load(fname, mmap=NUMPY_MMAP).get_fdata()[maskdata].reshape(-1, 1)
5050
for fname in sessions
5151
]
5252
for sessions in self.inputs.subjects_sessions
@@ -66,17 +66,17 @@ def _run_interface(self, runtime):
6666

6767
nim = nb.load(self.inputs.subjects_sessions[0][0])
6868
new_data = np.zeros(nim.shape)
69-
new_data[maskdata] = icc.reshape(-1,)
69+
new_data[maskdata] = icc.reshape(-1)
7070
new_img = nb.Nifti1Image(new_data, nim.affine, nim.header)
7171
nb.save(new_img, "icc_map.nii")
7272

7373
new_data = np.zeros(nim.shape)
74-
new_data[maskdata] = session_var.reshape(-1,)
74+
new_data[maskdata] = session_var.reshape(-1)
7575
new_img = nb.Nifti1Image(new_data, nim.affine, nim.header)
7676
nb.save(new_img, "session_var_map.nii")
7777

7878
new_data = np.zeros(nim.shape)
79-
new_data[maskdata] = subject_var.reshape(-1,)
79+
new_data[maskdata] = subject_var.reshape(-1)
8080
new_img = nb.Nifti1Image(new_data, nim.affine, nim.header)
8181
nb.save(new_img, "subject_var_map.nii")
8282

nipype/algorithms/mesh.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,8 @@ def _run_interface(self, runtime):
113113

114114
warps = []
115115
for axis in warp_dims:
116-
wdata = axis.get_data()
116+
wdata = axis.dataobj # four_to_three ensures this is an array
117117
if np.any(wdata != 0):
118-
119118
warp = ndimage.map_coordinates(wdata, voxpoints.transpose())
120119
else:
121120
warp = np.zeros((points.shape[0],))

nipype/algorithms/rapidart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
496496
# compute global intensity signal
497497
(x, y, z, timepoints) = nim.shape
498498

499-
data = nim.get_data()
499+
data = nim.get_fdata(dtype=np.float32)
500500
affine = nim.affine
501501
g = np.zeros((timepoints, 1))
502502
masktype = self.inputs.mask_type
@@ -526,7 +526,7 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
526526
g[t0] = np.nansum(vol * mask_tmp) / np.nansum(mask_tmp)
527527
elif masktype == "file": # uses a mask image to determine intensity
528528
maskimg = load(self.inputs.mask_file, mmap=NUMPY_MMAP)
529-
mask = maskimg.get_data()
529+
mask = maskimg.get_fdata()
530530
affine = maskimg.affine
531531
mask = mask > 0.5
532532
for t0 in range(timepoints):

nipype/algorithms/stats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ActivationCount(SimpleInterface):
5050
output_spec = ActivationCountOutputSpec
5151

5252
def _run_interface(self, runtime):
53-
allmaps = nb.concat_images(self.inputs.in_files).get_data()
53+
allmaps = nb.concat_images(self.inputs.in_files).dataobj
5454
acm_pos = np.mean(allmaps > self.inputs.threshold, axis=3, dtype=np.float32)
5555
acm_neg = np.mean(
5656
allmaps < -1.0 * self.inputs.threshold, axis=3, dtype=np.float32

0 commit comments

Comments
 (0)