launch one instance for imageJ

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

launch one instance for imageJ

Lei, Dong Fang
Hi all

 

I do some change on ImageJ1.3.2 for supporting a new image data type
(.qif) and recompile it to .exe.

 

In my system, I set that it get .qif file to open by double clicking.
But that was a problem was that I would open launch another instance of
ImageJ each time I clicked on a file. It is better that if have one
ImageJ instance, it does not open another ImageJ instance when double
clicking another .qif file.

 

Maybe the problem is in main function which it always creates a new
imageJ object. That is right?

 

How do you think about that?

 

Please give me some comments.

 

Thank you very much.

 

dongfang

 

 
Reply | Threaded
Open this post in threaded view
|

Re: launch one instance for imageJ

ctrueden
Hi Dong Fang,

It would certainly be possible to modify ImageJ to prevent it from
spawning multiple instances. One way to do this is to use sockets.

For instructions on this method, see:

http://www.rgagnon.com/javadetails/java-0288.html

Basically, the running instance listens on a port for incoming command
line arguments from any additional instances that get launched.
Additional instances detect that the port is already open, send their
arguments, then terminate.

If you want a real-world example, I use this technique in my VisBio
application (http://www.loci.wisc.edu/visbio/). See
loci/visbio/util/InstanceServer.java, loci/visbio/VisBio.java, and
loci/visbio/VisBioFrame.java for the relevant code.

Cheers,
-Curtis

Lei, Dong Fang wrote:

>Hi all
>
>
>
>I do some change on ImageJ1.3.2 for supporting a new image data type
>(.qif) and recompile it to .exe.
>
>
>
>In my system, I set that it get .qif file to open by double clicking.
>But that was a problem was that I would open launch another instance of
>ImageJ each time I clicked on a file. It is better that if have one
>ImageJ instance, it does not open another ImageJ instance when double
>clicking another .qif file.
>
>
>
>Maybe the problem is in main function which it always creates a new
>imageJ object. That is right?
>
>
>
>How do you think about that?
>
>
>
>Please give me some comments.
>
>
>
>Thank you very much.
>
>
>
>dongfang
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: launch one instance for imageJ

Lei, Dong Fang
In reply to this post by Lei, Dong Fang
Curtis

Thank you very much.

That is very helpful for me.

dongfang

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Curtis Rueden
Sent: 2005年9月28日 14:11
To: [hidden email]
Subject: Re: launch one instance for imageJ

Hi Dong Fang,

It would certainly be possible to modify ImageJ to prevent it from
spawning multiple instances. One way to do this is to use sockets.

For instructions on this method, see:

http://www.rgagnon.com/javadetails/java-0288.html

Basically, the running instance listens on a port for incoming command
line arguments from any additional instances that get launched.
Additional instances detect that the port is already open, send their
arguments, then terminate.

If you want a real-world example, I use this technique in my VisBio
application (http://www.loci.wisc.edu/visbio/). See
loci/visbio/util/InstanceServer.java, loci/visbio/VisBio.java, and
loci/visbio/VisBioFrame.java for the relevant code.

Cheers,
-Curtis

Lei, Dong Fang wrote:

>Hi all
>
>
>
>I do some change on ImageJ1.3.2 for supporting a new image data type
>(.qif) and recompile it to .exe.
>
>
>
>In my system, I set that it get .qif file to open by double clicking.
>But that was a problem was that I would open launch another instance of
>ImageJ each time I clicked on a file. It is better that if have one
>ImageJ instance, it does not open another ImageJ instance when double
>clicking another .qif file.
>
>
>
>Maybe the problem is in main function which it always creates a new
>imageJ object. That is right?
>
>
>
>How do you think about that?
>
>
>
>Please give me some comments.
>
>
>
>Thank you very much.
>
>
>
>dongfang
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: launch one instance for imageJ

Lei, Dong Fang
In reply to this post by Lei, Dong Fang
Hi Curtis

Thank you very much.

Use sockets to prevent from spawning multiple instances works.

But now there is still one question. I want to open image file by double clicking the file. When there is no ImageJ open, it works. But when ImageJ is running and I double click another file, though it doesn't spawn another ImageJ instance, the image file can't be open.

The question is how to let ImageJ that is running knows which file will be open.

Your VisBio application is able to open file by double clicking?

Regards,

dongfang

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Curtis Rueden
Sent: 2005年9月28日 14:11
To: [hidden email]
Subject: Re: launch one instance for imageJ

Hi Dong Fang,

It would certainly be possible to modify ImageJ to prevent it from
spawning multiple instances. One way to do this is to use sockets.

For instructions on this method, see:

http://www.rgagnon.com/javadetails/java-0288.html

Basically, the running instance listens on a port for incoming command
line arguments from any additional instances that get launched.
Additional instances detect that the port is already open, send their
arguments, then terminate.

If you want a real-world example, I use this technique in my VisBio
application (http://www.loci.wisc.edu/visbio/). See
loci/visbio/util/InstanceServer.java, loci/visbio/VisBio.java, and
loci/visbio/VisBioFrame.java for the relevant code.

Cheers,
-Curtis

Lei, Dong Fang wrote:

>Hi all
>
>
>
>I do some change on ImageJ1.3.2 for supporting a new image data type
>(.qif) and recompile it to .exe.
>
>
>
>In my system, I set that it get .qif file to open by double clicking.
>But that was a problem was that I would open launch another instance of
>ImageJ each time I clicked on a file. It is better that if have one
>ImageJ instance, it does not open another ImageJ instance when double
>clicking another .qif file.
>
>
>
>Maybe the problem is in main function which it always creates a new
>imageJ object. That is right?
>
>
>
>How do you think about that?
>
>
>
>Please give me some comments.
>
>
>
>Thank you very much.
>
>
>
>dongfang
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: launch one instance for imageJ

Lei, Dong Fang
In reply to this post by Lei, Dong Fang
Hi Curtis

Command-line arguments can be passed from a secondary instance to the primary instance.

Thank you very much.

dongfang

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Curtis Rueden
Sent: 2005年9月28日 14:11
To: [hidden email]
Subject: Re: launch one instance for imageJ

Hi Dong Fang,

It would certainly be possible to modify ImageJ to prevent it from
spawning multiple instances. One way to do this is to use sockets.

For instructions on this method, see:

http://www.rgagnon.com/javadetails/java-0288.html

Basically, the running instance listens on a port for incoming command
line arguments from any additional instances that get launched.
Additional instances detect that the port is already open, send their
arguments, then terminate.

If you want a real-world example, I use this technique in my VisBio
application (http://www.loci.wisc.edu/visbio/). See
loci/visbio/util/InstanceServer.java, loci/visbio/VisBio.java, and
loci/visbio/VisBioFrame.java for the relevant code.

Cheers,
-Curtis

Lei, Dong Fang wrote:

>Hi all
>
>
>
>I do some change on ImageJ1.3.2 for supporting a new image data type
>(.qif) and recompile it to .exe.
>
>
>
>In my system, I set that it get .qif file to open by double clicking.
>But that was a problem was that I would open launch another instance of
>ImageJ each time I clicked on a file. It is better that if have one
>ImageJ instance, it does not open another ImageJ instance when double
>clicking another .qif file.
>
>
>
>Maybe the problem is in main function which it always creates a new
>imageJ object. That is right?
>
>
>
>How do you think about that?
>
>
>
>Please give me some comments.
>
>
>
>Thank you very much.
>
>
>
>dongfang
>  
>