Login  Register

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

Posted by kacollins on Dec 14, 2010; 2:56am
URL: http://imagej.273.s1.nabble.com/Is-it-possible-to-open-a-file-and-have-it-sent-directly-to-a-plugin-tp3686194p3686196.html

Hi Jaap,
     Thanks for the feedback. After re-reading my post, I guess my question was not formulated very well, so i will give it another try. Ideally, what I am looking for is a way to send an ImagePlus directly to a plugin, without first displaying it on the screen, when a file has been opened via ImageJ by double clicking the file in the OS. I know how to setup the double click to open, its the image display I am trying to avoid. I am currently using an ImageListener to send opened images to the plugin, but the image flashes on the screen first before the plugin takes over. I am guessing there is no way to do this, but I have often been surprised by how flexible ImageJ is when it comes to customizing one's environment. I thought that maybe there would be something like a startup macro trick that I was not aware of.
    The OpenDialog from within the plugin works well for opening files in that manner. It would just be nice to get the same results when a file is opened by double clicking.

Thanks again for your input,
Karen



On 12/13/2010 7:34 AM, JaapK [via ImageJ] wrote:
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


View message @ http://imagej.588099.n2.nabble.com/Is-it-possible-to-open-a-file-and-have-it-sent-directly-to-a-plugin-tp5825447p5830578.html
To unsubscribe from Is it possible to open a file and have it sent directly to a plugin?, click here.