I have a Dicom file and i would like to apply a number of masks with different operations in the voxels. However, I would like to keep the positions in the initial array because I want to reconstruct the image. This is what I have done:
#The dicom data
a=dicomm_data.pixel_array
#start function
my_modified_array = np.zeros_like(a)
#mask 1
m1=a[(a>limit_1) & (a<limit_2)]
m1=m1*chosen_number1 + chose_number2
my_modified_array [(a>limit_1) & (a<limit_2)] = m1
#mask 2
m2=a[(a>limit_2+1) & (a<limit_3)]
m2=m1*chosen_number3+chosen_number_4
my_modified_array [(a>limit_2+1) & (a<limit_3)] = m2
and I continue with more masks. However, I am receiving the mentioned in the title error. I have read another post which uses the numpy.where function but still cannot fix it.
a1? It suddenly appears in an expression without being mentioned before.