@@ -112,13 +112,13 @@ def _eucl_cog(self, nii1, nii2):
112
112
from scipy .ndimage .measurements import center_of_mass , label
113
113
114
114
origdata1 = np .asanyarray (nii1 .dataobj )
115
- origdata1 = (origdata1 != 0 ) & ~ np .isnan (origdata1 )
116
- cog_t = np .array (center_of_mass (origdata1 . copy () )).reshape (- 1 , 1 )
115
+ origdata1 = (np . rint ( origdata1 ) != 0 ) & ~ np .isnan (origdata1 )
116
+ cog_t = np .array (center_of_mass (origdata1 )).reshape (- 1 , 1 )
117
117
cog_t = np .vstack ((cog_t , np .array ([1 ])))
118
118
cog_t_coor = np .dot (nii1 .affine , cog_t )[:3 , :]
119
119
120
120
origdata2 = np .asanyarray (nii2 .dataobj )
121
- origdata2 = (origdata2 != 0 ) & ~ np .isnan (origdata2 )
121
+ origdata2 = (np . rint ( origdata2 ) != 0 ) & ~ np .isnan (origdata2 )
122
122
(labeled_data , n_labels ) = label (origdata2 )
123
123
124
124
cogs = np .ones ((4 , n_labels ))
@@ -165,13 +165,13 @@ def _eucl_max(self, nii1, nii2):
165
165
from scipy .spatial .distance import cdist
166
166
167
167
origdata1 = np .asanyarray (nii1 .dataobj )
168
- origdata1 = np . logical_not (np .logical_or (origdata1 == 0 , np .isnan (origdata1 )) )
168
+ origdata1 = (np .rint (origdata1 ) != 0 ) & ~ np .isnan (origdata1 )
169
169
origdata2 = np .asanyarray (nii2 .dataobj )
170
- origdata2 = np . logical_not (np .logical_or (origdata2 == 0 , np .isnan (origdata2 )) )
170
+ origdata2 = (np .rint (origdata2 ) != 0 ) & ~ np .isnan (origdata2 )
171
171
172
172
if isdefined (self .inputs .mask_volume ):
173
173
maskdata = np .asanyarray (nb .load (self .inputs .mask_volume ).dataobj )
174
- maskdata = np . logical_not (np .logical_or (maskdata == 0 , np .isnan (maskdata )) )
174
+ maskdata = (np .rint (maskdata ) != 0 ) & ~ np .isnan (maskdata )
175
175
origdata1 = np .logical_and (maskdata , origdata1 )
176
176
origdata2 = np .logical_and (maskdata , origdata2 )
177
177
0 commit comments