code: def calculate_zernikes(self, workspace):
      zernike_indexes = centrosome.zernike.get_zernike_indexes(
          self.zernike_degree.value + 1
      )
  
      meas = workspace.measurements
  
      for o in self.objects:
          object_name = o.object_name.value
  
          objects = workspace.object_set.get_objects(object_name)
  
          #
          # First, get a table of centers and radii of minimum enclosing
          # circles per object
          #
          ij = numpy.zeros((objects.count + 1, 2))
  
          r = numpy.zeros(objects.count + 1)
  
          for labels, indexes in objects.get_labels():
              (
                  ij_,
                  r_,
              ) = centrosome.cpmorphology.minimum_enclosing_circle(
                  labels, indexes
              )
  
              ij[indexes] = ij_
  
              r[indexes] = r_
  
          #
          # Then compute x and y, the position of each labeled pixel
          # within a unit circle around the object
          #
          ijv = objects.ijv
  
          l = ijv[:, 2]
  
          yx = (ijv[:, :2] - ij[l, :]) / r[l, numpy.newaxis]
  
          z = centrosome.zernike.construct_zernike_polynomials(
              yx[:, 1], yx[:, 0], zernike_indexes
          )
  
          for image_name in self.images_list.value:
              image = workspace.image_set.get_image(
                  image_name, must_be_grayscale=True
              )
  
              pixels = image.pixel_data
  
              mask = (ijv[:, 0] < pixels.shape[0]) & (
                  ijv[:, 1] < pixels.shape[1]
              )
  
              mask[mask] = image.mask[ijv[mask, 0], ijv[mask, 1]]
  
              yx_ = yx[mask, :]
  
              l_ = l[mask]
  
              z_ = z[mask, :]
  
              if len(l_) == 0:
                  for i, (n, m) in enumerate(zernike_indexes):
                      ftr = self.get_zernike_magnitude_name(
                          image_name, n, m
                      )
  
                      meas[object_name, ftr] = numpy.zeros(0)
  
                      if self.wants_zernikes == Z_MAGNITUDES_AND_PHASE:
                          ftr = self.get_zernike_phase_name(
                              image_name, n, m
                          )
  
                          meas[object_name, ftr] = numpy.zeros(0)
  
                  continue
  
              areas = scipy.ndimage.sum(
                  numpy.ones(l_.shape, int),
                  labels=l_,
                  index=objects.indices,
              )
  
              for i, (n, m) in enumerate(zernike_indexes):
                  vr = scipy.ndimage.sum(
                      pixels[ijv[mask, 0], ijv[mask, 1]]
                      * z_[:, i].real,
                      labels=l_,
                      index=objects.indices,
                  )
  
                  vi = scipy.ndimage.sum(
                      pixels[ijv[mask, 0], ijv[mask, 1]]
                      * z_[:, i].imag,
                      labels=l_,
                      index=objects.indices,
                  )
  
                  magnitude = numpy.sqrt(vr * vr + vi * vi) / areas
  
                  ftr = self.get_zernike_magnitude_name(
                      image_name, n, m
                  )
  
                  meas[object_name, ftr] = magnitude
  
                  if self.wants_zernikes == Z_MAGNITUDES_AND_PHASE:
                      phase = numpy.arctan2(vr, vi)
  
                      ftr = self.get_zernike_phase_name(
                          image_name, n, m
                      )
  
                      meas[object_name, ftr] = phase
  
imports: import centrosome.cpmorphology
  import centrosome.propagate
  import centrosome.zernike
  import matplotlib.cm
  import numpy
  import numpy.ma
  import scipy.ndimage
  import scipy.sparse
  from cellprofiler_core.constants.measurement import COLTYPE_FLOAT
  from cellprofiler_core.image import Image
  from cellprofiler_core.module import Module
  from cellprofiler_core.preferences import get_default_colormap
  from cellprofiler_core.setting import HiddenCount, Divider, SettingsGroup, Binary, ValidationError
  from cellprofiler_core.setting.choice import Choice, Colormap
  from cellprofiler_core.setting.do_something import DoSomething, RemoveSettingButton
  from cellprofiler_core.setting.subscriber import LabelSubscriber, ImageListSubscriber, ImageSubscriber
  from cellprofiler_core.setting.text import Integer, ImageName
  from cellprofiler_core.utilities.core.object import crop_labels_and_image, size_similarly
  import cellprofiler.gui.help.content
label_desc: Use image node_id 13 for calling the MeasureObjectIntensityDistribution obj's underlying member method code with example usage: obj.calculate_zernikes(workspace) without return types