def display(self, workspace, figure): images = workspace.display_data.images names = workspace.display_data.names stats = workspace.display_data.stats figure.set_subplots((1, len(images))) figure.figure.clf() nimages = len(images) shrink = .05 for i in range(len(images)): rect = [shrink + float(i)/float(nimages), .5+shrink, (1.0-2*shrink)/float(nimages), .45*(1.0-2*shrink)] axes = figure.figure.add_axes(rect) axes.imshow(images[i], matplotlib.cm.Greys_r) axes.set_title(names[i], fontname=cpprefs.get_title_font_name(), fontsize=cpprefs.get_title_font_size()) rect = [0.1,.1,.8,.35] axes = figure.figure.add_axes(rect, frameon = False) table = axes.table(cellText=stats, colWidths=[1.0/7.0]*7, loc='center', cellLoc='left') axes.set_axis_off() table.auto_set_font_size(False) table.set_fontsize(cpprefs.get_table_font_size())
def run(self, workspace): stats = [("Image", "Objects", "Bin # (innermost=1)", "Bin count", "Fraction", "Intensity", "COV")] d = {} for image in self.images: for o in self.objects: for bin_count_settings in self.bin_counts: stats += \ self.do_measurements(workspace, image.image_name.value, o.object_name.value, o.center_object_name.value if o.center_choice == C_OTHER else None, bin_count_settings, d) if workspace.frame is not None: images = [d[key][0] for key in d.keys()] names = d.keys() figure = workspace.create_or_find_figure( title="MeasureObjectRadialDistribution, image cycle #%d" % (workspace.measurements.image_set_number), subplots=(1, len(images))) figure.figure.clf() nimages = len(images) shrink = .05 for i in range(len(images)): rect = [ shrink + float(i) / float(nimages), .5 + shrink, (1.0 - 2 * shrink) / float(nimages), .45 * (1.0 - 2 * shrink) ] axes = figure.figure.add_axes(rect) axes.imshow(images[i], matplotlib.cm.Greys_r) axes.set_title(names[i], fontname=cpprefs.get_title_font_name(), fontsize=cpprefs.get_title_font_size()) rect = [0.1, .1, .8, .35] axes = figure.figure.add_axes(rect, frameon=False) table = axes.table(cellText=stats, colWidths=[1.0 / 7.0] * 7, loc='center', cellLoc='left') axes.set_axis_off() table.auto_set_font_size(False) table.set_fontsize(cpprefs.get_table_font_size())
def run(self, workspace): stats = [("Image","Objects","Bin # (innermost=1)","Bin count","Fraction","Intensity","COV")] d = {} for image in self.images: for o in self.objects: for bin_count_settings in self.bin_counts: stats += \ self.do_measurements(workspace, image.image_name.value, o.object_name.value, o.center_object_name.value if o.center_choice != C_SELF else None, o.center_choice.value, bin_count_settings, d) if workspace.frame is not None: images = [d[key][0] for key in d.keys()] names = d.keys() figure = workspace.create_or_find_figure(title="MeasureObjectRadialDistribution, image cycle #%d"%( workspace.measurements.image_set_number),subplots=(1,len(images))) figure.figure.clf() nimages = len(images) shrink = .05 for i in range(len(images)): rect = [shrink + float(i)/float(nimages), .5+shrink, (1.0-2*shrink)/float(nimages), .45*(1.0-2*shrink)] axes = figure.figure.add_axes(rect) axes.imshow(images[i], matplotlib.cm.Greys_r) axes.set_title(names[i], fontname=cpprefs.get_title_font_name(), fontsize=cpprefs.get_title_font_size()) rect = [0.1,.1,.8,.35] axes = figure.figure.add_axes(rect, frameon = False) table = axes.table(cellText=stats, colWidths=[1.0/7.0]*7, loc='center', cellLoc='left') axes.set_axis_off() table.auto_set_font_size(False) table.set_fontsize(cpprefs.get_table_font_size())
def get_table_font(self): return "%s,%f" % (cpprefs.get_table_font_name(), cpprefs.get_table_font_size())
def get_table_font(self): return "%s,%f"%(cpprefs.get_table_font_name(), cpprefs.get_table_font_size())