Login  Register

Re: Is it possible to open a file and have it sent directly to a plugin?

Posted by JaapK on Dec 13, 2010; 12:32pm
URL: http://imagej.273.s1.nabble.com/Is-it-possible-to-open-a-file-and-have-it-sent-directly-to-a-plugin-tp3686194p3686195.html

Hi Karen,

Do I understand correctly that you want to open an image from within the plugin? You can use the OpenDialog to allow the user to select a file, and then actually open the image using an ImagePlus constructor:

//display dialog
OpenDialog od = new OpenDialog("Select image...","");

//get ImagePlus object
ImagePlus imp = new ImagePlus(od.getDirectory() + od.getFileName());

I hope this solves your problem.

Kind regards,
Jaap Kokorian