def add_object(self, can_remove=True):
        '''Add an object to the object_groups collection

        can_delete - set this to False to keep from showing the "remove"
                     button for images that must be present.
        '''
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))
        group.append("name", cps.ObjectNameSubscriber(
                "Select objects to measure", cps.NONE, doc="""
            Select the objects whose intensities you want to measure."""))

        if can_remove:
            group.append("remover", cps.RemoveSettingButton("", "Remove this object", self.objects, group))
        self.objects.append(group)
Exemplo n.º 2
0
 def add_image_cb(self, can_remove = True):
     '''Add an image to the image_groups collection
     
     can_delete - set this to False to keep from showing the "remove"
                  button for images that must be present.
     '''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     group.append('image_name', 
                  cps.ImageNameSubscriber("Select an image to measure","None", 
                                          doc="""
                                          What did you call the grayscale images whose moments you want to calculate?"""))
     if can_remove:
         group.append("remover", cps.RemoveSettingButton("", "Remove this image", self.image_groups, group))
     self.image_groups.append(group)  
    def add_image(self, can_remove=True):
        '''Add an image to the image_groups collection

        can_delete - set this to False to keep from showing the "remove"
                     button for images that must be present.
        '''
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))
        group.append("name", cps.ImageNameSubscriber(
                "Select an image to measure", cps.NONE, doc="""
            Select the grayscale images whose intensity you want to measure."""))

        if can_remove:
            group.append("remover", cps.RemoveSettingButton("", "Remove this image", self.images, group))
        self.images.append(group)
Exemplo n.º 4
0
    def add_image_measurement(self, can_remove=True):
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider())

        group.append(
            "image_name",
            cps.ImageNameSubscriber("Select the image to measure",
                                    cps.NONE,
                                    doc='''
            Choose an image name from the drop-down menu to calculate intensity for that
            image. Use the <i>Add another image</i> button below to add additional images which will be
            measured. You can add the same image multiple times if you want to measure
            the intensity within several different objects.'''))
        group.append(
            "nchannels",
            cps.Integer("How many channels does the image have?",
                        1,
                        doc="""
            Indicate how many planes this image have. This is needed as
            the cellprofiler pipeline needs to be independent of the actuall
            image data.
            """))
        group.append(
            "wants_objects",
            cps.Binary(
                "Measure the intensity only from areas enclosed by objects?",
                False,
                doc="""
            Select <i>%(YES)s</i> to measure only those pixels within an object of choice."""
                % globals()))

        group.append(
            "object_name",
            cps.ObjectNameSubscriber("Select the input objects",
                                     cps.NONE,
                                     doc='''
            <i>(Used only when measuring intensity from area enclosed by objects)</i><br>
            Select the objects that the intensity will be aggregated within. The intensity measurement will be
            restricted to the pixels within these objects.'''))

        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image", self.images,
                                        group))
        self.images.append(group)
Exemplo n.º 5
0
 def add_image(self, can_remove=True):
     '''Add an image to the list of image names
     
     can_remove - set this to False to keep from showing the "remove"
                  button for images that must be present.
     '''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     group.append("image_name",
                  cps.ImageNameSubscriber(self.query(), "None"))
     if can_remove:
         group.append(
             "remover",
             cps.RemoveSettingButton("", "Remove this image",
                                     self.image_names, group))
     self.image_names.append(group)
Exemplo n.º 6
0
 def add_objects(self, can_delete=True):
     group = cps.SettingsGroup()
     self.objects_to_export.append(group)
     group.append(
         "objects_name",
         cps.ObjectNameSubscriber("Objects name",
                                  value="Nuclei",
                                  doc="""
             This setting lets you choose the objects you want to export.
             <b>ExportToCellH5</b> will write the segmentation of the objects
             to your CellH5 file so that they can be saved and used by other
             applications that support the format.
             """))
     group.append(
         "Remover",
         cps.RemoveSettingButton("Remove the objects above", "Remove",
                                 self.objects_to_export, group))
Exemplo n.º 7
0
 def add_image(self, can_delete=True):
     group = cps.SettingsGroup()
     self.images_to_export.append(group)
     group.append(
         "image_name",
         cps.ImageNameSubscriber("Image name",
                                 value="DNA",
                                 doc="""
         This setting lets you choose the images you want to export.
         <b>ExportToCellH5</b> will write the image
         to your CellH5 file so that it can be used by other
         applications that support the format.
         """))
     group.append(
         "remover",
         cps.RemoveSettingButton("Remove the image above", "Remove",
                                 self.objects_to_export, group))
Exemplo n.º 8
0
 def add_object(self, can_delete=True):
     '''Add an object to the object_groups collection'''
     group = cps.SettingsGroup()
     if can_delete:
         group.append("divider", cps.Divider(line=False))
     group.append(
         "object_name",
         cps.ObjectNameSubscriber(
             'Select an object to measure',
             'None',
             doc='''What is the name of objects to be measured?'''))
     if can_delete:
         group.append(
             "remover",
             cps.RemoveSettingButton('', 'Remove this object',
                                     self.object_groups, group))
     self.object_groups.append(group)
Exemplo n.º 9
0
 def add_image(self, removable=True):
     # The text for these settings will be replaced in renumber_settings()
     group = cps.SettingsGroup()
     group.removable = removable
     group.append(
         "image_or_measurement",
         cps.Choice(
             "Image or measurement?", [IM_IMAGE, IM_MEASUREMENT],
             doc="""You can perform math operations using two images or you
         can use a measurement for one of the operands. For instance,
         to divide the intensity of one image by another, choose Image
         for both and pick the respective images. To divide the intensity
         of an image by its median intensity, use <b>MeasureImageIntensity</b>
         prior to this module to calculate the median intensity, then
         select "Measurement" and use the median intensity measurement as
         the denominator"""))
     group.append(
         "image_name",
         cps.ImageNameSubscriber(
             "",
             "",
             doc="""Which image do you want to use for this operation?"""))
     group.append(
         "measurement",
         cps.Measurement(
             "Measurement",
             lambda: cpmeas.IMAGE,
             "",
             doc="""This is a measurement made on the image. The value of the
         measurement is used for the operand for all of the pixels of the
         other operand's image."""))
     group.append(
         "factor",
         cps.Float(
             "",
             1,
             doc=
             """By what number would you like to multiply the above image? This multiplication
             is applied before other operations."""))
     if removable:
         group.append(
             "remover",
             cps.RemoveSettingButton("", "Remove this image", self.images,
                                     group))
     group.append("divider", cps.Divider())
     self.images.append(group)
Exemplo n.º 10
0
 def add_objects(self):
     og = cps.SettingsGroup()
     og.append(
         "objects_name",
         cps.ObjectNameSubscriber(
             "Select objects to measure",
             cps.NONE,
             doc="""Select the objects whose granualarity
         will be measured. You can select objects from prior modules
         that identify objects, such as <b>IdentifyPrimaryObjects</b>. If you only want to measure the granularity 
         for the image overall, you can remove all objects using the "Remove this object" button."""
         ))
     og.append(
         "remover",
         cps.RemoveSettingButton("", "Remove this object", self.objects,
                                 og))
     self.objects.append(og)
Exemplo n.º 11
0
 def add_image(self, can_remove=True):
     '''Add an image to be measured'''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     group.append(
         "image_name",
         cps.ImageNameSubscriber("Select an image to measure",
                                 "None",
                                 doc="""
             What did you call the images you want to process?"""))
     if can_remove:
         group.append(
             "remover",
             cps.RemoveSettingButton("", "Remove this image", self.images,
                                     group))
     self.images.append(group)
 def add_bin_count(self, can_remove = True):
     '''Add another radial bin count at which to measure'''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     group.append("bin_count", cps.Integer(
                 "Number of bins",4, 2, doc="""How many bins do you want to use to measure 
                     the distribution?
                     Radial distribution is measured with respect to a series
                     of concentric rings starting from the object center (or 
                     more generally, between contours at a normalized distance
                     from the object center). This number
                     specifies the number of rings into which the distribution is to
                     be divided. Additional ring counts can be specified
                     by clicking the <i>Add another set of bins</i> button."""))
     if can_remove:
         group.append("remover", cps.RemoveSettingButton("", "Remove this set of bins", self.bin_counts, group))
     self.bin_counts.append(group)
Exemplo n.º 13
0
 def add_image(self, can_remove = True):
     '''Add an image + associated questions and buttons'''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     
     group.append("input_image_name", 
                  cps.ImageNameSubscriber("Select the additional image?",
                                         "None",doc="""
                                         What is the name of the additional image to resize? This image will be
                                         resized with the same settings as the first image."""))
     group.append("output_image_name",
                  cps.ImageNameProvider("Name the output image",
                                         "ResizedBlue",doc="""
                                         What is the name of the additional resized image?"""))
     if can_remove:
         group.append("remover", cps.RemoveSettingButton("", "Remove above image", self.additional_images, group))
     self.additional_images.append(group)
Exemplo n.º 14
0
 def add_image(self, can_delete = True):
     '''Add an image to the image_groups collection
     
     can_delete - set this to False to keep from showing the "remove"
                  button for images that must be present.
     '''
     group = cps.SettingsGroup()
     if can_delete:
         group.append("divider", cps.Divider(line=False))
     group.append("image_name", cps.ImageNameSubscriber('Select an image to measure','None',
                                                       doc = '''What is the name of an image to be measured?'''))
     if len(self.image_groups) == 0: # Insert space between 1st two images for aesthetics
         group.append("extra_divider", cps.Divider(line=False))
     
     if can_delete:
         group.append("remover", cps.RemoveSettingButton("","Remove this image", self.image_groups, group))
         
     self.image_groups.append(group)
Exemplo n.º 15
0
    def add_channelfn(self, can_remove=True):
        '''Add another image channel
		
		can_remove - true if we are allowed to remove this channel
		'''
        group = cps.SettingsGroup()
        self.channels.append(group)

        #Check which cellprofiler image we are in the group
        #(each channel translates to a single cellprofiler image)
        cpimg_index = 0
        for channel in self.channels:
            if id(channel) == id(group):
                break
            cpimg_index += 1

        group.append("divider", cps.Divider(line=True))
        group.append(
            "cpimage_name",
            cps.ImageNameProvider('Image name',
                                  default_cpimage_name(cpimg_index)))
        channel_numbers = [
            str(x) for x in range(0, max(10,
                                         len(self.channels) + 2))
        ]
        group.append(
            "channel_number",
            cps.Choice("Channel number:",
                       channel_numbers,
                       channel_numbers[len(self.channels) - 1],
                       doc="""(Used only for multichannel images)
			The channels of a multichannel image are numbered starting from 0 (zero).
			
			Each channel is a greyscale image, acquired using different
			illumination sources and/or optics. Use this setting to pick
			the channel to associate with the image or images you load from
			OMERO."""))
        group.can_remove = can_remove
        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("Remove this channel",
                                        "Remove channel", self.channels,
                                        group))
Exemplo n.º 16
0
    def add_outline(self, can_remove=True):
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))

        group.append("outline_choice", cps.Choice(
                "Load outlines from an image or objects?",
                [FROM_OBJECTS, FROM_IMAGES], doc="""
            This setting selects what source the outlines come from:
            <ul>
            <li><i>%(FROM_OBJECTS)s:</i> Create the image directly from the
            objects. This option will improve the functionality of the
            contrast options for this module's interactive display and will
            save memory.</li>
            <li><i>%(FROM_IMAGES)s:</i> Prior versions of <b>OverlayOutlines</b> would only
            display outline images which were optional outputs of the identify
            modules. For legacy pipelines or to continue using the outline
            images instead of objects, choose this option.</li>
            </ul>
            """ % globals()))

        group.append("objects_name", cps.ObjectNameSubscriber(
                "Select objects to display", cps.NONE,
                doc="""Choose the objects whose outlines you would like
        to display."""))
        group.append("outline_name", cps.OutlineNameSubscriber(
                "Select outlines to display",
                cps.NONE, doc="""
            Choose outlines to display, from a previous <b>Identify</b>
            module. Each of the <b>Identify</b> modules has a checkbox that
            determines whether the outlines are saved. If you have checked this,
            you were asked to supply a name for the outline; you
            can then select that name here.
            """))

        default_color = (COLOR_ORDER[len(self.outlines)]
                         if len(self.outlines) < len(COLOR_ORDER)
                         else COLOR_ORDER[0])
        group.append("color", cps.Color(
                "Select outline color", default_color))
        if can_remove:
            group.append("remover", cps.RemoveSettingButton("", "Remove this outline", self.outlines, group))

        self.outlines.append(group)
Exemplo n.º 17
0
 def add_image(self, can_delete = True):
     '''Add an image to the list of images to be straightened'''
     
     group = cps.SettingsGroup()
     group.append("divider", cps.Divider())
     group.append("image_name", cps.ImageNameSubscriber(
         'Select an input image to straighten', 'None',
         doc = '''This is the name of an image that will be straightened
         similarly to the worm. The straightened image and objects can
         then be used in subsequent modules such as
         <b>MeasureObjectIntensity</b>.'''))
     group.append("straightened_image_name", cps.ImageNameProvider(
         'Name the output straightened image', 'StraightenedImage',
         doc = '''This is the name that will be given to the image
         of the straightened worms.'''))
     if can_delete:
         group.append("remover", cps.RemoveSettingButton(
             "", "Remove above image", self.images, group))
     self.images.append(group)
Exemplo n.º 18
0
    def add_image(self, can_remove=True):
        '''Add an image to be measured'''
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))
        group.append(
            "image_name",
            cps.ImageNameSubscriber("Select an image to measure",
                                    cps.NONE,
                                    doc="""
                Select the image that you want to measure the intensity from."""
                                    ))

        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image", self.images,
                                        group))
        self.images.append(group)
Exemplo n.º 19
0
 def add_object(self, can_remove=True):
     '''Add an object to be measured (plus optional centers)'''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     group.append(
         "object_name",
         cps.ObjectNameSubscriber("Select objects to measure",
                                  "None",
                                  doc="""
             What did you call the objects you want to measure?"""))
     group.append(
         "center_choice",
         cps.Choice("Object to use as center?",
                    C_ALL,
                    doc="""
             There are two ways to specify the center of the radial measurement:
             <ul>
             <li><i>These objects</i>: Use the centers of these objects for the 
             radial measurement.</li> 
             <li><i>Other objects</i>: Use the centers of other objects
             for the radial measurement.</li>
             </ul>
             For example, if measuring the radial distribution in a Cell
             object, you can use the center of the Cell objects (<i>These
             objects</i>) or you can use previously identified Nuclei objects as 
             the centers (<i>Other objects</i>)."""))
     group.append(
         "center_object_name",
         cps.ObjectNameSubscriber(
             "Select objects to use as centers",
             "None",
             doc=
             """<i>(Used only if "other objects" are selected for centers)</i><br>
             Select the object to use as the center, or select <i>None</i> to
             use the input object centers (which is the same as selecting
             <i>These objects</i> for the object centers)."""))
     if can_remove:
         group.append(
             "remover",
             cps.RemoveSettingButton("", "Remove this object", self.objects,
                                     group))
     self.objects.append(group)
Exemplo n.º 20
0
 def add_channel(self, can_remove=True):
     '''Add another channel to the channels list'''
     group = cps.SettingsGroup()
     group.can_remove = can_remove
     group.append(
         "channel_choice",
         cps.Choice("Channel number",
                    self.channel_names,
                    self.channel_names[len(self.channels) %
                                       len(self.channel_names)],
                    doc="""This setting chooses a channel to be processed.
         <i>Red: 1</i> is the first channel in a .TIF or the red channel
         in a traditional image file. <i>Green: 2</i> and <i>Blue: 3</i>
         are the second and third channels of a TIF or the green and blue
         channels in other formats. <i>Alpha: 4</i> is the transparency
         channel for image formats that support transparency and is
         channel # 4 for a .TIF file.
         
         <b>ColorToGray</b> will fail to process an image if you select
         a channel that is not supported by that image, for example, "5"
         for a .PNG file"""))
     group.append(
         "contribution",
         cps.Float("Relative weight of the channel",
                   1,
                   0,
                   doc='''<i>(Used only when combining channels)</i><br>
         Relative weights: If all relative weights are equal, all three 
         colors contribute equally in the final image. To weight colors relative 
         to each other, increase or decrease the relative weights.'''))
     group.append(
         "image_name",
         cps.ImageNameProvider(
             "Image name:",
             value="Channel%d" % (len(self.channels) + 1),
             doc="""This is the name of the grayscale image that holds
         the image data from the chosen channel"""))
     if group.can_remove:
         group.append(
             "remover",
             cps.RemoveSettingButton("Remove this channel", "Remove",
                                     self.channels, group))
     self.channels.append(group)
Exemplo n.º 21
0
 def add_step_parent(self, can_delete=True):
     group = cps.SettingsGroup()
     group.append(
         "step_parent_name",
         cps.Choice("Parent name", ["None"],
                    choices_fn=self.get_step_parents,
                    doc="""
         <i>(Used only if calculating distances to another parent)</i><br>
         Choose the name of the other parent. The <b>RelateObjects</b> module will 
         measure the distance from this parent to the child objects
         in the same manner as it does to the primary parents.
         You can only choose the parents or children of
         the parent object."""))
     if can_delete:
         group.append(
             "remove",
             cps.RemoveSettingButton("", "Remove this object",
                                     self.step_parent_names, group))
     self.step_parent_names.append(group)
Exemplo n.º 22
0
    def add_image(self, can_remove=True):
        '''Add an image + associated questions and buttons'''
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=True))

        group.append(
            "input_image_name",
            cps.ImageNameSubscriber("Select an additional image to tile",
                                    cps.NONE,
                                    doc="""
                                            Select an additional image to tile?"""
                                    ))
        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove above image",
                                        self.additional_images, group))
        self.additional_images.append(group)
Exemplo n.º 23
0
    def add_image(self):
        def default_cpimage_name(index):
            # the usual suspects
            names = ['DNA', 'Actin', 'Protein']
            if index < len(names):
                return names[index]
            return 'Channel%d' % (index + 1)

        group = cps.SettingsGroup()
        group.append(
            "image_name",
            cps.FileImageNameProvider('Name of this image in CellProfiler',
                                      default_cpimage_name(len(self.images)),
                                      doc="""
                        Give your images a meaningful name that you will use when referring to
                        these images in later modules.  Keep the following points in mind when deciding 
                        on an image name:
                        <ul>
                        <li>Image names must begin with a letter, which may be followed by any 
                        combination of letters, digits, and underscores. The following names are all invalid:
                        <ul>
                        <li>My.Cells</li>
                        <li>1stCells</li>
                        <li>1+1=3</li>
                        <li>@MyCell</li>
                        </ul>
                        </li>
                        <li>Names are not case senstive. Therefore, <i>OrigBlue</i>, <i>origblue</i>, and <i>ORIGBLUE</i>
                        will correspond to the same name, and unexpected results may ensue.</li>
                        <li>Although the names can be of any length in CellProfiler, you may want to avoid 
                        making the name too long especially if you are uploading to a database. The name is used
                        to generate the column header for a given measurement, and in MySQL, the total bytes used
                        for the column headers cannot exceed 64K. A warning will be generated later if this limit
                        has been exceeded.</li>
                        </ul>"""))
        group.append("image_specifier",
                     cps.Text("What substring is common to these images?", ""))
        group.append(
            "remover",
            cps.RemoveSettingButton("", "Remove this image", self.images,
                                    group))
        group.append("divider", cps.Divider(line=False))
        self.images.append(group)
Exemplo n.º 24
0
    def add_measurement(self, can_delete=True):
        '''Add another measurement to the filter list'''
        group = cps.SettingsGroup()
        group.append(
            "measurement",
            cps.Measurement('Select the measurement to filter by',
                            self.object_name.get_value,
                            "AreaShape_Area",
                            doc="""
            <i>(Used only if filtering using measurements)</i><br>
            See the <b>Measurements</b> modules help pages 
            for more information on the features measured."""))

        group.append(
            "wants_minimum",
            cps.Binary('Filter using a minimum measurement value?',
                       True,
                       doc="""
            <i>(Used only if Limits is selected for filtering method)</i><br>
            Check this box to filter the objects based on a minimum acceptable object
            measurement value. Objects which are greater than or equal to this value
            will be retained."""))

        group.append("min_limit", cps.Float('Minimum value', 0))

        group.append(
            "wants_maximum",
            cps.Binary('Filter using a maximum measurement value?',
                       True,
                       doc="""
            <i>(Used only if Limits is selected for filtering method)</i><br>
            Check this box to filter the objects based on a maximum acceptable object
            measurement value. Objects which are less than or equal to this value
            will be retained."""))

        group.append("max_limit", cps.Float('Maximum value', 1))
        group.append("divider", cps.Divider())
        self.measurements.append(group)
        if can_delete:
            group.append(
                "remover",
                cps.RemoveSettingButton("Remove above measurement", "Remove",
                                        self.measurements, group))
Exemplo n.º 25
0
    def add_object(self, can_remove=True):
        """Add a slot for another object"""
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))

        group.append(
            "name",
            cps.ObjectNameSubscriber("Select objects to measure",
                                     cps.NONE,
                                     doc="""
            Select the objects that you want to measure."""))

        if can_remove:
            group.append(
                "remove",
                cps.RemoveSettingButton("", "Remove this object",
                                        self.object_groups, group))

        self.object_groups.append(group)
Exemplo n.º 26
0
    def add_image(self, can_remove=True):
        '''Add an image + associated questions and buttons'''
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))

        group.append(
            "input_image_name",
            cps.ImageNameSubscriber("Select the additional image",
                                    cps.NONE,
                                    doc="""
                         Select the additional image to align?"""))

        group.append(
            "output_image_name",
            cps.ImageNameProvider("Name the output image",
                                  "AlignedBlue",
                                  doc="""
                         Enter the name of the aligned image?"""))

        group.append(
            "align_choice",
            cps.Choice("Select how the alignment is to be applied",
                       [A_SIMILARLY, A_SEPARATELY],
                       doc="""
                         An additional image can either be aligned similarly to the second one or
                         a separate alignment to the first image can be calculated:
                         <ul>
                         <li><i>%(A_SIMILARLY)s:</i> The same alignment measurements obtained from
                         the first two input images are applied to this additional image.</li>
                         <li><i>%(A_SEPARATELY)s:</i> A new set of alignment measurements are
                         calculated for this additional image using the alignment method
                         specified with respect to the first input image.</li>
                         </ul>""" % globals()))

        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove above image",
                                        self.additional_images, group))
        self.additional_images.append(group)
Exemplo n.º 27
0
 def add_object_cb(self, can_remove = True):      
     '''Add an object to the object_groups collection
     
     can_delete - set this to False to keep from showing the "remove"
     button for objects that must be present.
     '''
     group = cps.SettingsGroup()
     if can_remove:
         group.append("divider", cps.Divider(line=False))
     group.append('object_name', 
                  cps.ObjectNameSubscriber("Select objects to measure","None", doc="""
                  What did you call the objects from which you want to calculate moments? 
                  If you only want to calculat moments of
                  the image overall, you can remove all objects using the "Remove this object" button. 
                  <p>Objects specified here will have moments computed against <i>all</i> images specfied above, which
                  may lead to image-object combinations that are unneccesary. If you
                  do not want this behavior, use multiple <b>CalculateMoments</b>
                  modules to specify the particular image-object measures that you want.</p>"""))
     if can_remove:
         group.append("remover", cps.RemoveSettingButton("", "Remove this object", self.object_groups, group))
     self.object_groups.append(group)    
    def add_bin_count(self, can_remove = True):
        '''Add another radial bin count at which to measure'''
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider(line=False))

        group.append("wants_scaled", cps.Binary(
                "Scale the bins?", True,doc ="""
                <p>Select <i>%(YES)s</i> to divide the object radially into the number 
                of bins that you specify. </p>
                <p>Select <i>%(NO)s</i> to create the number of bins you specify based 
                on distance. For this option, the user will be 
                asked to specify a maximum distance so that each object will have the 
                same measurements (which might be zero for small objects) and so that 
                the measurements can be taken without knowing the maximum object radius 
                before the run starts.</p>"""%globals()))

        group.append("bin_count", cps.Integer(
                "Number of bins", 4, 2, doc="""
                Specify the number of bins that you want to use to measure 
                the distribution. Radial distribution is measured with respect to a series
                of concentric rings starting from the object center (or 
                more generally, between contours at a normalized distance
                from the object center). This number
                specifies the number of rings into which the distribution is to
                be divided. Additional ring counts can be specified
                by clicking the <i>Add another set of bins</i> button."""))

        group.append("maximum_radius", cps.Integer(
                "Maximum radius", 100, minval = 1,doc = """
                Specify the maximum radius for the unscaled bins. The unscaled binning 
                method creates the number of bins that you
                specify and creates equally spaced bin boundaries up to the maximum
                radius. Parts of the object that are beyond this radius will be
                counted in an overflow bin. The radius is measured in pixels."""))
        
        group.can_remove = can_remove
        if can_remove:
            group.append("remover", cps.RemoveSettingButton("", "Remove this set of bins", self.bin_counts, group))
        self.bin_counts.append(group)
Exemplo n.º 29
0
    def add_mapping(self):
        group = cps.SettingsGroup()
        group.append(
            "local_directory",
            cps.Text("Local root path",
                     cpprefs.get_default_image_directory(),
                     doc="""
                        Enter the path to files on this computer.
                        This is the root path on the local machine (i.e., the computer setting up
                        the batch files). If <b>CreateBatchFiles</b> finds
                        any pathname that matches the local root path at the begining, it will replace the
                        start with the cluster root path.
                        <p>For example, if you have mapped the remote cluster machine like this:<br><br>
                        <tt>Z:\your_data\images</tt> (on a Windows machine, for instance)<br><br>
                        and the cluster machine sees the same folder like this:<br><br>
                        <tt>/server_name/your_name/your_data/images</tt><br><br>
                        you would enter <tt>Z:</tt> here and <t>/server_name/your_name/</tt> 
                        for the cluster path in the next setting."""))

        group.append(
            "remote_directory",
            cps.Text("Cluster root path",
                     cpprefs.get_default_image_directory(),
                     doc="""
                        Enter the path to files on the cluster. This is the cluster 
                        root path, i.e., how the cluster machine sees the
                        top-most folder where your input/output files are stored.
                        <p>For example, if you have mapped the remote cluster machine like this:<br><br>
                        <tt>Z:\your_data\images</tt> (on a Windows machine, for instance)<br><br>
                        and the cluster machine sees the same folder like this:<br><br>
                        <tt>/server_name/your_name/your_data/images</tt><br><br>
                        you would enter <tt>Z:</tt> in the previous setting for the
                        local machine path and <t>/server_name/your_name/</tt> here. """
                     ))
        group.append(
            "remover",
            cps.RemoveSettingButton("", "Remove this path mapping",
                                    self.mappings, group))
        group.append("divider", cps.Divider(line=False))
        self.mappings.append(group)
    def add_image_measurement(self, can_remove=True):
        group = cps.SettingsGroup()
        if can_remove:
            group.append("divider", cps.Divider())

        group.append(
            "image_name",
            cps.ImageNameSubscriber(
                "Select the image to measure",
                "None",
                doc=
                '''What did you call the images whose intensity you want to measure? Choose an image name from the drop-down menu to calculate intensity for that
                                                            image. Use the <i>Add another image</i> button below to add additional images which will be
                                                            measured. You can add the same image multiple times if you want to measure
                                                            the intensity within several different objects.'''
            ))

        group.append(
            "wants_objects",
            cps.Binary(
                "Measure the intensity only from areas enclosed by objects?",
                False,
                doc=
                "Check this option to restrict the pixels being measured to those within the boundaries of an object."
            ))

        group.append(
            "object_name",
            cps.ObjectNameSubscriber(
                "Select the input objects",
                "None",
                doc=
                '''<i>(Used only when measuring intensity from area enclosed by objects)</i><br>What is the name of the objects to use? The intensity measurement will be restricted to within these objects.'''
            ))
        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image", self.images,
                                        group))
        self.images.append(group)