def run_image(self, image_name, scale, angle, workspace):
     '''Run measurements on image'''
     statistics = []
     image = workspace.image_set.get_image(image_name,
                                           must_be_grayscale=True)
     pixel_data = image.pixel_data
     image_labels = np.ones(pixel_data.shape, int)
     if image.has_mask:
         image_labels[~image.mask] = 0
     scale_i, scale_j = self.get_angle_ij(angle, scale)
     for name, value in zip(
             F_HARALICK,
             Haralick(pixel_data, image_labels, scale_i, scale_j).all()):
         statistics += self.record_image_measurement(
             workspace, image_name,
             str(scale) + "_" + H_TO_A[angle], name, value)
     return statistics
 def run_one(self, image_name, object_name, scale, angle, workspace):
     """Run, computing the area measurements for a single map of objects"""
     statistics = []
     image = workspace.image_set.get_image(image_name,
                                           must_be_grayscale=True)
     objects = workspace.get_objects(object_name)
     pixel_data = image.pixel_data
     if image.has_mask:
         mask = image.mask
     else:
         mask = None
     labels = objects.segmented
     try:
         pixel_data = objects.crop_image_similarly(pixel_data)
     except ValueError:
         #
         # Recover by cropping the image to the labels
         #
         pixel_data, m1 = size_similarly(labels, pixel_data)
         if np.any(~m1):
             if mask is None:
                 mask = m1
             else:
                 mask, m2 = size_similarly(labels, mask)
                 mask[~m2] = False
         
     if np.all(labels == 0):
         for name in F_HARALICK:
             statistics += self.record_measurement(
                 workspace, image_name, object_name, 
                 str(scale) + "_" + H_TO_A[angle], name, np.zeros((0,)))
     else:
         scale_i, scale_j = self.get_angle_ij(angle, scale)
             
         for name, value in zip(F_HARALICK, Haralick(pixel_data,
                                                     labels,
                                                     scale_i,
                                                     scale_j,
                                                     mask=mask).all()):
             statistics += self.record_measurement(
                 workspace, image_name, object_name, 
                 str(scale) + "_" + H_TO_A[angle], name, value)
     return statistics