Microscope (stage) controller and serial communication (Javacomm)

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

Microscope (stage) controller and serial communication (Javacomm)

Weller Andrew Francis
Dear all,

I am in the process of building an interface for our automated
microscope (Leica DM RXA) through the serial port (Linux and Windows).

I have downloaded the Prior Optiscan stage controller from:
http://mitel.dimi.uniud.it/moss/ijstage.php which I am modifying and
extending (for microscope, as well as, stage control).

I wonder if anyone has had success with this for a Marzhauser stage and
the Leica (DM RXA) microscope?

The other method, I guess, is to build a macro with included serial
commands via Javacomm included in the system. Does this sounds right?

The commands are one liners with a carriage return which will read/write
to the port. Does anyone have example macros with an included serial
communication example?

Thanks for your time, Andy
Reply | Threaded
Open this post in threaded view
|

Re: Microscope (stage) controller and serial communication (Javacomm)

Vincenzo Della Mea
Dear Andy,
We are going to release a new version of the plugin, made for  
controlling a stage through macro, for Prior Optiscan as well as  
Marzhauser LSTEP (I've just put a link on the web site to this, but  
take care, is not really finished - just to give an idea).
I know another ImageJ user is trying to do what you are doing, but it  
seems that the Leica stage is not an LSTEP one, so some modification  
could be needed.  A quick tip: a main difference we found in  
implementing the LSTEP version is that, while Prior most times gives  
a result back, LSTEP does not; so you do not have to wait for a  
string on the Serial connection. Furthermore, LSTEP provides for  two  
language interpreters, so you may loose time in understanding for  
which has been set.
I should say that we are in the middle of a major upgrade, which  
includes also a transition from Javacomm to RxTx. RxTx (http://
www.rxtx.org) is an open source implementation of Javacomm, which  
makes it easier to replicate the setup on different OSes. This will  
be v.2.0,a dn will include also direct communication with serial.  
Unfortunately, ImageJ does not allow to directly return values from a  
plugin, so this could limit applications.

Regards,
Vincenzo

> I am in the process of building an interface for our automated  
> microscope (Leica DM RXA) through the serial port (Linux and  
> Windows). I have downloaded the Prior Optiscan stage controller  
> from: http://mitel.dimi.uniud.it/moss/ijstage.php which I am  
> modifying and extending (for microscope, as well as, stage  
> control). I wonder if anyone has had success with this for a  
> Marzhauser stage and the Leica (DM RXA) microscope? The other  
> method, I guess, is to build a macro with included serial commands  
> via Javacomm included in the system. Does this sounds right? The  
> commands are one liners with a carriage return which will read/
> write to the port. Does anyone have example macros with an included  
> serial communication example? Thanks for your time, Andy
Reply | Threaded
Open this post in threaded view
|

Re: Microscope (stage) controller and serial communication (Javacomm)

Wayne Rasband
In reply to this post by Weller Andrew Francis
> The commands are one liners with a carriage return which will
> read/write to the port. Does anyone have example macros with an
> included serial communication example?

The macro language currently does not offer serial I/O support but
ImageJ 1.37c, courtesy of Johannes Schindelin, adds a call() function
that, in effect, allows new macro functions to be added. The call
function calls a public static method, passing an arbitrary number of
String parameters, and returning a String. Here is an example that
calls methods with no arguments, one argument and two arguments:

    call("JavaClass.method0");
    call("JavaClass.method1", "arg1");
    call("JavaClass.method2", "arg1", "arg2");

And this is what the methods in JavaClass.java look like:

     public static String method0() {
         return "method00";
     }

     public static String method1(String arg1) {
         return "method1"+"("+arg1+")";
     }

     public static String method2(String arg1, String arg2) {
         return "method2"+"("+arg1+", "+arg2+")";
     }

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: Microscope (stage) controller and serial communication (Javacomm)

Vincenzo Della Mea
In reply to this post by Weller Andrew Francis
Due to the important innovation present in 1.37c, we'll delay a  
little bit the release of our stage controllers, in order to exploit  
that possibility.
Vincenzo

> Da: Wayne Rasband <[hidden email]>
> Data: 28 marzo 2006 18:28:14 GMT+02:00
> Oggetto: Re: Microscope (stage) controller and serial communication  
> (Javacomm)
>
>
>> The commands are one liners with a carriage return which will read/
>> write to the port. Does anyone have example macros with an  
>> included serial communication example?
>
> The macro language currently does not offer serial I/O support but  
> ImageJ 1.37c, courtesy of Johannes Schindelin, adds a call()  
> function that, in effect, allows new macro functions to be added.  
> The call function calls a public static method, passing an  
> arbitrary number of String parameters, and returning a String. Here  
> is an example that calls methods with no arguments, one argument  
> and two arguments:
Reply | Threaded
Open this post in threaded view
|

Macro within a macro?

Weller Andrew Francis
Dear all,

I have a macro that initiates some variables. Is it possible to call this up
from within a separate macro to keep my design modular?

Many thanks, Andy
Reply | Threaded
Open this post in threaded view
|

do/while loop, I think?!

Weller Andrew Francis
Dear all,

I am controlling a microscope through the serial interface that both reads and
writes strings. What I would like it to do is only proceed to the next
command after the current one has completed. This is acknowledged by the
microscope re-sending the original command.

So, for example, if I send the microscope the command "50020xyz" the macro can
only continue once "50020xyz" has been returned. In macro code this is:

run("serial plugin", "waitanswer genericcmd=50020xyz");
//to retrieve the answer through the macro
answer = getResultLabel(0);

So, while answer = "" I want the macro to stay idle, but when answer =
"50020xyz" I want the macro to continue. I guess this needs a do/while loop
(maybe if/then!?)?!

I can't get my head round it at the moment and wonder if anyone has any
ideas/suggestions?

Many thanks, Andy
Reply | Threaded
Open this post in threaded view
|

Re: Macro within a macro?

dscho
In reply to this post by Weller Andrew Francis
Hi,

On Mon, 22 May 2006, Andy Weller wrote:

> I have a macro that initiates some variables. Is it possible to call this up
> from within a separate macro to keep my design modular?

How about wrapping this into a user-defined function (see
http://rsb.info.nih.gov/ij/developer/macro/macros.html#functions)?

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Printing text windows?

Joachim Wesner
In reply to this post by Weller Andrew Francis
Hi,

is there really no ImageJ built-in way to directly/quickly print a text
window (result window and probably others)? I seem to find none.

(I know I can use the clipboard but I thought it must be built-in
somewhere, as the editor also can print its contents)

Thanx

Joachim


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: do/while loop, I think?!

Joachim Wesner
In reply to this post by Weller Andrew Francis
Hi Andy,

I´m not sure I fully understand your setup/problem, also because I do not
know that serial plugin you use.

1) What does "waitanswer" mean? I would assume it would already tell the
plugin to NOT return before anything is sent back by the microscope, so
you would probably need no extra do/while at all (you still might need to
check if the result was different from what you expect)

2) Otherwise, if it returns earlier, will you still be able to later (and
repeatedly) read the reply using getResultLabel(0)?
Then you could use a do/while construction like

run(.....);
do {
    answer = getResultLabel(0);
    } while (answer != "50020xyz");

(or probably simpler)

run(.....);
do {
    answer = getResultLabel(0);
    } while (answer == "");

Sincerely

Joachim




                                                                                                                                       
                      Andy Weller                                                                                                      
                      <andrew.weller@ER         An:      [hidden email]                                                            
                      DW.ETHZ.CH>               Kopie:   (Blindkopie: Joachim Wesner/DEWET/LMSCentral/Leica)                            
                      Gesendet von:             Thema:   do/while loop, I think?!                                                      
                      ImageJ Interest                                                                                                  
                      Group                                                                                                            
                      <[hidden email].                                                                                                
                      GOV>                                                                                                              
                                                                                                                                       
                                                                                                                                       
                      22.05.2006 19:04                                                                                                  
                      Bitte antworten                                                                                                  
                      an ImageJ                                                                                                        
                      Interest Group                                                                                                    
                                                                                                                                       




Dear all,

I am controlling a microscope through the serial interface that both reads
and
writes strings. What I would like it to do is only proceed to the next
command after the current one has completed. This is acknowledged by the
microscope re-sending the original command.

So, for example, if I send the microscope the command "50020xyz" the macro
can
only continue once "50020xyz" has been returned. In macro code this is:

run("serial plugin", "waitanswer genericcmd=50020xyz");
//to retrieve the answer through the macro
answer = getResultLabel(0);

So, while answer = "" I want the macro to stay idle, but when answer =
"50020xyz" I want the macro to continue. I guess this needs a do/while loop

(maybe if/then!?)?!

I can't get my head round it at the moment and wonder if anyone has any
ideas/suggestions?

Many thanks, Andy



______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Macro within a macro?

Weller Andrew Francis
In reply to this post by dscho
I will give this a look. Thank you.

On Monday 22 May 2006 19:41, Johannes Schindelin wrote:

> Hi,
>
> On Mon, 22 May 2006, Andy Weller wrote:
> > I have a macro that initiates some variables. Is it possible to call this
> > up from within a separate macro to keep my design modular?
>
> How about wrapping this into a user-defined function (see
> http://rsb.info.nih.gov/ij/developer/macro/macros.html#functions)?
>
> Hth,
> Dscho
Reply | Threaded
Open this post in threaded view
|

Re: do/while loop, I think?!

Weller Andrew Francis
In reply to this post by Joachim Wesner
Hi Joachim,

Yes, this may be true with "waitanswer" - I will have to play some more. If it
turns out not to be the case, then I think your second do/while loop will be
the answer.

Thank you, Andy

On Tuesday 23 May 2006 01:37, Joachim Wesner wrote:

> Hi Andy,
>
> I´m not sure I fully understand your setup/problem, also because I do not
> know that serial plugin you use.
>
> 1) What does "waitanswer" mean? I would assume it would already tell the
> plugin to NOT return before anything is sent back by the microscope, so
> you would probably need no extra do/while at all (you still might need to
> check if the result was different from what you expect)
>
> 2) Otherwise, if it returns earlier, will you still be able to later (and
> repeatedly) read the reply using getResultLabel(0)?
> Then you could use a do/while construction like
>
> run(.....);
> do {
>     answer = getResultLabel(0);
>     } while (answer != "50020xyz");
>
> (or probably simpler)
>
> run(.....);
> do {
>     answer = getResultLabel(0);
>     } while (answer == "");
>
> Sincerely
>
> Joachim