mask_img_list = []
mask_voxels_dict = dict()
for i, mask_img in enumerate(list(iter_img(self._conn_comps))):
mask_voxels_dict[i] = np.int(np.sum(mask_img.get_data()))
mask_img_list.append(mask_img)
// Allocate k across connected components using Hagenbach-Bischoff Quota based on number of voxels
After Change
mask_img_list = []
mask_voxels_dict = dict()
for i, mask_img in enumerate(list(iter_img(self._conn_comps))):
mask_voxels_dict[i] = np.int(np.sum(np.asarray(mask_img.dataobj)))
mask_img_list.append(mask_img)
// Allocate k across connected components using Hagenbach-Bischoff Quota based on number of voxels