Exemple #1
0
    def create_settings(self):
        """Create the settings here and set the module name (initialization)

        """
        self.source_choice = cps.Choice("Use objects or an image as a mask?",
                                        [IO_OBJECTS, IO_IMAGE],
                                        doc="""\
You can mask an image in two ways:

-  *%(IO_OBJECTS)s*: Using objects created by another module (for
   instance **IdentifyPrimaryObjects**). The module will mask out all
   parts of the image that are not within one of the objects (unless you
   invert the mask).
-  *%(IO_IMAGE)s*: Using a binary image as the mask, where black
   portions of the image (false or zero-value pixels) will be masked
   out. If the image is not binary, the module will use all pixels whose
   intensity is greater than 0.5 as the mask’s foreground (white area).
   You can use **Threshold** instead to create a binary image with
   finer control over the intensity choice.
   """ % globals())

        self.object_name = cps.ObjectNameSubscriber("Select object for mask",
                                                    cps.NONE,
                                                    doc="""\
*(Used only if mask is to be made from objects)*

Select the objects you would like to use to mask the input image.
""")

        self.masking_image_name = cps.ImageNameSubscriber(
            "Select image for mask",
            cps.NONE,
            doc="""\
*(Used only if mask is to be made from an image)*

Select the image that you like to use to mask the input image.
""")

        self.image_name = cps.ImageNameSubscriber(
            "Select the input image",
            cps.NONE,
            doc="Select the image that you want to mask.")

        self.masked_image_name = cps.ImageNameProvider(
            "Name the output image",
            "MaskBlue",
            doc="Enter the name for the output masked image.")

        self.invert_mask = cps.Binary("Invert the mask?",
                                      False,
                                      doc="""\
This option reverses the foreground/background relationship of the mask.

-  Select "*%(NO)s*" to produce the mask from the foreground (white
   portion) of the masking image or the area within the masking objects.
-  Select "*%(YES)s*" to instead produce the mask from the *background*
   (black portions) of the masking image or the area *outside* the
   masking objects.
       """ % globals())
    def add_image(self, can_delete=True):
        '''Add an image and its settings to the list of images'''
        image_name = cps.ImageNameSubscriber(
            "Select the input image",
            cps.NONE,
            doc="Select the image to be corrected.")

        corrected_image_name = cps.ImageNameProvider(
            "Name the output image",
            "CorrBlue",
            doc="Enter a name for the corrected image.")

        illum_correct_function_image_name = cps.ImageNameSubscriber(
            "Select the illumination function",
            cps.NONE,
            doc="""\
Select the illumination correction function image that will be used to
carry out the correction. This image is usually produced by another
module or loaded as a .npy format image using the **Images** module or
**LoadSingleImage**.
""")

        divide_or_subtract = cps.Choice(
            "Select how the illumination function is applied",
            [DOS_DIVIDE, DOS_SUBTRACT],
            doc="""\
This choice depends on how the illumination function was calculated and
on your physical model of the way illumination variation affects the
background of images relative to the objects in images; it is also
somewhat empirical.

-  *%(DOS_SUBTRACT)s:* Use this option if the background signal is
   significant relative to the real signal coming from the cells. If you
   created the illumination correction function using
   *%(IC_BACKGROUND)s*, then you will want to choose
   *%(DOS_SUBTRACT)s* here.
-  *%(DOS_DIVIDE)s:* Choose this option if the signal to background
   ratio is high (the cells are stained very strongly). If you created
   the illumination correction function using *%(IC_REGULAR)s*, then
   you will want to choose *%(DOS_DIVIDE)s* here.
""" % globals())

        image_settings = cps.SettingsGroup()
        image_settings.append("image_name", image_name)
        image_settings.append("corrected_image_name", corrected_image_name)
        image_settings.append("illum_correct_function_image_name",
                              illum_correct_function_image_name)
        image_settings.append("divide_or_subtract", divide_or_subtract)
        image_settings.append("rescale_option", RE_NONE)

        if can_delete:
            image_settings.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image", self.images,
                                        image_settings))
        image_settings.append("divider", cps.Divider())
        self.images.append(image_settings)
    def add_image(self, can_delete=True):
        '''Add an image and its settings to the list of images'''
        image_name = cps.ImageNameSubscriber("Select the input image",
                                             cps.NONE,
                                             doc='''
            Select the image to be corrected.''')

        corrected_image_name = cps.ImageNameProvider("Name the output image",
                                                     "SpillCorrected",
                                                     doc='''
            Enter a name for the corrected image.''')

        spill_correct_function_image_name = cps.ImageNameSubscriber(
            "Select the spillover function image",
            cps.NONE,
            doc='''
            Select the spillover correction image that will be used to
            carry out the correction. This image is usually produced by the R
            software CATALYST or loaded as a .tiff format image using the
            <b>Images</b> module or
            <b>LoadSingleImage</b>.''')
        spill_correct_method = cps.Choice("Spillover correction method",
                                          [METHOD_LS, METHOD_NNLS],
                                          doc="""
            Select the spillover correction method.
            <ul>
            <li><i>%(METHOD_LS)s:</i> Gives the least square solution
            for overdetermined solutions or the exact solution for exactly 
            constraint problems. </li>
            <li><i>%(METHOD_NNLS)s:</i> Gives the non linear least squares
            solution: The most accurate solution, according to the least
            squares criterium, without any negative values.
            </li>
            </ul>
            """ % globals())

        image_settings = cps.SettingsGroup()
        image_settings.append("image_name", image_name)
        image_settings.append("corrected_image_name", corrected_image_name)
        image_settings.append("spill_correct_function_image_name",
                              spill_correct_function_image_name)
        image_settings.append("spill_correct_method", spill_correct_method)

        if can_delete:
            image_settings.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image", self.images,
                                        image_settings))
        image_settings.append("divider", cps.Divider())
        self.images.append(image_settings)
Exemple #4
0
    def create_settings(self):
        self.outputs = []
        self.stain_count = cps.HiddenCount(self.outputs, "Stain count")

        self.input_image_name = cps.ImageNameSubscriber(
            "Select the input color image",
            cps.NONE,
            doc="""\
Choose the name of the histologically stained color image
loaded or created by some prior module.""",
        )

        self.add_image(False)

        self.add_image_button = cps.DoSomething(
            "",
            "Add another stain",
            self.add_image,
            doc="""\
Press this button to add another stain to the list.

You will be able to name the image produced and to either pick
the stain from a list of pre-calibrated stains or to enter
custom values for the stain's red, green and blue absorbance.
            """,
        )
    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)
Exemple #6
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber("Select the input image",
                                                  cps.NONE,
                                                  doc="""\
Select the image that you want to perform a morphological operation on.
A grayscale image can be converted to binary using the **Threshold**
module. Objects can be converted to binary using the **ConvertToImage**
module.""")

        self.output_image_name = cps.ImageNameProvider(
            "Name the output image",
            "MorphBlue",
            doc=
            """Enter the name for the output image. It will be of the same type as the input image."""
        )

        self.add_button = cps.DoSomething("",
                                          "Add another operation",
                                          self.add_function,
                                          doc="""\
Press this button to add an operation that will be applied to the
image resulting from the previous operation(s). The module repeats
the previous operation the number of times you select before applying
the operation added by this button.""")

        self.functions = []
        self.add_function(can_remove=False)
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber("Select the input image",
                                                  cps.NONE)

        self.conversion_method = cps.Choice("Conversion method",
                                            [MEAN, MEDIAN, CUSTOMFUNCTION],
                                            doc='''
            How do you want to summarize the multichannel image?
            <ul>
            <li><i>%(MEAN)s:</i> Takes the mean.</li>
            <li><i>%(MEDIAN)s</i> Takes the median</li>
            <li><i>%(MEDIAN)s</i> Applies a cutstom python function</li>
            </ul>''' % globals())

        self.custom_function = cps.Text("Input a Python function",
                                        'np.mean',
                                        doc='''
        Can be a simple function as "np.max" (without ") or complicated as "functools.partial(np.percentile,q=80, axis=2)".
        functools is imported as convenience.
        ''')
        # The following settings are used for the combine option
        self.grayscale_name = cps.ImageNameProvider("Name the output image",
                                                    "OrigGray")

        # The alternative model:
        self.channels = []
    def create_settings(self):

        self.input_object_name = cps.ObjectNameSubscriber(
            "Select objects to measure",
            cps.NONE,
            doc=
            """Select the objects whose radial entropy you want to measure.""")

        self.input_image_name = cps.ImageNameSubscriber(
            "Select an image to measure",
            cps.NONE,
            doc="""Select the
            grayscale image you want to measure the entropy of.""")

        self.bin_number = cps.Integer(
            "Input number of bins",
            6,
            minval=3,
            maxval=60,
            doc=
            """Number of radial bins to divide your object into.  The minimum number
            of bins allowed is 3, the maximum number is 60.""")

        self.intensity_measurement = cps.Choice(
            "Which intensity measurement should be used?",
            ['Mean', 'Median', 'Integrated'],
            value='Mean',
            doc="""
            Whether each wedge's mean, median, or integrated intensity
            should be used to calculate the entropy.""")
Exemple #9
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="""
                                            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)
    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 *Add another image* button below to add additional
images to 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="""\
Select *%(YES)s* to measure only those pixels within an object type you
choose, identified by a prior module. Note that this module will
aggregate intensities across all objects in the image: to measure each
object individually, see **MeasureObjectIntensity** instead.
""" % globals()))

        group.append("object_name", cps.ObjectNameSubscriber(
                "Select the input objects", cps.NONE, doc="""\
*(Used only when measuring intensity from area occupied by objects)*

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)
    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',
                cps.NONE,
                doc=
                'Select an image to measure the correlation/colocalization in.'
            ))

        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)
    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 <i>%(IM_IMAGE)s</i>
            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 <i>%(IM_MEASUREMENT)s</i> and use the median intensity measurement as
            the denominator""" % globals()))

        group.append("image_name", cps.ImageNameSubscriber("", "", doc="""
            Selec the image that 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="""
            Enter the number that you would like to multiply the above image by. 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)
Exemple #13
0
 def create_settings(self):
     self.object_name = cps.ObjectNameSubscriber(
         "Input objects", "None",
         doc = """Enter the name of the objects whose population context is
         to be measured.""")
     self.operation = cps.Choice(
         "Operation",
         choices= (O_POPULATION_DENSITY, O_DISTANCE_TO_EDGE, O_BOTH),
         doc = """Select the measurements you wish to perform. The choices
         are:<br><ul>
         <li><i>%(O_POPULATION_DENSITY)s</i> - calculate the population
         density within a radius from each cell.</li>
         <li><i>%(O_DISTANCE_TO_EDGE)s</i> - calculate the distance of
         each cell from the edge of a binary mask.</li>
         <li><i>%(O_BOTH)s</i> - make both measurements"""%globals())
     self.radius = cps.Integer(
         "Search radius", 50, minval=1,
         doc = """Count all objects within this radius""")
     self.object_diameter = cps.Integer(
         "Object diameter", 20, minval=0,
         doc = """The average diameter of objects in the image. This number
         is used to adjust the area of the image to account for objects
         that would otherwise be excluded because they were touching
         the border.""")
     self.edge_image = cps.ImageNameSubscriber(
         "Edge image",
         doc = """For measuring distance to an edge, this is the reference
         image. Cell distances will be computed to the nearest foreground / 
         background edge in the reference image.""")
 def add_image(self, can_remove=True):
     group = cps.SettingsGroup()
     group.append("image_name",
                  cps.ImageNameSubscriber("Image name", "DNA"))
     if can_remove:
         group.append(
             "remover",
             cps.RemoveSettingButton("Remove object", "Remove", self.images,
                                     group))
     self.images.append(group)
Exemple #15
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)
Exemple #16
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)
Exemple #17
0
    def add_stack_channel_cb(self, can_remove=True):
        group = cps.SettingsGroup()
        default_color = DEFAULT_COLORS[len(self.stack_channels) %
                                       len(DEFAULT_COLORS)]
        group.append(
            "image_name",
            cps.ImageNameSubscriber(
                "Image name",
                cps.NONE,
                doc="""\
*(Used only if "%(SCHEME_STACK)s" or "%(SCHEME_COMPOSITE)s" is chosen)*

Select the input image to add to the stacked image.
""" % globals(),
            ),
        )
        group.append(
            "color",
            cps.Color(
                "Color",
                default_color,
                doc="""\
*(Used only if "%(SCHEME_COMPOSITE)s" is chosen)*

The color to be assigned to the above image.
""" % globals(),
            ),
        )
        group.append(
            "weight",
            cps.Float(
                "Weight",
                1.0,
                minval=0.5 / 255,
                doc="""\
*(Used only if "%(SCHEME_COMPOSITE)s" is chosen)*

The weighting of the above image relative to the others. The image’s
pixel values are multiplied by this weight before assigning the color.
""" % globals(),
            ),
        )

        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image",
                                        self.stack_channels, group),
            )
        self.stack_channels.append(group)
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber(
            "Select the input image",
            cps.NONE,
            doc=
            """Choose the name of the image to display in the object selection user interface."""
        )

        self.objects_name = cps.ObjectNameProvider(
            "Name the objects to be identified",
            "Cells",
            doc="""\
What do you want to call the objects that you identify using this module? You can use this name to
refer to your objects in subsequent modules.""")
    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)
 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 histogram 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_stack_channel_cb(self, can_remove=True):
        group = cps.SettingsGroup()
        group.append(
            "image_name",
            cps.ImageNameSubscriber("Image name",
                                    cps.NONE,
                                    doc='''\
Select the input image to add to the stacked image.
''' % globals()))

        if can_remove:
            group.append(
                "remover",
                cps.RemoveSettingButton("", "Remove this image",
                                        self.stack_channels, group))
        self.stack_channels.append(group)
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber('Select the input image',
                                                  cps.NONE)

        self.transformed_image_name = cps.ImageNameProvider(
            "Name the transformed image", 'DistanceImage')

        self.transform_method = cps.Choice('Select a transformation',
                                           [DISTANCE_BORDER],
                                           doc="""
            <ul>
            <li><i>%(DISTANCE_BORDER)s</i> Transforms the binary image to an
            eucledian distance transform to the border between the binary
            regions. The distance to a nonzero pixel will be positive, while
            the distance to a zero pixel will be negative.</li>
            </ul>""" % globals())
Exemple #23
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))
    def create_settings(self):
        #
        # The ImageNameSubscriber "subscribes" to all ImageNameProviders in
        # prior modules. Modules before yours will put images into CellProfiler.
        # The ImageSubscriber gives your user a list of these images
        # which can then be used as inputs in your module.
        #
        self.input_image_name = cps.ImageNameSubscriber(
            # The text to the left of the edit box
            "Input image name:",
            # HTML help that gets displayed when the user presses the
            # help button to the right of the edit box
            doc="""This is the image that the module operates on. You can
            choose any image that is made available by a prior module.
            <br>
            <b>ImageTemplate</b> will do something to this image.
            """)

        #
        # The ObjectNameSubscriber is similar - it will ask the user
        # which object to pick from the list of objects provided by
        # upstream modules.
        #
        self.input_object_name = cps.ObjectNameSubscriber(
            "Input object name",
            doc="""These are the objects that the module operates on.""")
        #
        # The radial degree is the "N" parameter in the Zernike - how many
        # inflection points there are, radiating out from the center. Higher
        # N means more features and a more detailed description
        #
        # The setting is an integer setting, bounded between 1 and 50.
        # N = 50 generates 1200 features!
        #
        self.radial_degree = cps.Integer(
            "Radial degree",
            10,
            minval=1,
            maxval=50,
            doc="""Calculate all Zernike features up to the given radial
            degree. The Zernike function is parameterized by a radial
            and azimuthal degree. The module will calculate all Zernike
            features for all azimuthal degrees up to and including the
            radial degree you enter here.""")
Exemple #25
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber(
            "Select the input image", cps.NONE, doc='''
            Select the image to be resized.''')

        self.cropped_image_name = cps.ImageNameProvider(
            "Name the output image", "CroppedImage", doc='''
            Enter the name of the cropped image.''')

        self.crop_random = cps.Choice(
            'Crop random or specified section?', [C_RANDOM, C_SPECIFIC, C_SEED_METADATA])

        self.crop_x = cps.Text(
            "X of upper left corner", '0', doc='''
            X position.''', metadata=True)

        self.crop_y = cps.Text(
            "Y of upper left corner", '0', doc='''
            Y position.''', metadata=True)

        self.crop_w = cps.Text(
            "W width", '100', doc='''
            Width of cut.''', metadata=True)

        self.crop_h = cps.Text(
            "H height", '100', doc='''
            Height of cut.''', metadata=True)

        self.seed_metadata = cps.Text(
            "Optional Random Seed", '', doc='''
            Sets the seed based on this string.
            Use the `Metadata` module to generate metadata and right click into the
            field to select metadata.''', metadata=True
        )

        self.separator = cps.Divider(line=False)

        self.additional_images = []

        self.additional_image_count = cps.HiddenCount(
            self.additional_images, "Additional image count")

        self.add_button = cps.DoSomething("", "Add another image",
                                          self.add_image)
Exemple #26
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber(
                "Select the input image", cps.NONE, doc="""
            Choose the name of the image to display in the object
            selection user interface.""")

        self.objects_name = cps.ObjectNameProvider(
                "Name the objects to be identified", "Cells", doc="""
            What do you want to call the objects
            that you identify using this module? You can use this name to
            refer to your objects in subsequent modules.""")

        self.wants_outlines = cps.Binary(
                "Retain outlines of the identified objects?", False, doc="""
            %(RETAINING_OUTLINES_HELP)s""" % globals())

        self.outlines_name = cps.OutlineNameProvider(
                "Name the outlines", "CellOutlines", doc="""
            %(NAMING_OUTLINES_HELP)s""" % globals())
    def create_settings(self):
        self.input_type = cps.Choice("Select the type of input",
                                     [IF_IMAGE, IF_OBJECTS], IF_IMAGE)

        self.image_name = cps.ImageNameSubscriber("Select input images",
                                                  cps.NONE)

        self.objects_name = cps.ObjectNameSubscriber(
            "Select the input objects",
            cps.NONE,
        )

        self.output_name = cps.ImageNameProvider(
            "Input the output image stack name",
            "BinStack",
            doc="""
            Input the output name.
            """ % globals())

        self.main_object_def = cps.Choice(
            "How should the main label be determined?",
            [SEL_MID, SEL_MAXAREA, SEL_PROVIDED],
            SEL_MID,
            doc="""
            The main object can be determined by 3 ways:
            <ul>
            <li> %(SEL_PROVIDED)s: Label provided by metadata or
            manual. <\li>
            <li> %(SEL_MAXAREA)s: Label with the biggest area is assumed to be
            the main label. <\li>
            <li> %(SEL_MID)s: The label closest to the middle of the image is
            considered the main label. <\li>
            <\ul>
            """ % globals())

        self.main_object_id = cps.Text("Indicate the object id",
                                       '1',
                                       doc="""
                Indicates the id from the main object.
                Rightclick to choose a metadata value.
                """ % globals(),
                                       metadata=True)
Exemple #28
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber(
            "Select the input image",cps.NONE, doc = '''
            Select the image to be resized.''')

        self.cropped_image_name = cps.ImageNameProvider(
            "Name the output image", "croppedImage", doc = '''
            Enter the name of the cropped image.''')

        self.crop_random = cps.Choice(
            'Crop random or specified section?', [C_RANDOM, C_SPECIFIC])

        self.crop_x = cps.Text(
            "X of upper left corner",  '0',  doc = '''
            X position.''', metadata=True)


        self.crop_y = cps.Text(
            "Y of upper left corner",   '0',  doc = '''
            Y position.''', metadata=True)


        self.crop_w = cps.Text(
            "W width",   '100',  doc = '''
            Width of cut.''', metadata=True)

        self.crop_h = cps.Text(
            "H height",   '100',  doc = '''
            Height of cut.''', metadata=True)



        self.separator = cps.Divider(line=False)

        self.additional_images = []

        self.additional_image_count = cps.HiddenCount(
            self.additional_images, "Additional image count")

        self.add_button = cps.DoSomething("", "Add another image",
                                          self.add_image)
Exemple #29
0
    def create_settings(self) -> None:
        self.input_mask_name = cps.ObjectNameSubscriber(
            text="Select the input mask", value=cps.NONE, doc="")

        self.padding = cps.Integer(text="Enter padding size (px)",
                                   value=20,
                                   doc="")

        self.output_mask_name = cps.ObjectNameProvider(
            text="Name the output mask",
            value="PaddedMask",
            doc="Enter the name of the output mask",
        )

        self.custom = cps.Binary(text="Use custom settings?",
                                 value="No",
                                 doc="Use custom settings")

        self.divider = cps.Divider(line=True)

        self.image_name = cps.ImageNameSubscriber(
            text="Select image to overlay on",
            value=cps.LEAVE_BLANK,
            doc="""\
Choose the image_name upon which a padded mask constructed from the input_mask is laid.
""",
            can_be_blank=True,
        )

        self.input_mask_color = cps.Color(
            text="Select the input mask color",
            value="red",
            doc="Select the input mask color",
        )

        self.output_mask_color = cps.Color(
            text="Select the output mask color",
            value="blue",
            doc="Select the output mask color",
        )
Exemple #30
0
            def __init__(self):
                self.__spacer = cps.Divider(line=True)
                self.__operand_choice = cps.Choice(
                        "Measure the area occupied in a binary image, or in objects?",
                        [O_BINARY_IMAGE, O_OBJECTS], doc="""
                    The area can be measured in two ways:
                    <ul>
                    <li><i>%(O_BINARY_IMAGE)s:</i> The area occupied by the foreground in a binary (black
                    and white) image.</li>
                    <li><i>%(O_OBJECTS)s:</i> The area occupied by previously-identified objects.</li>
                    </ul>""" % globals())

                self.__operand_objects = cps.ObjectNameSubscriber(
                        "Select objects to measure",
                        cps.NONE, doc="""
                    <i>(Used only if '%(O_OBJECTS)s' are to be measured)</i> <br>
                    Select the previously identified objects you would like to measure.""" % globals())

                self.__should_save_image = cps.Binary(
                        "Retain a binary image of the object regions?",
                        False, doc="""
                    <i>(Used only if '%(O_OBJECTS)s' are to be measured)</i><br>
                    Select <i>%(YES)s</i> if you would like to use a binary image
                    later in the pipeline, for example in <b>SaveImages</b>.  The image will
                    display the object area that you have measured as the foreground
                    in white and the background in black. """ % globals())

                self.__image_name = cps.ImageNameProvider(
                        "Name the output binary image",
                        "Stain", doc="""
                    <i>(Used only if the binary image of the objects is to be retained for later use in the pipeline)</i> <br>
                    Specify a name that will allow the binary image of the objects to be selected later in the pipeline.""")

                self.__binary_name = cps.ImageNameSubscriber(
                        "Select a binary image to measure",
                        cps.NONE, doc="""
                    <i>(Used only if '%(O_BINARY_IMAGE)s' is to be measured)</i><br>
                    This is a binary image created earlier in the pipeline,
                    where you would like to measure the area occupied by the foreground
                    in the image.""" % globals())