Uniformity calculation

Hello

I want to calculate the uniformity of my 10x10 cm2 6 MV 100 um field with iview image.

I use this fonction : uniformity = (1 - (np.mean(arr_img_max) - np.mean(arr_img_min)) / (np.mean(arr_img_max) + np.mean(arr_img_min))) * 100
print(f’Uniformity:{uniformity}')

My image has 1024x1024 pixel, but my filed was 10x10 ( in black region)

How can I crop my image to show juste the black region and calculte the correcte uniformity in this region

img01.PNG

First 2 google hits should set you up:
Image operations with NumPy (pythoninformer.com)
python - Center crop a numpy array - Stack Overflow