The output is showing the size of the contents of the 1st folder only i.e. 19,384x384. I want to get all the shapes from all folders in a boy array. However, some files has different shape(21,384,384) and (23,384,384). Can you tell me where and how should I use resize operation for this? I want the final storage of the array to be (5,19,384,384). I read the docs but still finding it hard to do it. if you can make the changes, I will be grateful to you. Directory structure is as follows–
C:/Users/   Desktop/train/’
PX1_0000- T2W.nii.gz + seg.nii.gz
PX1_0001- T2W.nii.gz+ seg.nii.gz
.
.
… PX1_0200- T2W.nii.gz+ seg.nii
path1='C:/Users/Desktop/train/'

def load_data(path):
  my_dir = sorted(os.listdir(path))
  for p in tqdm(my_dir):
    data1=[]
    gt=[]
    data_list = os.path.join(path+p)
    img = sitk.ReadImage(path + p + '/'+'seg.nii.gz')    
    seg =  sitk.GetArrayFromImage(img)
    img = sitk.ReadImage(path + p + '/'+ 'T2W.nii.gz')
    T2W = sitk.GetArrayFromImage(img)
    data1.append([T2W])
    gt.append(seg)
  data1 = np.asarray(data1,dtype=np.uint8)
  gt = np.asarray(gt,dtype=np.uint8)
  return data1,gt

data1,gt1 = load_data(path1)