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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

kacollins
Hi all. I am working on a plugin that displays an image in a frame along with other GUI objects. I am currently using the ImageListener interface to grab any image that is opened, and then send the associated ImagePlus to the plugin. The downside to this method is that the image flashes on the screen briefly before being sent to the plugin and is then redisplayed.
Does anyone know of a cleaner way to send an image directly to a plugin when it is opened by double clicking on a file (and when using the File/Open... dialog)?

Karen

Reply | Threaded
Open this post in threaded view
|

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

JaapK
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
Reply | Threaded
Open this post in threaded view
|

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

kacollins
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.
Reply | Threaded
Open this post in threaded view
|

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

JaapK
Hi Karen,

Ah I see what you would like to do. Unfortunately I don't know how to
accomplish it.

Kind regards,
Jaap Kokorian

2010/12/14 kacollins [via ImageJ]
<[hidden email]>:

> 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.
>
> ________________________________
> View message @
> http://imagej.588099.n2.nabble.com/Is-it-possible-to-open-a-file-and-have-it-sent-directly-to-a-plugin-tp5825447p5833251.html
> To unsubscribe from Is it possible to open a file and have it sent directly
> to a plugin?, click here.