// Number of parcels:
par_max = np.ceil(np.max(bna_data_for_coords)).astype("int")
else:
bna_data = bna_img.get_data()
par_max = np.max(bna_data)
img_stack = []
////Set indices
for idx in range(1, par_max+1):
After Change
bna_img = nib.load(parlistfile)
bna_data = np.round(bna_img.get_data(),1)
////Get an array of unique parcels
bna_data_for_coords_uniq = np.unique(bna_data)
////Number of parcels:
par_max = len(bna_data_for_coords_uniq) - 1
bna_data = bna_data.astype("int16")
img_stack = []
for idx in range(1, par_max+1):
roi_img = bna_data == bna_data_for_coords_uniq[idx].astype("int16")