Skip to content

Commit 7fd0b80

Browse files
committed
RF: Purge get_data() from interfaces.nilearn
1 parent 530143e commit 7fd0b80

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

nipype/interfaces/nilearn.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ def _process_inputs(self):
124124
maskers = []
125125

126126
# determine form of label files, choose appropriate nilearn masker
127-
if np.amax(label_data.get_data()) > 1: # 3d label file
128-
n_labels = np.amax(label_data.get_data())
127+
if np.amax(label_data.dataobj) > 1: # 3d label file
128+
n_labels = np.amax(label_data.dataobj)
129129
maskers.append(nl.NiftiLabelsMasker(label_data))
130130
else: # 4d labels
131-
n_labels = label_data.get_data().shape[3]
131+
n_labels = label_data.shape[3]
132132
if self.inputs.incl_shared_variance: # independent computation
133133
for img in nli.iter_img(label_data):
134134
maskers.append(
135-
nl.NiftiMapsMasker(self._4d(img.get_data(), img.affine))
135+
nl.NiftiMapsMasker(self._4d(img.dataobj, img.affine))
136136
)
137137
else: # one computation fitting all
138138
maskers.append(nl.NiftiMapsMasker(label_data))
@@ -155,9 +155,7 @@ def _process_inputs(self):
155155
)
156156

157157
if self.inputs.include_global:
158-
global_label_data = label_data.get_data().sum(
159-
axis=3
160-
) # sum across all regions
158+
global_label_data = label_data.dataobj.sum(axis=3) # sum across all regions
161159
global_label_data = (
162160
np.rint(global_label_data).astype(int).clip(0, 1)
163161
) # binarize

0 commit comments

Comments
 (0)