The subject says it all...
The plugin pre-processes an image in preparation for some manual steps, some of which will include manual editing with these tools to remove background objects. There are many images, and I’d like to set up the tools automatically so the user will not need to do this step for each one. Thanks! |
Pencil, brush, eraser tools are macro-based tools defined in the startup
macros file StartupMacros.txt or in the DrawingTools.txt macro set. For example the paintbrush tool options macro is: macro "Paintbrush Tool - C037La077Ld098L6859L4a2fL2f4fL3f99L5e9bL9b98L6888L5e8dL888c" { getCursorLoc(x, y, z, flags); if (flags&alt!=0) setColorToBackgound(); draw(brushWidth); } The brush width is currently only set when the macro set is installed or when you run the "Paintbrush Tool Options..." macro. macro 'Paintbrush Tool Options...' { brushWidth = getNumber("Brush Width (pixels):", brushWidth); call("ij.Prefs.set", "startup.brush", brushWidth); } You can modify the paint brush tool macro so that it reads the preference everytime it is started: macro "Paintbrush Tool - C037La077Ld098L6859L4a2fL2f4fL3f99L5e9bL9b98L6888L5e8dL888c" { brushWidth = call("ij.Prefs.get", "startup.brush", "10"); getCursorLoc(x, y, z, flags); if (flags&alt!=0) setColorToBackgound(); draw(brushWidth); } Then you can have your Java Plug-in modify this preference as shown in: http://rsb.info.nih.gov/ij/plugins/preference-demo.html Ideally, you could have your plugin installing it's own version of the desired tools, so that you do not have to distribute e.g. a modified startup macro set with you plugin. ij.plugin.MacroInstaller.install(string) does this. Jerome. On 10 November 2011 04:11, Bob <[hidden email]> wrote: > The subject says it all... > > The plugin pre-processes an image in preparation for some manual steps, > some of which will include manual editing with these tools to remove > background objects. There are many images, and I’d like to set up the > tools automatically so the user will not need to do this step for each one. > > Thanks! > |
Thanks, Jerome!
Bob ----- Original Message ----- From: "Jerome Mutterer" <[hidden email]> To: [hidden email] Sent: Thursday, November 10, 2011 2:29:40 AM Subject: Re: How do I set Pencil Width, Brush Width, or Eraser Width from within a Java Plug-in? Pencil, brush, eraser tools are macro-based tools defined in the startup macros file StartupMacros.txt or in the DrawingTools.txt macro set. For example the paintbrush tool options macro is: macro "Paintbrush Tool - C037La077Ld098L6859L4a2fL2f4fL3f99L5e9bL9b98L6888L5e8dL888c" { getCursorLoc(x, y, z, flags); if (flags&alt!=0) setColorToBackgound(); draw(brushWidth); } The brush width is currently only set when the macro set is installed or when you run the "Paintbrush Tool Options..." macro. macro 'Paintbrush Tool Options...' { brushWidth = getNumber("Brush Width (pixels):", brushWidth); call("ij.Prefs.set", "startup.brush", brushWidth); } You can modify the paint brush tool macro so that it reads the preference everytime it is started: macro "Paintbrush Tool - C037La077Ld098L6859L4a2fL2f4fL3f99L5e9bL9b98L6888L5e8dL888c" { brushWidth = call("ij.Prefs.get", "startup.brush", "10"); getCursorLoc(x, y, z, flags); if (flags&alt!=0) setColorToBackgound(); draw(brushWidth); } Then you can have your Java Plug-in modify this preference as shown in: http://rsb.info.nih.gov/ij/plugins/preference-demo.html Ideally, you could have your plugin installing it's own version of the desired tools, so that you do not have to distribute e.g. a modified startup macro set with you plugin. ij.plugin.MacroInstaller.install(string) does this. Jerome. On 10 November 2011 04:11, Bob <[hidden email]> wrote: > The subject says it all... > > The plugin pre-processes an image in preparation for some manual steps, > some of which will include manual editing with these tools to remove > background objects. There are many images, and I’d like to set up the > tools automatically so the user will not need to do this step for each one. > > Thanks! > |
Free forum by Nabble | Edit this page |