def add_to_axes(self, axes): """Add the overlay to the axes.""" rect_width = self.pickets[0].sample_width * 2 for mlc_num, mlc in enumerate(self.pickets[0].mlc_meas): # get pass/fail status of all measurements across pickets for that MLC if self.settings.action_tolerance is not None: if all( picket.mlc_passed_action(mlc_num) for picket in self.pickets): color = 'b' elif all( picket.mlc_passed(mlc_num) for picket in self.pickets): color = 'm' else: color = 'r' elif all(picket.mlc_passed(mlc_num) for picket in self.pickets): color = 'b' else: color = 'r' # create a rectangle overlay if self.settings.orientation == orientations['UD']: r = Rectangle(self.image.shape[1], rect_width, center=(self.image.center.x, mlc.center.y)) else: r = Rectangle(rect_width, self.image.shape[0], center=(mlc.center.x, self.image.center.y)) r.add_to_axes(axes.axes, edgecolor='none', fill=True, alpha=0.1, facecolor=color)
def _create_phantom_outline_object(self): """Construct the phantom outline object which will be plotted on the image for visual inspection.""" outline_type = list(self.phantom_outline_object)[0] outline_settings = list(self.phantom_outline_object.values())[0] settings = {} if outline_type == 'Rectangle': side_a = self.phantom_radius*outline_settings['width ratio'] side_b = self.phantom_radius*outline_settings['height ratio'] half_hyp = np.sqrt(side_a**2 + side_b**2)/2 internal_angle = ia = np.rad2deg(np.arctan(side_b/side_a)) new_x = self.phantom_center.x + half_hyp*(geometry.cos(ia)-geometry.cos(ia+self.phantom_angle)) new_y = self.phantom_center.y + half_hyp*(geometry.sin(ia)-geometry.sin(ia+self.phantom_angle)) obj = Rectangle(width=self.phantom_radius*outline_settings['width ratio'], height=self.phantom_radius*outline_settings['height ratio'], center=Point(new_x, new_y)) settings['angle'] = self.phantom_angle elif outline_type == 'Circle': obj = Circle(center_point=self.phantom_center, radius=self.phantom_radius*outline_settings['radius ratio']) else: raise ValueError("An outline object was passed but was not a Circle or Rectangle.") return obj, settings