def binary_morph_reconstruct(self, event=None, *, dilation):
        filepath = filedialog.askopenfilename(
            title=i18n['select_template_image'],
            initialdir=self.recent_dir,
            filetypes=self.filetypes)
        if not filepath:
            return

        try:
            im = Image.open(filepath)
            assert get_image_mode(im) != ImageMode.INVALID
        except:
            logger.exception(i18n['invalid_image'])
            messagebox.showerror(i18n['open_failed'], i18n['invalid_image'])
        else:
            transformation.check_binary_image(self.im)
            transformation.check_binary_image(im)
            mid = MatrixInputDialog(
                self, i18n['morph_reconstruct'], i18n['se'],
                transformation.binary_simple_se_example,
                functools.partial(transformation.binary_morph_reconstruct,
                                  im,
                                  dilation=dilation))
            mid()
            if mid.apply:
                self.version.add(self.im)
 def binary_skeletonization(self, event=None):
     transformation.check_binary_image(self.im)
     mid = MatrixInputDialog(self, i18n['skeletonization'], i18n['se'],
                             transformation.binary_simple_se_example,
                             transformation.binary_skeletonization)
     mid()
     if mid.apply:
         self.version.add(self.im)
 def binary_thickening(self, event=None):
     transformation.check_binary_image(self.im)
     mid = MatrixInputDialog(self, i18n['thickening'], i18n['se'],
                             transformation.binary_thickening_se_example,
                             transformation.binary_thickening)
     mid()
     if mid.apply:
         self.version.add(self.im)