code: def measure_objects(self, object_set, workspace):
      objects = workspace.get_objects(object_set)
  
      label_image = objects.segmented
  
      if objects.has_parent_image:
          mask = objects.parent_image.mask
  
          label_image[~mask] = 0
  
          total_area = numpy.sum(mask)
      else:
          total_area = numpy.product(label_image.shape)
  
      region_properties = skimage.measure.regionprops(label_image)
  
      area_occupied = numpy.sum(
          [region["area"] for region in region_properties]
      )
  
      if area_occupied > 0:
          if objects.volumetric:
              spacing = None
  
              if objects.has_parent_image:
                  spacing = objects.parent_image.spacing
  
              labels = numpy.unique(label_image)
  
              if labels[0] == 0:
                  labels = labels[1:]
  
              perimeter = surface_area(
                  label_image, spacing=spacing, index=labels
              )
          else:
              perimeter = numpy.sum(
                  [
                      numpy.round(region["perimeter"])
                      for region in region_properties
                  ]
              )
      else:
          perimeter = 0
  
      measurements = workspace.measurements
      pipeline = workspace.pipeline
  
      self._add_image_measurement(
          object_set,
          F_VOLUME_OCCUPIED
          if pipeline.volumetric()
          else F_AREA_OCCUPIED,
          area_occupied,
          measurements,
      )
  
      self._add_image_measurement(
          object_set,
          F_SURFACE_AREA if pipeline.volumetric() else F_PERIMETER,
          perimeter,
          measurements,
      )
  
      self._add_image_measurement(
          object_set,
          F_TOTAL_VOLUME if pipeline.volumetric() else F_TOTAL_AREA,
          total_area,
          measurements,
      )
  
      return [
          [
              object_set,
              str(area_occupied),
              str(perimeter),
              str(total_area),
          ]
      ]
  
imports: import numpy
  import skimage.measure
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.module import Module
  from cellprofiler_core.setting import Divider, ValidationError
  from cellprofiler_core.setting.choice import Choice
  from cellprofiler_core.setting.subscriber import ImageListSubscriber, LabelListSubscriber
label_desc: Use image node_id 8 for calling the MeasureImageAreaOccupied obj's underlying member method code with example usage: obj.measure_objects(object_set, workspace) and returns: list