code: def load_dataset(folder, num_cases_properties_loading_threshold=1000):
      print("loading dataset")
      case_identifiers = get_case_identifiers(folder)
      case_identifiers.sort()
      dataset = OrderedDict()
      for c in case_identifiers:
          dataset[c] = OrderedDict()
          dataset[c]["data_file"] = os.path.join(folder, "%s.npz" % c)
  
          dataset[c]["properties_file"] = os.path.join(
              folder, "%s.pkl" % c
          )
  
          if dataset[c].get("seg_from_prev_stage_file") is not None:
              dataset[c]["seg_from_prev_stage_file"] = os.path.join(
                  folder, "%s_segs.npz" % c
              )
  
      if (
          len(case_identifiers)
          <= num_cases_properties_loading_threshold
      ):
          print("loading all case properties")
          for i in dataset.keys():
              with open(dataset[i]["properties_file"], "rb") as f:
                  dataset[i]["properties"] = pickle.load(f)
      return dataset
  
imports: import os
  import pickle
  import glob
  import json
  import numpy
  from multiprocessing import Pool
  from collections import OrderedDict
  from sklearn.model_selection import KFold
  from typing import List
  from medicalseg.datasets import MedicalDataset
  from medicalseg.cvlibs import manager
  from nnunet.transforms import get_moreDA_augmentation, default_2D_augmentation_params, default_3D_augmentation_params
  from nnunet.transforms import rotate_coords_3d, rotate_coords_2d, NumpyToTensor
  from .dataloader import DataLoader2D, DataLoader3D
  from tools.preprocess_utils import verify_dataset_integrity, convert_to_decathlon, crop, ExperimentPlanner2D_v21, ExperimentPlanner3D_v21, DatasetAnalyzer
label_desc: Use image node_id 6 for calling a global function with example usage: load_dataset(folder, num_cases_properties_loading_threshold) and returns: dataset