@@ -112,13 +112,13 @@ def _eucl_cog(self, nii1, nii2):
112112 from scipy .ndimage .measurements import center_of_mass , label
113113
114114 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 )
117117 cog_t = np .vstack ((cog_t , np .array ([1 ])))
118118 cog_t_coor = np .dot (nii1 .affine , cog_t )[:3 , :]
119119
120120 origdata2 = np .asanyarray (nii2 .dataobj )
121- origdata2 = (origdata2 != 0 ) & ~ np .isnan (origdata2 )
121+ origdata2 = (np . rint ( origdata2 ) != 0 ) & ~ np .isnan (origdata2 )
122122 (labeled_data , n_labels ) = label (origdata2 )
123123
124124 cogs = np .ones ((4 , n_labels ))
@@ -165,13 +165,13 @@ def _eucl_max(self, nii1, nii2):
165165 from scipy .spatial .distance import cdist
166166
167167 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 )
169169 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 )
171171
172172 if isdefined (self .inputs .mask_volume ):
173173 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 )
175175 origdata1 = np .logical_and (maskdata , origdata1 )
176176 origdata2 = np .logical_and (maskdata , origdata2 )
177177
0 commit comments