have a nice time

I wanted to edit a piece of code. My medical data has a nifti format and includes three-dimensional 3D MRI data and my two-dimensional binary mask. I have 20 different patients, each of whom has a different binary mask slice number. When reading the data, I need to come exactly according to the two-dimensional binary mask slice number and read the same slice from the patient's 3D data, and put the binary mask on it. And the goal here is to extract the feature.

Thank you for your help.

data = nib.load(inputImage).get_fdata() mask_l = nib.load(mask_resampled).get_fdata()

img = data[:,:,10]
img = np.expand_dims(img, axis=-1)
mask = np.squeeze(mask_l, axis=-1)

stik_image = sitk.GetImageFromArray(img)
stik_mask = sitk.GetImageFromArray(mask)
🔴 No definitive solution yet