Esempio n. 1
0
    def __init__(self,
                 frame,
                 config,
                 row=0,
                 module_name="Segmentation Post Processing",
                 font=None,
                 show_all=True):
        self.post_frame = tkinter.Frame(frame)
        self.post_style = {
            "bg": "white",
            "padx": 0,
            "pady": 0,
            "row_weights": [1, 1, 1, 1],
            "columns_weights": [1],
            "height": 4,
        }

        self.post_frame["bg"] = self.post_style["bg"]
        self.font = font
        self.post_frame.grid(column=0,
                             row=row,
                             padx=self.post_style["padx"],
                             pady=self.post_style["pady"],
                             sticky=stick_all)

        [
            tkinter.Grid.rowconfigure(self.post_frame, i, weight=w)
            for i, w in enumerate(self.post_style["row_weights"])
        ]
        [
            tkinter.Grid.columnconfigure(self.post_frame, i, weight=w)
            for i, w in enumerate(self.post_style["columns_weights"])
        ]

        super().__init__(self.post_frame, module_name, font=font)
        self.module = "cnn_postprocessing"
        self.config = config

        self.show = tkinter.BooleanVar()
        if show_all:
            self.show.set(True)
        else:
            self.show.set(self.config[self.module]["state"])

        self.checkbox["variable"] = self.show
        self.checkbox["command"] = self.show_options

        self.obj_collection = []
        self.custom_key = {
            "tiff":
            MenuEntry(self.post_frame,
                      text="Convert to tiff: ",
                      row=1,
                      column=0,
                      menu=["True", "False"],
                      default=self.config[self.module]["tiff"],
                      font=font),
        }

        self.show_options()
    def __init__(self,
                 frame,
                 config,
                 col=0,
                 module_name="segmentation",
                 font=None,
                 show_all=True):
        self.segmentation_frame = tkinter.Frame(frame)
        self.segmentation_style = {
            "bg": "white",
            "padx": 10,
            "pady": 10,
            "row_weights": [2, 1, 1, 1, 1, 1, 1, 1, 1, 1],
            "columns_weights": [1],
            "height": 4,
        }

        self.segmentation_frame["bg"] = self.segmentation_style["bg"]
        self.segmentation_frame.grid(column=col,
                                     row=0,
                                     padx=self.segmentation_style["padx"],
                                     pady=self.segmentation_style["pady"],
                                     sticky=stick_new)

        [
            tkinter.Grid.rowconfigure(self.segmentation_frame, i, weight=w)
            for i, w in enumerate(self.segmentation_style["row_weights"])
        ]
        [
            tkinter.Grid.columnconfigure(self.segmentation_frame, i, weight=w)
            for i, w in enumerate(self.segmentation_style["columns_weights"])
        ]

        super().__init__(self.segmentation_frame, module_name, font)
        self.module = "segmentation"
        self.config = config
        self.show = tkinter.BooleanVar()

        if show_all:
            self.show.set(True)
        else:
            self.show.set(self.config[self.module]["state"])

        self.checkbox["variable"] = self.show
        self.checkbox["command"] = self.show_options

        self.obj_collection = []
        self.custom_key = {
            "name":
            MenuEntry(self.segmentation_frame,
                      text="Algorithm: ",
                      row=1,
                      column=0,
                      menu={"MultiCut", "GASP", "MutexWS", "DtWatershed"},
                      is_segmentation=True,
                      default=config[self.module]["name"],
                      font=font),
            "save_directory":
            SimpleEntry(self.segmentation_frame,
                        text="Save Directory: ",
                        row=2,
                        column=0,
                        _type=str,
                        _font=font),
            "beta":
            SliderEntry(self.segmentation_frame,
                        text="Under-/Over-segmentation factor: ",
                        row=3,
                        column=0,
                        is_not_in_dtws=True,
                        _type=float,
                        _font=font),
            "ws_2D":
            MenuEntry(self.segmentation_frame,
                      text="Run Watershed in 2D: ",
                      row=4,
                      column=0,
                      menu={"True", "False"},
                      default=config[self.module]["ws_2D"],
                      font=font),
            "ws_threshold":
            SliderEntry(self.segmentation_frame,
                        text="CNN Predictions Threshold: ",
                        row=5,
                        column=0,
                        _type=float,
                        _font=font),
            "ws_sigma":
            SliderEntry(self.segmentation_frame,
                        text="Watershed Seeds Sigma: ",
                        row=6,
                        column=0,
                        data_range=(0, 5, 0.2),
                        _type=float,
                        _font=font),
            "ws_w_sigma":
            SliderEntry(self.segmentation_frame,
                        text="Watershed Boundary Sigma: ",
                        row=7,
                        column=0,
                        data_range=(0, 5, 0.2),
                        _type=float,
                        _font=font),
            "ws_minsize":
            SimpleEntry(self.segmentation_frame,
                        text="Superpixels Minimum Size (voxels): ",
                        row=8,
                        column=0,
                        _type=int,
                        _font=font),
            "post_minsize":
            SimpleEntry(self.segmentation_frame,
                        text="Cell Minimum Size (voxels): ",
                        row=9,
                        column=0,
                        _type=int,
                        _font=font),
        }

        self.show_options()
    def __init__(self,
                 frame,
                 config,
                 col=0,
                 module_name="preprocessing",
                 font=None,
                 show_all=True):
        self.prediction_frame = tkinter.Frame(frame)
        self.prediction_style = {
            "bg": "white",
            "padx": 10,
            "pady": 10,
            "row_weights": [2, 1, 1, 1, 1],
            "columns_weights": [1],
            "height": 4,
        }

        self.prediction_frame["bg"] = self.prediction_style["bg"]
        self.prediction_frame.grid(column=col,
                                   row=0,
                                   padx=self.prediction_style["padx"],
                                   pady=self.prediction_style["pady"],
                                   sticky=stick_new)

        [
            tkinter.Grid.rowconfigure(self.prediction_frame, i, weight=w)
            for i, w in enumerate(self.prediction_style["row_weights"])
        ]
        [
            tkinter.Grid.columnconfigure(self.prediction_frame, i, weight=w)
            for i, w in enumerate(self.prediction_style["columns_weights"])
        ]

        super().__init__(self.prediction_frame, module_name, font=font)
        self.module = "cnn_prediction"
        self.config = config
        self.show = tkinter.BooleanVar()

        if show_all:
            self.show.set(True)
        else:
            self.show.set(self.config[self.module]["state"])

        self.checkbox["variable"] = self.show
        self.checkbox["command"] = self.show_options

        self.obj_collection = []
        self.custom_key = {
            "model_name":
            MenuEntry(self.prediction_frame,
                      text="Model Name: ",
                      row=1,
                      column=0,
                      menu=list_models(),
                      default=config[self.module]["model_name"],
                      is_model=True,
                      font=font),
            "patch":
            ListEntry(self.prediction_frame,
                      text="Patch Size: ",
                      row=2,
                      column=0,
                      type=int,
                      font=font),
            "stride":
            MenuEntry(self.prediction_frame,
                      text="Stride: ",
                      row=3,
                      column=0,
                      menu=[STRIDE_ACCURATE, STRIDE_BALANCED, STRIDE_DRAFT],
                      default=config[self.module]["stride"],
                      font=font),
            "device":
            MenuEntry(self.prediction_frame,
                      text="Device Type: ",
                      row=4,
                      column=0,
                      menu=["cuda", "cpu"],
                      default=config[self.module]["device"],
                      font=font),
        }

        self.show_options()
    def __init__(self,
                 frame,
                 config,
                 col=0,
                 module_name="preprocessing",
                 font=None,
                 show_all=True):
        self.preprocessing_frame = tkinter.Frame(frame)
        self.preprocessing_style = {
            "bg": "white",
            "padx": 10,
            "pady": 10,
            "row_weights": [2, 1, 1, 1, 1],
            "columns_weights": [1],
            "height": 4,
        }

        self.preprocessing_frame["bg"] = self.preprocessing_style["bg"]
        self.preprocessing_frame.grid(column=col,
                                      row=0,
                                      padx=self.preprocessing_style["padx"],
                                      pady=self.preprocessing_style["pady"],
                                      sticky=stick_new)

        [
            tkinter.Grid.rowconfigure(self.preprocessing_frame, i, weight=w)
            for i, w in enumerate(self.preprocessing_style["row_weights"])
        ]
        [
            tkinter.Grid.columnconfigure(self.preprocessing_frame, i, weight=w)
            for i, w in enumerate(self.preprocessing_style["columns_weights"])
        ]

        super().__init__(self.preprocessing_frame, module_name, font=font)
        self.module = "preprocessing"
        self.config = config

        self.show = tkinter.BooleanVar()
        if show_all:
            self.show.set(True)
        else:
            self.show.set(self.config[self.module]["state"])

        self.checkbox["variable"] = self.show
        self.checkbox["command"] = self.show_options

        self.obj_collection = []
        self.custom_key = {
            "save_directory":
            SimpleEntry(self.preprocessing_frame,
                        text="Save Directory: ",
                        row=1,
                        column=0,
                        _type=str,
                        _font=font),
            "factor":
            RescaleEntry(self.preprocessing_frame,
                         text="Rescaling (z,x,y):",
                         row=2,
                         column=0,
                         font=font),
            "order":
            MenuEntry(self.preprocessing_frame,
                      text="Interpolation: ",
                      row=3,
                      column=0,
                      menu=[0, 1, 2],
                      default=2,
                      font=font),
            "filter":
            FilterEntry(self.preprocessing_frame,
                        text="Filter (Optional): ",
                        row=4,
                        column=0,
                        font=font),
        }

        self.show_options()