code: def resample_and_normalize(
      self,
      data,
      target_spacing,
      properties,
      seg=None,
      force_separate_z=None,
  ):
      original_spacing_transposed = np.array(
          properties["original_spacing"]
      )[self.transpose_forward]
      before = {
          "spacing": properties["original_spacing"],
          "spacing_transposed": original_spacing_transposed,
          "data.shape (data is transposed)": data.shape,
      }
      target_spacing[0] = original_spacing_transposed[0]
      data, seg = resample_patient(
          data,
          seg,
          np.array(original_spacing_transposed),
          target_spacing,
          3,
          1,
          force_separate_z=force_separate_z,
          order_z_data=0,
          order_z_seg=0,
          separate_z_anisotropy_threshold=self.resample_separate_z_anisotropy_threshold,
      )
      after = {
          "spacing": target_spacing,
          "data.shape (data is resampled)": data.shape,
      }
      print("Resample before: {}".format(before))
      print("Resample after: {}: ".format(after))
  
      if seg is not None:
          seg[seg < -1] = 0
  
      properties["size_after_resampling"] = data[0].shape
      properties["spacing_after_resampling"] = target_spacing
      use_nonzero_mask = self.use_nonzero_mask
  
      assert len(self.normalization_scheme_per_modality) == len(
          data
      ), "normalization_scheme_per_modality must have as many entries as data has modalities in GenericPreprocessor."
      assert len(self.use_nonzero_mask) == len(
          data
      ), "use_nonzero_mask must have as many entries as data has modalities in GenericPreprocessor."
      print("Normalize...")
      for c in range(len(data)):
          scheme = self.normalization_scheme_per_modality[c]
          if scheme == "CT":
              assert (
                  self.intensityproperties is not None
              ), "CT dataset must has intensityproperties, but got None. Please check your DataAnalyzer."
              mean_intensity = self.intensityproperties[c]["mean"]
              std_intensity = self.intensityproperties[c]["sd"]
              lower_bound = self.intensityproperties[c][
                  "percentile_00_5"
              ]
              upper_bound = self.intensityproperties[c][
                  "percentile_99_5"
              ]
              data[c] = np.clip(data[c], lower_bound, upper_bound)
              data[c] = (data[c] - mean_intensity) / std_intensity
              if use_nonzero_mask[c]:
                  data[c][seg[-1] < 0] = 0
          elif scheme == "CT2":
              assert (
                  self.intensityproperties is not None
              ), "CT dataset must has intensityproperties, but got None. Please check your DataAnalyzer."
              lower_bound = self.intensityproperties[c][
                  "percentile_00_5"
              ]
              upper_bound = self.intensityproperties[c][
                  "percentile_99_5"
              ]
              mask = (data[c] > lower_bound) & (data[c] < upper_bound)
              data[c] = np.clip(data[c], lower_bound, upper_bound)
              mn = data[c][mask].mean()
              sd = data[c][mask].std()
              data[c] = (data[c] - mn) / sd
              if use_nonzero_mask[c]:
                  data[c][seg[-1] < 0] = 0
          elif scheme == "noNorm":
              pass
          else:
              if use_nonzero_mask[c]:
                  mask = seg[-1] >= 0
              else:
                  mask = np.ones(seg.shape[1:], dtype=bool)
              data[c][mask] = (data[c][mask] - data[c][mask].mean()) / (
                  data[c][mask].std() + 1e-8
              )
              data[c][mask == 0] = 0
      print("Normalization done")
      return data, seg, properties
  
imports: import pickle
  import os
  import numpy
  from collections import OrderedDict
  from scipy.ndimage.interpolation import map_coordinates
  from multiprocessing.pool import Pool
  from skimage.transform import resize
  from .image_crop import get_case_identifier_from_npz, ImageCropper
  from .path_utils import join_paths
label_desc: Use image node_id 3 for calling the PreprocessorFor2D obj's underlying member method code with example usage: obj.resample_and_normalize(data, target_spacing, properties, seg, force_separate_z) and returns: data,  seg,  properties