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))
Exemple #2
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.""")