code: def main(
      pat_category_list=("HGG", "LGG"), dataset="BRATS17", crop=False
  ):
      for pat_cat in pat_category_list:
          pat_ID = 0
          for pat_folder_name in os.listdir(
              os.path.join(BRATS_path, pat_cat)
          ):
              pat_ID += 1
              # Load
              pat_folder = os.path.join(
                  BRATS_path, pat_cat, pat_folder_name
              )
              try:
                  if dataset == "BRATS17":
                      img_data, seg_data = load_scans_BRATS17(
                          pat_folder, with_seg=True
                      )
                  if dataset == "BRATS15":
                      img_data, seg_data, VSD_id = load_scans_BRATS15(
                          pat_folder, with_seg=True
                      )
              except OSError:
                  print("skipping %s" % pat_folder)
                  continue
                  pass
              print(
                  "subject: {}, shape: {}".format(
                      pat_folder, img_data.shape
                  )
              )
              # Cropping
              if crop:
                  x_, _x, y_, _y, z_, _z = crop_zeros(img_data)
                  img_data = img_data[x_:_x, y_:_y, z_:_z, :]
                  seg_data = seg_data[x_:_x, y_:_y, z_:_z]
                  print("shape cropping: {}".format(img_data.shape))
              # Save with name convention
              pat_name = "%s%d" % (pat_cat, pat_ID)
              # remove '_' from pat_name to match name convention
              pat_name = pat_name.replace("_", "")
              if dataset == "BRATS15":
                  save_scans_BRATS15(
                      pat_name, VSD_id, img_data, seg_data
                  )
              elif dataset == "BRATS17":
                  save_scans_BRATS17(pat_name, img_data, seg_data)
  
file_path: NiftyNet/demos/BRATS17/rename_crop_BRATS.py
imports: import os
  import SimpleITK
  import nibabel
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: main(pat_category_list, dataset, crop) without return types