code: def preprocess_and_generate_plans(self):
      if not os.path.exists(self.decathlon_dir):
          print(
              "{} not found, convert data to decathlon.".format(
                  self.decathlon_dir
              )
          )
          convert_to_decathlon(
              input_folder=self.raw_data_dir,
              output_folder=self.decathlon_dir,
              num_processes=self.num_threads,
          )
          verify_dataset_integrity(
              self.decathlon_dir, default_num_threads=self.num_threads
          )
      else:
          print(
              "Found existed {}, please ensure your dataset is preprocessed correctly!!!".format(
                  self.decathlon_dir
              )
          )
  
      if not os.path.exists(self.cropped_data_dir):
          print(
              "{} not found, crop data, it may be time consuming.".format(
                  self.cropped_data_dir
              )
          )
          crop(
              self.decathlon_dir,
              self.cropped_data_dir,
              override=False,
              num_threads=self.num_threads,
          )
      else:
          print(
              "Found existed {}, please ensure your dataset is preprocessed correctly!!!".format(
                  self.cropped_data_dir
              )
          )
  
      if not os.path.exists(
          os.path.join(self.cropped_data_dir, "dataset_properties.pkl")
      ):
          print(
              "{} not exist, analyzing dataset...".format(
                  os.path.join(
                      self.cropped_data_dir, "dataset_properties.pkl"
                  )
              )
          )
          with open(
              os.path.join(
                  os.path.join(self.cropped_data_dir, "dataset.json")
              ),
              "rb",
          ) as f:
              dataset_json = json.load(f)
          modalities = list(dataset_json["modality"].values())
          collect_intensityproperties = (
              True
              if (("CT" in modalities) or ("ct" in modalities))
              else False
          )
          dataset_analyzer = DatasetAnalyzer(
              self.cropped_data_dir,
              overwrite=True,
              num_processes=self.num_threads,
          )
          dataset_analyzer.analyze_dataset(collect_intensityproperties)
      else:
          print(
              "Found existed dataset_properties.pkl, please ensure your dataset_properties is preprocessed correctly!!!"
          )
  
      if self.plan2d:
          exp_planner_2d = ExperimentPlanner2D_v21(
              self.cropped_data_dir, self.preprocessed_dir
          )
          if not os.path.exists(exp_planner_2d.plans_fname):
              print(
                  "{} not exists, generating plans, please wait a minute.".format(
                      exp_planner_2d.plans_fname
                  )
              )
              exp_planner_2d.plan_experiment()
              exp_planner_2d.run_preprocessing(self.num_threads)
          else:
              print(
                  "Found existed plan file, please ensure your plan file is preprocessed correctly!!!"
              )
  
      if self.plan3d:
          exp_planner_3d = ExperimentPlanner3D_v21(
              self.cropped_data_dir, self.preprocessed_dir
          )
          if not os.path.exists(exp_planner_3d.plans_fname):
              print(
                  "{} already exists, generating plans, please wait a minute.".format(
                      exp_planner_3d.plans_fname
                  )
              )
              exp_planner_3d.plan_experiment()
              exp_planner_3d.run_preprocessing(self.num_threads)
          else:
              print(
                  "Found existed plan file, please ensure your plan file is preprocessed correctly!!!"
              )
  
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 4 for calling the MSDDataset obj's underlying member method code with example usage: obj.preprocess_and_generate_plans() without return types