code: def save_scans_BRATS15(pat_name, VSD_id, img_data, seg_data=None):
      save_mod_names = ["Flair", "T1", "T1c", "T2"]
      save_seg_name = "Label"
      assert img_data.shape[3] == 4
      for mod_i in range(len(save_mod_names)):
          save_name = "%s.%s_%s.nii.gz" % (
              pat_name,
              VSD_id,
              save_mod_names[mod_i],
          )
          save_path = os.path.join(OUTPUT_path, save_name)
          mod_data_nii = nibabel.Nifti1Image(
              img_data[:, :, :, mod_i], OUTPUT_AFFINE
          )
          nibabel.save(mod_data_nii, save_path)
      if seg_data is not None:
          save_name = "%s.%s_%s.nii.gz" % (
              pat_name,
              VSD_id,
              save_seg_name,
          )
          save_path = os.path.join(OUTPUT_path, save_name)
          seg_data_nii = nibabel.Nifti1Image(seg_data, OUTPUT_AFFINE)
          nibabel.save(seg_data_nii, save_path)
  
file_path: NiftyNet/demos/BRATS17/rename_crop_BRATS.py
imports: import os
  import SimpleITK
  import nibabel
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: save_scans_BRATS15(pat_name, VSD_id, img_data, seg_data) without return types