docstr: Return an image that is rescaled according to the settings
  
  image - an instance of cpimage.Image
  returns another instance of cpimage.Image
docstr_tok: ["Return","an","image","that","is","rescaled","according","to","the","settings","image","-","an","instance","of","cpimage.Image","returns","another","instance","of","cpimage.Image"]
code: def apply_scaling(self, image, orig_image=None):
      """Return an image that is rescaled according to the settings
  
      image - an instance of cpimage.Image
      returns another instance of cpimage.Image
      """
      if self.rescale_option == "No":
          return image
  
      def scaling_fn_2d(pixel_data):
          if image.has_mask:
              sorted_pixel_data = pixel_data[
                  (pixel_data > 0) & image.mask
              ]
          else:
              sorted_pixel_data = pixel_data[pixel_data > 0]
          if sorted_pixel_data.shape[0] == 0:
              return pixel_data
          sorted_pixel_data.sort()
          if self.rescale_option == "Yes":
              idx = int(sorted_pixel_data.shape[0] * ROBUST_FACTOR)
              robust_minimum = sorted_pixel_data[idx]
              pixel_data = pixel_data.copy()
              pixel_data[pixel_data < robust_minimum] = robust_minimum
          elif self.rescale_option == RE_MEDIAN:
              idx = int(sorted_pixel_data.shape[0] / 2)
              robust_minimum = sorted_pixel_data[idx]
          if robust_minimum == 0:
              return pixel_data
          return pixel_data / robust_minimum
  
      if image.pixel_data.ndim == 2:
          output_pixels = scaling_fn_2d(image.pixel_data)
      else:
          output_pixels = numpy.dstack(
              [
                  scaling_fn_2d(x)
                  for x in image.pixel_data.transpose(2, 0, 1)
              ]
          )
      output_image = Image(output_pixels, parent_image=orig_image)
      return output_image
  
imports: import centrosome.bg_compensate
  import centrosome.cpmorphology
  import centrosome.cpmorphology
  import centrosome.filter
  import centrosome.smooth
  import numpy
  import scipy.ndimage
  import skimage.filters
  from cellprofiler_core.image import AbstractImage
  from cellprofiler_core.image import Image
  from cellprofiler_core.measurement import Measurements
  from cellprofiler_core.module import Module
  from cellprofiler_core.pipeline import Pipeline
  from cellprofiler_core.setting import Binary
  from cellprofiler_core.setting import ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.subscriber import ImageSubscriber
  from cellprofiler_core.setting.text import Float
  from cellprofiler_core.setting.text import ImageName
  from cellprofiler_core.setting.text import Integer
label_desc: Use image node_id 17 for calling the CorrectIlluminationCalculate obj's underlying member method code with example usage: obj.apply_scaling(image, orig_image) and returns: output_image, image, unknown, pixel_data, pixel_data