docstr: load data of different format into numpy array, return data is in xyz
  
  f: the complete path to the file that you want to load
docstr_tok: ["load","data","of","different","format","into","numpy","array",",","return","data","is","in","xyz","f",":","the","complete","path","to","the","file","that","you","want","to","load"]
code: def load_medical_data(f):
      """
      load data of different format into numpy array, return data is in xyz
  
      f: the complete path to the file that you want to load
  
      """
      filename = osp.basename(f).lower()
      images = []
  
      # validate nii.gz on lung and mri with correct spacing_resample
      if filename.endswith((".nii", ".nii.gz", ".dcm")):
          itkimage = sitk.ReadImage(f)
          if itkimage.GetDimension() == 4:
              slicer = sitk.ExtractImageFilter()
              s = list(itkimage.GetSize())
              s[-1] = 0
              slicer.SetSize(s)
              for slice_idx in range(itkimage.GetSize()[-1]):
                  slicer.SetIndex([0, 0, 0, slice_idx])
                  sitk_volume = slicer.Execute(itkimage)
                  images.append(sitk_volume)
              images = [sitk.DICOMOrient(img, "LPS") for img in images]
              f_nps = [sitk.GetArrayFromImage(img) for img in images]
          else:
              f_nps = [nib.load(f).get_fdata(dtype=np.float32)]
  
      elif filename.endswith(
          (".mha", ".mhd", "nrrd")
      ):  # validate mhd on lung and mri with correct spacing_resample
          itkimage = sitk.DICOMOrient(sitk.ReadImage(f), "LPS")
          f_np = sitk.GetArrayFromImage(itkimage)
          if f_np.ndim == 4:
              f_nps = [
                  f_np[:, :, :, idx] for idx in range(f_np.shape[3])
              ]
          else:
              f_nps = [f_np]
          f_nps = [np.transpose(f_np, [1, 2, 0]) for f_np in f_nps]
      elif filename.endswith(".raw"):
          raise RuntimeError(
              f"Received {f}. Please only provide path to .mhd file, not to .raw file"
          )
  
      else:
          raise NotImplementedError
  
      return f_nps
  
imports: import os
  import os.path
  import sys
  import time
  import glob
  import numpy
  import nibabel
  import SimpleITK
  from tqdm import tqdm
  import json
  from medicalseg.utils import get_image_list
  from tools.preprocess_utils import uncompressor, global_var, add_qform_sform, join_paths
label_desc: Use image node_id 3 for calling the Prep obj's underlying member method code with example usage: obj.load_medical_data(f) and returns: f_nps