예제 #1
0
 def create_settings(self):
     """Create the settings for the module at startup.
     """ 
     self.image_groups = []
     self.image_count = cps.HiddenCount(self.image_groups)
     self.add_image_cb(can_remove = False)
     self.add_images = cps.DoSomething("", "Add another image",
                                       self.add_image_cb)
     self.image_divider = cps.Divider()  
     
     self.object_groups = []
     self.object_count = cps.HiddenCount(self.object_groups)
     self.add_object_cb(can_remove = True)
     self.add_objects = cps.DoSomething("", "Add another object",
                                        self.add_object_cb)
     self.object_divider = cps.Divider()                
     
     self.moms=cps.MultiChoice(
         "Moments to compute", MOM_ALL, MOM_ALL,
         doc = """Moments are statistics describing the distribution of values in the set of pixels of interest:
             <p><ul>
             <li><i>%(MOM_1)s</i> - the first image moment, which corresponds to the central value of the collection of pixels of interest.</li>
             <li><i>%(MOM_2)s</i> - the second image moment, which measures the amount of variation or dispersion of pixel values about its mean.</li>
             <li><i>%(MOM_3)s</i> - a scaled version of the third moment, which measures the asymmetry of the pixel values distribution about its mean.</li>
             <li><i>%(MOM_4)s</i> - a scaled version of the fourth moment, which measures the "peakedness" of the pixel values distribution.</li>
             </ul><p>
             Choose one or more moments to measure.""" % globals())    
 def create_settings(self):
     self.images = []
     self.objects = []
     self.bin_counts = []
     self.heatmaps = []
     self.image_count = cps.HiddenCount(self.images)
     self.object_count = cps.HiddenCount(self.objects)
     self.bin_counts_count = cps.HiddenCount(self.bin_counts)
     self.heatmap_count = cps.HiddenCount(self.heatmaps)
     self.add_image_button = cps.DoSomething("", "Add another image", self.add_image)
     self.spacer_1 = cps.Divider()
     self.add_object_button = cps.DoSomething("", "Add another object",
                                              self.add_object)
     self.spacer_2 = cps.Divider()
     self.add_bin_count_button = cps.DoSomething(
         "", "Add another set of bins", self.add_bin_count)
     self.spacer_3 = cps.Divider()
     self.add_heatmap_button = cps.DoSomething(
         "", "Add another heatmap display", self.add_heatmap,
         doc = """
     Press this button to add a display of one of the radial distribution
     measurements. Each radial band of the object is colored using a
     heatmap according to the measurement value for that band.""")
     self.add_image(can_remove = False)
     self.add_object(can_remove = False)
     self.add_bin_count(can_remove = False)
예제 #3
0
 def create_settings(self):
     """Create the settings variables here and name the module"""
     self.operands = []
     self.count = cps.HiddenCount(self.operands)
     self.add_operand(can_remove=False)
     self.add_operand_button = cps.DoSomething("", "Add another area", self.add_operand)
     self.remover = cps.DoSomething("", "Remove this area", self.remove)
예제 #4
0
 def create_settings(self):
     '''Create the initial settings for the module'''
     self.image_groups = []
     self.add_image(can_delete = False)
     self.spacer_1 = cps.Divider()
     self.add_image(can_delete = False)
     self.image_count = cps.HiddenCount(self.image_groups)
     
     self.add_image_button = cps.DoSomething("", 'Add another image', self.add_image)
     self.spacer_2 = cps.Divider()
     self.images_or_objects = cps.Choice('Select where to measure correlation',
                                         [M_IMAGES, M_OBJECTS, M_IMAGES_AND_OBJECTS], 
                                         doc = '''
                                         Do you want to measure the correlation over the whole image, 
                                         within objects, or both?
                                         Both methods measure correlation on a pixel by pixel basis.
                                         Selecting <i>Objects</i> will measure correlation only in those pixels previously
                                         identified as an object (you will be asked to specify which object).  Selecting 
                                         <i>Images</i> will measure correlation across all pixels in the images.
                                         <i>Images and objects</i> will calculate both measurements.''')
     
     self.object_groups = []
     self.add_object(can_delete = False)
     self.object_count = cps.HiddenCount(self.object_groups)
     
     self.spacer_2 = cps.Divider(line=True)
     
     self.add_object_button = cps.DoSomething("", 'Add another object', self.add_object)
예제 #5
0
    def create_settings(self):
        self.pipeline = None
        self.ipds = []
        self.imported_metadata = []
        module_explanation = [
            "The %s module optionally allows you to extract information" %
            self.module_name,
            "describing your images (i.e, metadata) which will be stored along",
            "with your measurements. This information can be contained in the",
            "file name and/or location, or in an external file."
        ]
        self.set_notes([" ".join(module_explanation)])

        self.wants_metadata = cps.Binary("Extract metadata?",
                                         False,
                                         doc="""
            Do your file or path names or file headers contain information\n
            (metadata) you would like to extract and store along with your 
            measurements?""")

        self.extraction_methods = []
        self.add_extraction_method(False)
        self.extraction_method_count = cps.HiddenCount(
            self.extraction_methods, "Extraction method count")
        self.add_extraction_method_button = cps.DoSomething(
            "Add another extraction method", "Add", self.add_extraction_method)
        self.table = cps.Table("", use_sash=True)
        self.update_table_button = cps.DoSomething("Update table", "Update",
                                                   self.update_table)
예제 #6
0
 def create_settings(self):
     '''Create the initial settings for the module'''
     self.image_groups = []
     self.add_image(can_delete = False)
     self.spacer_1 = cps.Divider()
     self.add_image(can_delete = False)
     self.image_count = cps.HiddenCount(self.image_groups)
     
     self.add_image_button = cps.DoSomething("", 'Add another image', self.add_image)
     self.spacer_2 = cps.Divider()
     self.images_or_objects = cps.Choice(
         'Select where to measure correlation',
         [M_IMAGES, M_OBJECTS, M_IMAGES_AND_OBJECTS], doc = '''
         You can measure the correlation in several ways: 
         <ul>
         <li><i>%(M_OBJECTS)s:</i> Measure correlation only in those pixels previously
         identified as an object. You will be asked to specify which object to measure from.</li>
         <li><i>%(M_IMAGES)s:</i> Measure the correlation across all pixels in the images.</li>
         <li><i>%(M_IMAGES_AND_OBJECTS)s:</i> Calculate both measurements above.</li>
         </ul>
         All methods measure correlation on a pixel by pixel basis.'''%globals())
     
     self.object_groups = []
     self.add_object(can_delete = False)
     self.object_count = cps.HiddenCount(self.object_groups)
     
     self.spacer_2 = cps.Divider(line=True)
     
     self.add_object_button = cps.DoSomething("", 'Add another object', self.add_object)
예제 #7
0
    def create_settings(self):
        '''Create the module settings and name the module'''
        self.wants_default_output_directory = cps.Binary(
            "Store batch files in default output folder?",
            True,
            doc="""
            Check this box to store batch files in the Default Output folder. Uncheck
            the box to enter the path to the folder that will be used to store
            these files.""")

        self.custom_output_directory = cps.Text(
            "Output folder path",
            cpprefs.get_default_output_directory(),
            doc="""
            Enter the path to the output folder.""")

        # Worded this way not because I am windows-centric but because it's
        # easier than listing every other OS in the universe except for VMS
        self.remote_host_is_windows = cps.Binary(
            "Are the cluster computers running Windows?",
            False,
            doc="""
            Check this box if the cluster computers are running one of the Microsoft
            Windows operating systems. If you check this box, <b>CreateBatchFiles</b> will
            modify all paths to use the Windows file separator (backslash &#92;). If you
            leave the box unchecked, <b>CreateBatchFiles</b> will modify all paths to use
            the Unix or Macintosh file separator (slash &#47;).""")

        self.batch_mode = cps.Binary("Hidden: in batch mode", False)
        self.distributed_mode = cps.Binary("Hidden: in distributed mode",
                                           False)
        self.default_image_directory = cps.Setting(
            "Hidden: default input folder at time of save",
            cpprefs.get_default_image_directory())
        self.revision = cps.Integer("Hidden: revision number", 0)
        self.from_old_matlab = cps.Binary("Hidden: from old matlab", False)
        self.acknowledge_old_matlab = cps.DoSomething(
            "Could not update CP1.0 pipeline to be compatible with CP2.0.  See module notes.",
            "OK", self.clear_old_matlab)
        self.mappings = []
        self.add_mapping()
        self.add_mapping_button = cps.DoSomething("",
                                                  "Add another path mapping",
                                                  self.add_mapping,
                                                  doc="""
            Use this option if another path must be mapped because there is a difference 
            between how the local computer sees a folder location vs. how the cluster 
            computer sees the folder location.""")

        self.check_path_button = cps.DoSomething(
            "Press this button to check pathnames on the remote server",
            "Check paths",
            self.check_paths,
            doc="""
            his button will start a routine that will ask the
            webserver to check whether the default input and default output
            folders exist. It will also check whether all remote
            path mappings exist.""")
    def create_settings(self):
        """Create the settings for the module at startup.
        
        The module allows for an unlimited number of measured objects, each
        of which has an entry in self.object_groups.
        """
        self.image_groups = []
        self.object_groups = []
        self.scale_groups = []
        self.image_count = cps.HiddenCount(self.image_groups)
        self.object_count = cps.HiddenCount(self.object_groups)
        self.scale_count = cps.HiddenCount(self.scale_groups)
        self.add_image_cb(can_remove=False)
        self.add_images = cps.DoSomething("", "Add another image",
                                          self.add_image_cb)
        self.image_divider = cps.Divider()
        self.add_object_cb(can_remove=True)
        self.add_objects = cps.DoSomething("", "Add another object",
                                           self.add_object_cb)
        self.object_divider = cps.Divider()
        self.add_scale_cb(can_remove=False)
        self.add_scales = cps.DoSomething("", "Add another scale",
                                          self.add_scale_cb)
        self.scale_divider = cps.Divider()

        self.wants_gabor = cps.Binary(
            "Measure Gabor features?",
            True,
            doc="""The Gabor features measure striped texture in an object. They
            take a substantial time to calculate. Check this setting to
            measure the Gabor features. Uncheck this setting to skip
            the Gabor feature calculation if it is not informative for your
            images""")
        self.gabor_angles = cps.Integer(
            "Number of angles to compute for Gabor",
            4,
            2,
            doc="""
        <i>(Used only if Gabor features are measured)</i><br>
        How many angles do you want to use for each Gabor texture measurement?
            The default value is 4 which detects bands in the horizontal, vertical and diagonal
            orientations.""")
        self.gabor_divider = cps.Divider()

        self.wants_tamura = cps.Binary(
            "Measure Tamura features?",
            True,
            doc="""The Tamura features are very ugly.""")
        self.tamura_feats = cps.MultiChoice("Features to compute",
                                            F_ALL,
                                            F_ALL,
                                            doc="""Tamura Features:
                        <p><ul>
                        <li><i>%(F_1)s</i> - bla.</li>
                        <li><i>%(F_2)s</i> - bla.</li>
                        <li><i>%(F_3)s</i> - bla.</li>
                        </ul><p>
                        Choose one or more features to compute.""" % globals())
예제 #9
0
 def create_settings(self):
     self.images = []
     self.add_image(can_remove = False)
     self.image_count = cps.HiddenCount(self.images)
     self.add_image_button = cps.DoSomething("", "Add another image", self.add_image)
     self.divider = cps.Divider()
     self.objects = []
     self.add_object(can_remove = False)
     self.add_object_button = cps.DoSomething("", "Add another object", self.add_object)
예제 #10
0
    def create_settings(self):
        """Create the settings for the module at startup.
        
        The module allows for an unlimited number of measured objects, each
        of which has an entry in self.object_groups.
        """
        self.image_groups = []
        self.object_groups = []
        self.scale_groups = []
        self.image_count = cps.HiddenCount(self.image_groups)
        self.object_count = cps.HiddenCount(self.object_groups)
        self.scale_count = cps.HiddenCount(self.scale_groups)
        self.add_image_cb(can_remove=False)
        self.add_images = cps.DoSomething("", "Add another image",
                                          self.add_image_cb)
        self.image_divider = cps.Divider()
        self.add_object_cb(can_remove=True)
        self.add_objects = cps.DoSomething("", "Add another object",
                                           self.add_object_cb)
        self.object_divider = cps.Divider()
        self.add_scale_cb(can_remove=False)
        self.add_scales = cps.DoSomething("", "Add another scale",
                                          self.add_scale_cb)
        self.scale_divider = cps.Divider()

        self.wants_gabor = cps.Binary(
            "Measure Gabor features?",
            True,
            doc=
            """The Gabor features measure striped texture in an object, and can 
            take a substantial time to calculate. 
            <p>Select <i>%(YES)s</i> to measure the Gabor features. Select 
            <i>%(NO)s</i> to skip the Gabor feature calculation if it is not 
            informative for your images.</p>""" % globals())

        self.gabor_angles = cps.Integer(
            "Number of angles to compute for Gabor",
            4,
            2,
            doc="""
            <i>(Used only if Gabor features are measured)</i><br>
            Enter the number of angles to use for each Gabor texture measurement.
            The default value is 4 which detects bands in the horizontal, vertical and diagonal
            orientations.""")
        self.images_or_objects = cps.Choice(
            "Measure images or objects?", [IO_IMAGES, IO_OBJECTS, IO_BOTH],
            value=IO_BOTH,
            doc="""This setting determines whether the module 
            computes image-wide measurements, per-object measurements or both.
            <ul>
            <li><i>%(IO_IMAGES)s:</i> Select if you only want to measure the texture of objects.</li>
            <li><i>%(IO_OBJECTS)s:</i> Select if your pipeline does not contain objects or if
            you only want to make per-image measurements.</li>
            <li><i>%(IO_BOTH)s:</i> Select to make both image and object measurements.</li>
            </ul>""" % globals())
예제 #11
0
    def create_settings(self):
        """Create the settings during initialization
        
        """
        self.directory = cps.DirectoryPath(
            "Input image file location",
            support_urls=True,
            doc=
            '''Select the folder containing the image(s) to be loaded. Generally, 
            it is best to store the image you want to load in either the Default Input or 
            Output Folder, so that the correct image is loaded into the pipeline 
            and typos are avoided. %(IO_FOLDER_CHOICE_HELP_TEXT)s
            
            <p>%(IO_WITH_METADATA_HELP_TEXT)s %(USING_METADATA_TAGS_REF)s For instance, 
            if you have a "Plate" metadata tag, and your single files are 
            organized in subfolders named with the "Plate" tag, you can select one of the 
            subfolder options and then specify a subfolder name of "\g&lt;Plate&gt;" 
            to get the files from the subfolder associated with that image's plate. The module will 
            substitute the metadata values for the current image set for any metadata tags in the 
            folder name. %(USING_METADATA_HELP_REF)s.</p>''' % globals())

        self.file_settings = []
        self.add_file(can_remove=False)
        self.add_button = cps.DoSomething("", "Add another image",
                                          self.add_file)
예제 #12
0
 def create_settings(self):
     self.flags = []
     self.flag_count = cps.HiddenCount(self.flags)
     self.add_flag_button = cps.DoSomething("", "Add another flag",
                                            self.add_flag)
     self.spacer_1 = cps.Divider()
     self.add_flag(can_delete=False)
예제 #13
0
 def create_settings(self):
     self.divider_top = cps.Divider(line=False)
     self.images = []
     self.image_count = cps.HiddenCount(self.images, "Image count")
     self.add_image(can_remove = False)
     self.add_button = cps.DoSomething("", "Add another image", self.add_image)
     self.divider_bottom = cps.Divider(line=False)
예제 #14
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 <b>ApplyThreshold</b> module. Objects can be
            converted to binary using the <b>ConvertToImage</b> 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)
예제 #15
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber("Select the input image",
                                                  "None", doc = '''What did you call the image to be resized?''')

        self.resized_image_name = cps.ImageNameProvider("Name the output image",
                                                        "ResizedBlue", doc = '''What do you want to call the resized image?''')

        self.size_method = cps.Choice("Select resizing method",
                                      R_ALL, doc = """How do you want to resize the image? 
                                      <ul><li><i>Resize by a fraction or multiple of the original size:</i> 
                                      Enter a single value which specifies the scaling. </li>
                                      <li><i>Resize by specifying desired final dimensions:</i></li> 
                                      Enter the new height and width of the resized image.</ul>""")

        self.resizing_factor = cps.Float("Resizing factor",
                                         .25, minval=0, doc = '''
                                         <i>(Used only if resizing by a fraction or multiple of the original size)</i><br>
                                         Numbers less than one (that is, fractions) will shrink the image; 
                                         numbers greater than one (that is, multiples) will enlarge the image.''')

        self.use_manual_or_image = cps.Choice("How do you want to specify the dimensions?",C_ALL, doc = """
                                        <i>(Used only if resizing by specifying the dimensions)</i><br>
                                        You have two options on how to resize your image:
                                        <ul>
                                        <li><i>Manual:</i> Specify the height and width of the output image.</li>
                                        <li><i>Image:</i> Specify an image and the input image will be resized
                                        to the same dimensions.</li>
                                        </ul>""")
        
        self.specific_width = cps.Integer("Width of the final image, in pixels", 100, minval=1, doc = '''
                                         <i>(Used only if resizing by specifying desired final dimensions)</i><br>
                                         Enter the desired width of the final image.''')

        self.specific_height = cps.Integer("Height of the final image, in pixels", 100, minval=1, doc = '''
                                         <i>(Used only if resizing by specifying desired final dimensions)</i><br>
                                         Enter the desired height of the final image.''')
        
        self.specific_image = cps.ImageNameSubscriber("Select the image with the desired dimensions", "None", doc = """"
                                        <i>(Used only if resizing by specifying desired final dimensions using an image)</i><br>
                                        The input image will be resized to the dimensions of the specified image.""")

        self.interpolation = cps.Choice("Interpolation method",
                                        I_ALL, doc = '''<ul><li><i>Nearest Neighbor:</i> Each output pixel is given the intensity of the nearest
                                        corresponding pixel in the input image.</li>
                                        <li><i>Bilinear:</i> Each output pixel is given the intensity of the weighted average
                                        of the 2x2 neighborhood at the corresponding position in the input image.</li>
                                        <li><i>Bicubic:</i> Each output pixel is given the intensity of the weighted average
                                        of the 4x4 neighborhood at the corresponding position in the input image.</li>
                                        </ul>''')
        
        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)
예제 #16
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber("Select the input image",
                                                  cps.NONE)

        self.probability_maps = []

        self.probability_map_count = cps.HiddenCount(self.probability_maps,
                                                     "Probability map count")

        self.add_probability_map(False)

        self.add_probability_button = cps.DoSomething(
            "",
            "Add another probability map",
            self.add_probability_map,
            doc="""
            Press this button to output another
            probability map image from the classifier. Ilastik can be trained
            to recognize any number of classes of pixels. You can generate
            probability maps for any or all of them simultaneously by adding
            more images.""")

        self.h5_directory = cps.DirectoryPath(
            "Classifier file location",
            dir_choices=[
                DEFAULT_OUTPUT_FOLDER_NAME, DEFAULT_INPUT_FOLDER_NAME,
                ABSOLUTE_FOLDER_NAME, DEFAULT_INPUT_SUBFOLDER_NAME,
                DEFAULT_OUTPUT_SUBFOLDER_NAME, URL_FOLDER_NAME
            ],
            allow_metadata=False,
            doc="""
                Select the folder containing the classifier file to be loaded.
            %(IO_FOLDER_CHOICE_HELP_TEXT)s""" % globals())

        def get_directory_fn():
            '''Get the directory for the CSV file name'''
            return self.h5_directory.get_absolute_path()

        def set_directory_fn(path):
            dir_choice, custom_path = self.h5_directory.get_parts_from_path(
                path)
            self.h5_directory.join_parts(dir_choice, custom_path)

        self.classifier_file_name = cps.FilenameText(
            "Classfier file name",
            cps.NONE,
            doc="""This is the name of the Classfier file.""",
            get_directory_fn=get_directory_fn,
            set_directory_fn=set_directory_fn,
            browse_msg="Choose Classifier file",
            exts=[("Classfier file (*.h5)", "*.h5"),
                  ("All files (*.*)", "*.*")])
        self.no_ilastik_msg = cps.HTMLText("",
                                           content="""
            ClassifyPixels cannot run on this platform because
            the necessary libraries are not available. ClassifyPixels is
            supported on 64-bit versions of Windows Vista, Windows 7 and
            Windows 8 and on Linux.""",
                                           size=(-1, 50))
 def create_settings(self):
     self.images = []
     self.objects = []
     self.bin_counts = []
     self.image_count = cps.HiddenCount(self.images)
     self.object_count = cps.HiddenCount(self.objects)
     self.bin_counts_count = cps.HiddenCount(self.bin_counts)
     self.add_image_button = cps.DoSomething("", "Add another image", self.add_image)
     self.spacer_1 = cps.Divider()
     self.add_object_button = cps.DoSomething("", "Add another object",
                                              self.add_object)
     self.spacer_2 = cps.Divider()
     self.add_bin_count_button = cps.DoSomething("",
                                                 "Add another set of bins", self.add_bin_count)
     self.add_image(can_remove = False)
     self.add_object(can_remove = False)
     self.add_bin_count(can_remove = False)
예제 #18
0
 def create_settings(self):
     '''Create the settings & name the module'''
     self.divider_top = cps.Divider(line=False)
     self.images = []
     self.add_image_measurement(can_remove=False)
     self.add_button = cps.DoSomething("", "Add another image",
                                       self.add_image_measurement)
     self.divider_bottom = cps.Divider(line=False)
예제 #19
0
    def create_settings(self):
        self.blank_image = cps.Binary(
                "Display outlines on a blank image?",
                False, doc="""
            Select <i>%(YES)s</i> to produce an
            image of the outlines on a black background.
            <p>Select <i>%(NO)s</i>, the module will overlay the
            outlines on an image of your choosing.</p>""" % globals())

        self.image_name = cps.ImageNameSubscriber(
                "Select image on which to display outlines", cps.NONE, doc="""
            <i>(Used only when a blank image has not been selected)</i> <br>
            Choose the image to serve as the background for the outlines.
            You can choose from images that were loaded or created by modules
            previous to this one.""")

        self.line_width = cps.Float(
                "Width of outlines", "1", doc="""
            Enter the width, in pixels, of the
            outlines to be displayed on the image.""")

        self.output_image_name = cps.ImageNameProvider(
                "Name the output image", "OrigOverlay", doc="""
            Enter the name of the output image with the outlines overlaid.
            This image can be selected in later modules (for instance, <b>SaveImages</b>).""")

        self.wants_color = cps.Choice(
                "Outline display mode",
                [WANTS_COLOR, WANTS_GRAYSCALE], doc="""
            Specify how to display the outline contours around
            your objects. Color outlines produce a clearer display for
            images where the cell borders have a high intensity, but take
            up more space in memory. Grayscale outlines are displayed with
            either the highest possible intensity or the same intensity
            as the brightest pixel in the image.""")

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

        self.max_type = cps.Choice(
                "Select method to determine brightness of outlines",
                [MAX_IMAGE, MAX_POSSIBLE], doc="""
            <i>(Used only when outline display mode is grayscale)</i> <br>
            The following options are possible for setting the intensity
            (brightness) of the outlines:
            <ul>
            <li><i>%(MAX_IMAGE)s:</i> Set the brighness to the
            the same as the brightest point in the image.</li>
            <li><i>%(MAX_POSSIBLE)s:</i> Set to the maximum
            possible value for this image format.</li>
            </ul>
            If your image is quite dim, then putting bright white lines
            onto it may not be useful. It may be preferable to make the
            outlines equal to the maximal brightness already occurring
            in the image.""" % globals())

        self.outlines = []
        self.add_outline(can_remove=False)
        self.add_outline_button = cps.DoSomething("", "Add another outline", self.add_outline)
예제 #20
0
    def create_settings(self):
        """Create the settings for the module at startup.
        
        The module allows for an unlimited number of measured objects, each
        of which has an entry in self.object_groups.
        """
        self.image_groups = []
        self.object_groups = []
        self.scale_groups = []
        self.image_count = cps.HiddenCount(self.image_groups)
        self.object_count = cps.HiddenCount(self.object_groups)
        self.scale_count = cps.HiddenCount(self.scale_groups)
        self.add_image_cb(can_remove=False)
        self.add_images = cps.DoSomething("", "Add another image",
                                          self.add_image_cb)
        self.image_divider = cps.Divider()
        self.add_object_cb(can_remove=True)
        self.add_objects = cps.DoSomething("", "Add another object",
                                           self.add_object_cb)
        self.object_divider = cps.Divider()
        self.add_scale_cb(can_remove=False)
        self.add_scales = cps.DoSomething("", "Add another scale",
                                          self.add_scale_cb)
        self.scale_divider = cps.Divider()

        self.wants_gabor = cps.Binary(
            "Measure Gabor features?",
            True,
            doc=
            """The Gabor features measure striped texture in an object, and can 
            take a substantial time to calculate. 
            <p>Select <i>%(YES)s</i> to measure the Gabor features. Select 
            <i>%(NO)s</i> to skip the Gabor feature calculation if it is not 
            informative for your images.</p>""" % globals())

        self.gabor_angles = cps.Integer(
            "Number of angles to compute for Gabor",
            4,
            2,
            doc="""
            <i>(Used only if Gabor features are measured)</i><br>
            Enter the number of angles to use for each Gabor texture measurement.
            The default value is 4 which detects bands in the horizontal, vertical and diagonal
            orientations.""")
예제 #21
0
 def add_flag(self, can_delete=True):
     group = cps.SettingsGroup()
     group.append("divider1", cps.Divider(line=False))
     group.append("measurement_settings", [])
     group.append("measurement_count", cps.HiddenCount(group.measurement_settings))
     group.append("category", cps.Text("Name the flag's category","Metadata", doc = '''
                             Name a measurement category in which the flag should reside. Metadata allows you to 
                             later group images in the <b>LoadImages</b> module based on the flag, if you load the 
                             flag data in a future pipeline via the <b>LoadData</b> module.  Otherwise, you might 
                             choose to have the flag stored in the "Image" category or using some other word you prefer.  
                             The flag is stored as a per-image measurement whose name is a combination of the
                             flag's category and feature name, underscore delimited. 
                             For instance, if the measurement category is
                             "Metadata" and the feature name is "QCFlag", then the default
                             measurement name would be "Metadata_QCFlag". %s'''%USING_METADATA_HELP_REF))
     
     group.append("feature_name", cps.Text("Name the flag","QCFlag", doc = '''
                             The flag is stored as a per-image measurement whose name is a combination of the
                             flag's category and feature name, underscore delimited. 
                             For instance, if the measurement category is
                             "Metadata" and the feature name is "QCFlag", then the default
                             measurement name would be "Metadata_QCFlag".'''))
     
     group.append("combination_choice", cps.Choice("Flag if any, or all, measurement(s) fails to meet the criteria?",
                             [ C_ANY, C_ALL], doc = '''
                             <ul>
                             <li><i>Any:</i> An image will be flagged if any of its measurements fail. This can be useful
                             for flagging images possessing multiple QC flaws; for example, you can flag all bright images and all out of focus images with one flag.</li>
                             <li><i>All:</i> A flag will only be assigned if all measurements fail.  This can be useful for flagging  images that possess only a combination
                             of QC flaws; for example, you can flag only images that are both bright and out of focus.</li>
                             </ul>'''))
     
     group.append(
         "wants_skip", cps.Binary("Skip image set if flagged?", False,
         doc = """You can skip the remainder of the pipeline for image sets
         that are flagged by checking this setting. If you check this
         setting, CellProfiler will not run subsequent modules in the
         pipeline on the images in any image set that is flagged. 
         CellProfiler will continue to process the pipeline if you leave
         the setting unchecked.<p>
         You may want to check this setting in order to filter out
         unwanted images during processing. For instance, you may want
         to exclude out of focus images when running 
         <b>CorrectIllumination_Calculate</b>. You can do this with a
         pipeline that measures image quality and flags inappropriate
         images before it runs <b>CorrectIllumination_Calculate</b>"""))
         
     group.append("add_measurement_button", 
                  cps.DoSomething("",
                                  "Add another measurement",
                                  self.add_measurement, group))
     self.add_measurement(group, False if not can_delete else True)
     if can_delete:
         group.append("remover", cps.RemoveSettingButton("", "Remove this flag", self.flags, group))
     group.append("divider2", cps.Divider(line=True))
     self.flags.append(group)
예제 #22
0
    def create_settings(self):
        self.omero_host = cps.Text(
            "Host address",
            DEFAULT_OMERO_HOST,
            doc=
            """Host address of an omero server. Can be an ip-address or a hostname."""
        )
        self.omero_port = cps.Integer("Port",
                                      DEFAULT_OMERO_PORT,
                                      doc="""Port of an omero server.""")
        self.omero_username = cps.Text(
            "Username",
            DEFAULT_OMERO_USERNAME,
            doc="""Username is required for login into an omero server.""")
        self.omero_password = cps.Text(
            "Password",
            DEFAULT_OMERO_PASSWORD,
            doc="""Password is required for login into an omero server.""")
        self.omero_object = cps.Choice("Object to load",
                                       [MS_IMAGE, MS_DATASET, MS_PLATE],
                                       DEFAULT_OMERO_OBJECT)
        self.omero_object_id = cps.Integer(
            "Object id",
            DEFAULT_OMERO_OBJECT_ID,
            doc=
            """This is a number that omero uses to uniquely identify an object, be it a dataset, plate, or image."""
        )
        self.load_channels = cps.DoSomething("", "Load channels from OMERO",
                                             self.load_channels)

        # All the omero images that are loaded are assumed to have
        # as many or more channels than the highest channel number
        # the user specifies.
        self.channels = []
        self.channel_count = cps.HiddenCount(self.channels, "Channel count")
        # Add the first channel
        self.add_channelfn(False)

        # Button for adding other channels
        self.add_channel = cps.DoSomething("", "Add another channel",
                                           self.add_channelfn)
예제 #23
0
    def create_settings(self):
        """Create the settings for the module at startup.
        """
        self.image_groups = []
        self.image_count = cps.HiddenCount(self.image_groups)
        self.add_image_cb(can_remove=False)
        self.add_images = cps.DoSomething("", "Add another image",
                                          self.add_image_cb)
        self.image_divider = cps.Divider()

        self.object_groups = []
        self.object_count = cps.HiddenCount(self.object_groups)
        self.add_object_cb(can_remove=True)
        self.add_objects = cps.DoSomething("", "Add another object",
                                           self.add_object_cb)
        self.object_divider = cps.Divider()

        self.bins_groups = []
        self.bins_count = cps.HiddenCount(self.bins_groups)
        self.add_bins_cb(can_remove=False)
        self.add_bins = cps.DoSomething("", "Add another histogram",
                                        self.add_bins_cb)
예제 #24
0
 def create_settings(self):
     self.how_to_remove = cps.Choice("Specify which images?",
                                     [C_REMOVE, C_KEEP],
                                     doc="""
         <ul><li>Choose <i>%s</i> to remove some images from memory and keep the rest.</li>
         <li>Choose <i>%s</i> to keep some images and remove the rest.</li></ul>"""
                                     % (C_REMOVE, C_KEEP))
     self.spacer_top = cps.Divider(line=False)
     self.image_names = []
     self.add_image(can_remove=False)
     self.spacer_bottom = cps.Divider(line=False)
     self.add_image_button = cps.DoSomething("", "Add another image",
                                             self.add_image)
예제 #25
0
    def create_settings(self):
        self.image_name = cps.ImageNameSubscriber("Select the input image",
                                                  "None")

        self.probability_maps = []

        self.probability_map_count = cps.HiddenCount(self.probability_maps,
                                                     "Probability map count")

        self.add_probability_map(False)

        self.add_probability_button = cps.DoSomething(
            "Add another probability map",
            "Add",
            self.add_probability_map,
            doc="""Press the <i>Add</i> button to output another
            probability map image from the classifier. Ilastik can be trained
            to recognize any number of classes of pixels. You can generate
            probability maps for any or all of them simultaneously by adding
            more images.""")

        self.h5_directory = cps.DirectoryPath(
            "Classifier file location",
            dir_choices=[
                DEFAULT_OUTPUT_FOLDER_NAME, DEFAULT_INPUT_FOLDER_NAME,
                ABSOLUTE_FOLDER_NAME, DEFAULT_INPUT_SUBFOLDER_NAME,
                DEFAULT_OUTPUT_SUBFOLDER_NAME
            ],
            allow_metadata=False,
            doc=
            """Select the folder containing the classifier file to be loaded. 
            %(IO_FOLDER_CHOICE_HELP_TEXT)s""" % globals())

        def get_directory_fn():
            '''Get the directory for the CSV file name'''
            return self.h5_directory.get_absolute_path()

        def set_directory_fn(path):
            dir_choice, custom_path = self.h5_directory.get_parts_from_path(
                path)
            self.h5_directory.join_parts(dir_choice, custom_path)

        self.classifier_file_name = cps.FilenameText(
            "Classfier file name",
            "None",
            doc="""This is the name of the Classfier file.""",
            get_directory_fn=get_directory_fn,
            set_directory_fn=set_directory_fn,
            browse_msg="Choose Classifier file",
            exts=[("Classfier file (*.h5)", "*.h5"),
                  ("All files (*.*)", "*.*")])
예제 #26
0
 def create_settings(self):
     self.outputs = []
     self.stain_count = cps.HiddenCount(self.outputs, "Stain count")
     self.input_image_name = cps.ImageNameSubscriber(
         "Color image", "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", "Add 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 precalibrated stains or to enter
         custom values for the stain's red, green and blue absorbance.""")
 def create_settings(self):
     """Create the settings for the module at startup and set the module name
     
     The module allows for an unlimited number of measured objects, each
     of which has an entry in self.object_groups.
     """ 
     self.object_groups = []
     self.add_object(can_remove = False)
     self.spacer = cps.Divider(line = True)
     self.add_objects = cps.DoSomething("", "Add another object",self.add_object)
     self.calculate_zernikes = cps.Binary('Calculate the Zernike features?',True, doc="""
                                         Check this box to calculate the Zernike shape features. Since the
                                         first 10 Zernike polynomials (from order 0 to order 9) are
                                         calculated, this operation can be time consuming if the image
                                         contains a lot of objects.""")
예제 #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)
예제 #29
0
 def create_settings(self):
     self.how_to_remove = cps.Choice(
         "Specify which images?",
         [C_REMOVE, C_KEEP], doc="""
         You can select from the following options:
         <ul>
         <li><i>%(C_REMOVE)s:</i> Remove some images from memory and keep the rest.</li>
         <li><i>%(C_KEEP)s:</i> Keep some images and remove the rest.</li>
         </ul>"""%globals())
     
     self.spacer_top = cps.Divider(line=False)
     self.image_names = []
     self.add_image(can_remove = False)
     self.spacer_bottom = cps.Divider(line=False)
     self.add_image_button = cps.DoSomething("", "Add another image",
                                             self.add_image)
예제 #30
0
    def create_settings(self):
        self.pipeline = None
        self.metadata_keys = {}

        module_explanation = [
            "The %s module optionally allows you to split your list of images into image subsets"
            % self.module_name,
            "(groups) which will be processed independently of each other. Examples of",
            "groupings include screening batches, microtiter plates, time-lapse movies, etc."
        ]
        self.set_notes([" ".join(module_explanation)])

        self.wants_groups = cps.Binary("Do you want to group your images?",
                                       False,
                                       doc="""
            Select <i>%(YES)s</i> if you need to split your images into image subsets (or <i>groups</i>) such that each
            group is processed independently of each other. See the main module
            help for more details.""" % globals())

        self.grouping_text = cps.HTMLText("",
                                          content="""
            Each unique metadata value (or combination of values) 
            will be defined as a group""",
                                          size=(30, 2))
        self.grouping_metadata = []
        self.grouping_metadata_count = cps.HiddenCount(
            self.grouping_metadata, "grouping metadata count")
        self.add_grouping_metadata(can_remove=False)
        self.add_grouping_metadata_button = cps.DoSomething(
            "", "Add another metadata item", self.add_grouping_metadata)

        self.grouping_list = cps.Table("Grouping list",
                                       min_size=(300, 100),
                                       doc="""
            This list shows the unique values of the selected metadata under the "Group" column; each of the unique values 
            comprises a group. The "Count" column shows the number of image sets that included in a given group; this
            is useful as a "sanity check", to make sure that the expected number of images are present. For example,
            if you are grouping by per-plate metadata from a 384-well assay with 2 sites per well consisting of 3 plates, 
            you would expect to see 3 groups (each from the 3 unique plate IDs), with 384 wells &times; 2 sites/well 
            = 768 image sets in each.""")

        self.image_set_list = cps.Table("Image sets",
                                        doc="""
            This list displays the file name and location of each of the image sets that comprise the
            group. For example, if you are grouping by per-plate metadata from a 384-well assay with 2 sites per well 
            consisting of 3 plates, you would expect to see a table consisting of 3 plates &times; 384 wells/plate 
            &times;2 sites/well = 2304 rows.""")