示例#1
0
    def do_imagej(self, workspace, when=None):
        if when == D_FIRST_IMAGE_SET:
            choice = self.prepare_group_choice.value
            command = self.prepare_group_command
            macro = self.prepare_group_macro.value
            d = self.pre_command_settings_dictionary
        elif when == D_LAST_IMAGE_SET:
            choice = self.post_group_choice.value
            command = self.post_group_command
            macro = self.post_group_macro.value
            d = self.pre_command_settings_dictionary
        else:
            choice = self.command_or_macro.value
            command = self.command
            macro = self.macro.value
            d = self.command_settings_dictionary

        if choice == CM_COMMAND:
            self.execute_advanced_command(workspace, command, d)
        elif choice == CM_SCRIPT:
            macro = workspace.measurements.apply_metadata(macro)
            script_service = ij2.get_script_service(get_context())
            factory = script_service.getByName(self.macro_language.value)
            engine = factory.getScriptEngine()
            engine.put("ImageJ", get_context())
            result = engine.evalS(macro)
        elif choice == CM_MACRO:
            macro = workspace.measurements.apply_metadata(macro)
            ijmacros.execute_macro(macro)

        if choice != CM_NOTHING and (not cpprefs.get_headless()) and self.pause_before_proceeding:
            import wx

            wx.MessageBox("Please edit the image in ImageJ and hit OK to proceed", "Waiting for ImageJ")
示例#2
0
    def do_imagej(self, workspace, when=None):
        if when == D_FIRST_IMAGE_SET:
            choice = self.prepare_group_choice.value
            command = self.prepare_group_command
            macro = self.prepare_group_macro.value
            d = self.pre_command_settings_dictionary
        elif when == D_LAST_IMAGE_SET:
            choice = self.post_group_choice.value
            command = self.post_group_command
            macro = self.post_group_macro.value
            d = self.pre_command_settings_dictionary
        else:
            choice = self.command_or_macro.value
            command = self.command
            macro = self.macro.value
            d = self.command_settings_dictionary

        if choice == CM_COMMAND:
            self.execute_advanced_command(workspace, command, d)
        elif choice == CM_SCRIPT:
            macro = workspace.measurements.apply_metadata(macro)
            script_service = ij2.get_script_service(get_context())
            factory = script_service.getByName(self.macro_language.value)
            engine = factory.getScriptEngine()
            engine.put("ImageJ", get_context())
            result = engine.evalS(macro)
        elif choice == CM_MACRO:
            macro = workspace.measurements.apply_metadata(macro)
            ijmacros.execute_macro(macro)

        if (choice != CM_NOTHING and (not cpprefs.get_headless())
                and self.pause_before_proceeding):
            import wx
            wx.MessageBox(
                "Please edit the image in ImageJ and hit OK to proceed",
                "Waiting for ImageJ")
示例#3
0
    def execute_macro(self, macro_text):
        '''execute a macro in ImageJ

        macro_text - the macro program to be run
        '''
        ijmacros.execute_macro(macro_text)
示例#4
0
    def execute_macro(self, macro_text):
        '''execute a macro in ImageJ

        macro_text - the macro program to be run
        '''
        ijmacros.execute_macro(macro_text)