Login  Register

Re: HistogramWindow to plugin...

Posted by Wayne Rasband on Nov 25, 2009; 6:13pm
URL: http://imagej.273.s1.nabble.com/MTrack2-plugin-bug-fix-tp3690333p3690336.html

 > I'd like a bit more control over the histogram plot in ImageJ
 > (size, text displayed, etc.) for some FLIM images I want to
 > publish. I though the quickest way to do this would be to
 > adapt the core HistogramWindow() code and convert it to a
 > plugin that I could customise.
 > http://rsbweb.nih.gov/ij/developer/source/ij/gui/
 > HistogramWindow.java.html
 >
 > I replaced: package ij.gui; with import ij.gui.*;
 >
 > and swapped the string: HistogramWindow
 >
 > With My_HistogramWindow And saved it as
 > My_HistogramWindow.java
 >
 > It compiles OK but I get an error *dialog* saying "Unable
 > to load plugin (ins)".
 >
 > Any suggestions as to whether there is a fix to this would
 > be much appreciated.

You're getting the "Unable to load plugin (ins)" error because the
HistogramWindow class does not implement the PlugIn interface. What you
need to do is create a plugin that includes HistogramWindow as an inner
class. It would look something like this:

    public class Histogram_Window implements PlugIn {

       public void run(String arg) {
          new HistogramWindow(IJ.getImage());
       }

       class HistogramWindow extends ImageWindow {
       ....
       }

    }

There is a working example at

   
http://rsb.info.nih.gov/ij/plugins/download/misc/Histogram_Window.java

-wayne