Setting exposure via runnable for MDA, not seem to work

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting exposure via runnable for MDA, not seem to work

inbalbruker
Hi, I'm writing a runnable script, that suppose to change the configuration
and exposure of a channel in specified positions.
I've tried using every command that is related to setting exposure. Nothing
seems to quite work. The exposure stays the same as declared in the MDA
window.
Here is a piece from the script:
   public void run() {
    if(darkFrames.get(pos_count) == 1 ){
    if(interval%intervalNum != 0){
                                if(ch_count >= 0){
                                     gui.message("dark");
        *mmc.setExposure(0);
        gui.setChannelExposureTime(channelGroup, channelName, 0);
                                     mmc.setProperty(mmc.getCameraDevice(), "Exposure", "0");*
                       
                   mmc.setConfig(channelGroup, channelName);
                   mmc.waitForConfig(channelGroup, channelName);
                                        }
   
    }
   
    }
               

                ++i;
      ++ch_count;
      // move to next position
                if (ch_count >= numChannels) {
                        ch_count = 0;
                        ++pos_count;
                }
                // move to next interval
                if (pos_count >= numOfPos) {
                        pos_count = 0;
                        ++interval;
                }
   }


What am I doing wrong?
I would also love to know, if there is a way to not take a snap at all in
certain positions, and instead, adding one of the previous snaps to the
album.
thanks :)



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure via runnable for MDA, not seem to work

Stuurman, Nico
On 10/24/18 6:02 AM, inbalbruker wrote:
> Hi, I'm writing a runnable script, that suppose to change the configuration
> and exposure of a channel in specified positions.
> I've tried using every command that is related to setting exposure. Nothing
> seems to quite work. The exposure stays the same as declared in the MDA
> window.

It is quite possible that the acquisition engine reads the channel
exposure setting once, and ignores the changes you make.

Since you want to do quite complicated thing (from the point of view of
the acquisition engine), it is way more straightforward to script the
complete acquisition yourself.  Not that hard.  "Missing" frames are
automatically shown as the previous image by the Micro-Manager display
code, so no need to worry about those.

Best,



Nico




_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure via runnable for MDA, not seem to work

julou
In reply to this post by inbalbruker
on our setup, calling mmc.setExposure(xx) in the runnable is enough. See e.g.
https://github.com/vanNimwegenLab/MiM_NikonTi/blob/master/Scripts/scripts_1.4/multipos_multiexp.bsh

I realise it doesn't help so much but at least it confirms that in MM1.4 the
exposure is not overwritten after the runnable is called. You might want to
double check that you have not messed up how you keep track of the indices.



-----
Thomas Julou  |  Computational & Systems Biology  |  Biozentrum – University of Basel  |  Klingelbergstrasse 50/70 CH-4056 Basel  |  +41 (0)61 267 16 21

--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Thomas Julou  |  Computational & Systems Biology  |  Biozentrum – University of Basel  |  Klingelbergstrasse 50/70 CH-4056 Basel  |  +41 (0)61 267 16 21
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure via runnable for MDA, not seem to work

inbalbruker
In reply to this post by Stuurman, Nico
Hi Nico, thanks for your reply, it solved most of my problems.
The issue now is that when running the manual aqc, the micromanager get
stuck until the end of the program. No gui massages are showing in the
script panel output, you cant interrupt the script, and no snapped images
are showing. And that is problematic if you want to monitor the progress of
the aqc.
Is there's a way to fix that?
I also didn't quite understood what is the purpose of the below piece of
code, in the manual acq script:
     GenericDialog dlg = new GenericDialog("Manual Acquisition", null);
      dlg.addMessage("Move filters for channel  in Place");
      dlg.showDialog();
      if (dlg.wasCanceled())
         return false;



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure via runnable for MDA, not seem to work

Stuurman, Nico
On 11/7/18 2:10 AM, inbalbruker wrote:

> Hi Nico, thanks for your reply, it solved most of my problems.
> The issue now is that when running the manual aqc, the micromanager get
> stuck until the end of the program. No gui massages are showing in the
> script panel output, you cant interrupt the script, and no snapped images
> are showing. And that is problematic if you want to monitor the progress of
> the aqc.
> Is there's a way to fix that?
> I also didn't quite understood what is the purpose of the below piece of
> code, in the manual acq script:
>       GenericDialog dlg = new GenericDialog("Manual Acquisition", null);
>        dlg.addMessage("Move filters for channel  in Place");
>        dlg.showDialog();
>        if (dlg.wasCanceled())
>           return false;

I miss context here, and have no idea how to help you.  Can you please
explain what you are trying to accomplish, what MM version you are
using, and include the script that you are running?

Best,


Nico



_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure via runnable for MDA, not seem to work

inbalbruker
Sure, as I stated before, my goal is to run an acquisition that in certain
positions and time points won't activate certain channels. As you suggested,
I used the manual Acquisition script in the example scripts as a base.
However, when using it, the micromanager seems to be stuck until the end of
the acquisition. Not like in the MDA, where the progress is shown on the
screen, and you can stop it in any time.
I am using micromanger 1.4.13, and below is my code:

void ACQ(){
        curChannels = acq.getChannels();
        numChannels = curChannels.size();
        channelGroup = mmc.getChannelGroup();
        int ms = acq.getFrameIntervalMs();
        int frames = acq.getNumFrames();
        numSlices = 0;
        Color[] colors = {Color.BLUE, Color.GREEN, Color.RED};
        String name = acq.getRootName();
       
   int i = 0;
   int ch_count = 0;
   int pos_count = 0;
   int interval = 1;
   
   gui.message("first"+ms+ " "+ frames + " " + name + " " + numOfPos );

gui.openAcquisition(acqName, name, frames, numChannels, numSlices, numOfPos,
true);
//
for (int i=0; i<numChannels; i++){
   gui.setChannelName(acqName, i, curChannels.get(i).config);
}
for (int i=0; i<colors.length; i++){
         gui.setChannelColor(acqName, i, curChannels.get(i).color);}
for (int i=0; i<frames; i++) {
         
        now = System.currentTimeMillis();
        gui.message("frame: "+i);
        for(int p=0; p<numOfPos; p++){
        gui.message("pos: "+p);
   for (int j=0; j<numChannels; j++) {
    gui.message("channel: "+j);
        if((darkFrames.get(p) == 1) && (i%intervalNum != 0) && (j !=
channelNum)){
   
                                        gui.message("dark");
                               
      }

      else{
     
//      GenericDialog dlg = new GenericDialog("Manual Acquisition", null);
//      dlg.addMessage("Move filters for channel  in Place");
//      dlg.showDialog();
//      if (dlg.wasCanceled())
//         return false;
               
                mp = pl.getPosition(p);
    mp.goToPosition(mp, mmc);
               
               
      gui.message("Acquiring frame " + i + ", channel " +
curChannels.get(j).config + ".");
      mmc.setExposure(curChannels.get(j).exposure);
      mmc.setConfig(channelGroup, curChannels.get(j).config);
      mmc.waitForConfig(channelGroup, curChannels.get(j).config);
      gui.snapAndAddImage(acqName, i, j, 0, p);
     
      }
   }
        }
         

   itTook = System.currentTimeMillis() - now;
   sleept = ms - itTook;
   gui.sleep(sleept);
   
}
 gui.message("Done.");
       
}

All the gui.messages are shown in the script panel output only at the end of
the run.
I hope now I am clearer. Thanks :)



--
Sent from: http://micro-manager.3463995.n2.nabble.com/


_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general