-1

I need to run a command from fiji menu in java code developed using netbeans IDE. The command is Image--Color--RGB to CIELAB.

I used "IJ.run" to run commands from ImageJ menu like Fill Holes(i.e. IJ.run(imp,"Fill Holes","")). But I don't know how to do this using fiji.

When I use IJ.run(imp,"RGB to CIELAB","");

I got the following error:

Unrecognized command: "RGB to CIELAB"

Any help to run commands from fiji menu in java code?

  • I guess it was you who asked [the same question](https://groups.google.com/forum/#!searchin/fiji-devel/running$20commands/fiji-devel/swn23-uQNUI/xvvSRc845CgJ) on the fiji-devel mailing list two weeks ago? The issue has been extensively discussed there, so in case you couldn't solve it yet, I suggest that you continue that thread providing more information. Opening a new question without even linking to the context where it was discussed before means wasting the time of people willing to help. Did you make sure the the `plugins.dir` property has been set correctly for `IJ.run` to work? – Jan Eglinger Dec 08 '13 at 11:41
  • Yes I did. But Actually I am still having the problem! I have used System.getProperties().setProperty("plugins.dir", "C:\\Users\\User\\Desktop\\fiji-win64\\Fiji.app\\plugins"); to set plugins.dir but this did not work – Safaa Al-Haj Saleh Dec 08 '13 at 19:09

1 Answers1

0

To get the Java command to convert RGB to CIELAB, do the following within a running Fiji instance:

  • Invoke the command finder using Plugins > Utilities > Find commands... or by typing Ctrl-L (Cmd-L on Mac OSX)
  • In the search field, type CIELAB: this will show you that the command RGB to CIELAB runs an instance of the class RGB_to_CIELAB
  • Now start the script editor using File > New > Script or by typing \
  • Run Tools > Open .java file for class... and type RGB_to_CIELAB

This will open the file RGB_to_CIELAB.java. Observing the code, you will see that it creates a new ImagePlus and invokes its show() method, something you probably want to avoid when calling the class from java code outside a Fiji instance. Unless the original code is changed to return an ImagePlus instead of showing it in the GUI (you are welcome to submit a pull request to https://github.com/fiji/fiji/), you might better directly use one of the utility methods in the CIELAB class (see javadoc), e.g.:

CIELAB.CIELAB2sRGB(float[] lab, float[] rgb) 

Hope that helps.

Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51