3-Channel overview window

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

3-Channel overview window

Amit Cherian
This post was updated on .
Background...
I put together a script to perform a 3-Channel overview window.
4 buttons, 3 for channels and 1 to crop. 3 dropdowns showing available
presets from a predefined group, to assign a preset to each channel button.
Pressing on of the channel buttons, snaps an image, pushes it to one of the
quadrants of an Image canvas, 4times the size of the camera resolution. Also
places a second copy in the bottom right quadrant to show an overlayed view.
The images is tagged with channel axis position.
Crop button crops out the original camera resolution from the overview image
canvas.
Demo
The issue I am facing...
The crop processor crops, but can't seem to do it across the channels. The
resulting image has the first channel across all the channels. Any advise?

Script attached.
thanks in advance!

Looking forward to figuring out...
how to make this into a plugin.
how to accomplish the same with images from Live stream.

DyMont_GUI-6_20200428.bsh
<http://micro-manager.3463995.n2.nabble.com/file/t396861/DyMont_GUI-6_20200428.bsh






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


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

Re: 3-Channel overview window

Nico Stuurman-2
Hi Amit,

That is a beautiful hack! Really cool how the MM channel sliders
continue to operate on the overview window that you created!  There is
something funky going on for me, with the channel names and colors
changing when I press the Ch1, 2, or 3 button, hope that can be
mitigated.  There is of course a penalty in memory usage and performance
by creating images ~4x as large as needed for each channel, but that
should be fine in the beginning.

As for the crop ("Extract!") button, Micro-Manager does not use an
ImagePlus with ImageStack behind the scene, so your Duplicator command
there does not do what you think it should do.

I would keep a 3 channel Micro-Manager RewritableRAMDatastore as a
global, insert the images you acquire in that store, and then display
that store whenever someone presses the "Extract" button. That allows
the user to save the data in their original format, and - using the gear
icon - also to export to ImageJ as your code does.

The following snippet could guide you:

import org.micromanager.data.Coordinates;

store = mm.data().createRewritableRAMDatastore();
for (int ch=0; ch < 3; ch++) {
       mm.getCore().snapImage();
      TaggedImage tmp = mm.getCore().getTaggedImage();
      Image image = mm.data().convertTaggedImage(tmp);
      coords = Coordinates.builder().t(0).z(0).p(0).c(ch).build();
      newImg = image.copyAtCoords(coords);
      store.putImage(newImg);
}

// to display:
mm.displays().createDisplay(store);

Please do post where you get with this!

The best/final solution to side-by-side displays would be to create a
class implementing DataViewer that does what you are doing here. May not
even be that much work using your approach!


Best,

Nico



On 4/30/2020 5:40 AM, Amit Cherian wrote:

> Background...
> I put together a script to perform a 3-Channel overview window.
> 4 buttons, 3 for channels and 1 to crop. 3 dropdowns showing available
> presets from a predefined group, to assign a preset to each channel button.
> Pressing on of the channel buttons, snaps an image, pushes it to one of the
> quadrants of an Image canvas, 4times the size of the camera resolution. Also
> places a second copy in the bottom right quadrant to show an overlayed view.
> The images is tagged with channel axis position.
> Crop button crops out the original camera resolution from the overview image
> canvas.
>
> The issue I am facing...
> The crop processor crops, but can't seem to do it across the channels. The
> resulting image has the first channel across all the channels. Any advise?
>
> Script attached.
> thanks in advance!
>
> Looking forward to figuring out...
> how to make this into a plugin.
> how to accomplish the same with images from Live stream.
>
> DyMont_GUI-6_20200428.bsh
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_file_t396861_DyMont-5FGUI-2D6-5F20200428.bsh&d=DwICAg&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=8mmPZGjKUeNYhA9inPbMjcFuLjjsNKNbMBwe9QzoitU&s=n3FovZ0EhXQJWa7LwP-uLJNtbzNOpINkQPewcCv3D2Y&e= >
>
>
>
>
>
>
> --
> Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_&d=DwICAg&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=8mmPZGjKUeNYhA9inPbMjcFuLjjsNKNbMBwe9QzoitU&s=kv3XTmQQLk6ker9wsc7BevETavxxcja3J44CJmqi9ro&e=
>
>
> _______________________________________________
> micro-manager-general mailing list
> [hidden email]
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwICAg&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=8mmPZGjKUeNYhA9inPbMjcFuLjjsNKNbMBwe9QzoitU&s=e1y_xCBzv0y1qi0dpBaT14scOcOIE4VifqX5baZpwJI&e=
> .



_______________________________________________
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: 3-Channel overview window

Amit Cherian
Thank you for your suggestions Nico. I shall definitely share once the
project is completed.
Stay safe!
Best
Amit



--
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: 3-Channel overview window

Amit Cherian
Any hints as to why the use of mm.getCore().snapImage() in this script would
reset the exposure time to the lowest exposure time before this snap
function is called? Same is reproduced if I use mm.live().snap(false)
instead.

If I run either of these snap functions just like that to check its
behavior, it does work as it should be.

Best,
Amit



--
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: 3-Channel overview window

Nico Stuurman-2
Hi Amit,

On 5/11/2020 3:57 AM, Amit Cherian wrote:
> Any hints as to why the use of mm.getCore().snapImage() in this script would
> reset the exposure time to the lowest exposure time before this snap
> function is called? Same is reproduced if I use mm.live().snap(false)
> instead.
>
> If I run either of these snap functions just like that to check its
> behavior, it does work as it should be.

Did not see the script, so going blind here, but is it possible that you
set a Configuration (Channel) before and that this config contains an
exposure time, or that you have the option "Sync exposure between Main
and MDA windows" checked?

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: 3-Channel overview window

Amit Cherian
I do set a Configuration (Channel) before calling the snap function, but the
exposure time is not a property for the Channel group. The "Sync exposure
between Main and MDA windows" is checked.

Thank you for your reply,



--
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: 3-Channel overview window

Nico Stuurman-2
Hi Amit,

On 5/13/2020 6:57 AM, Amit Cherian wrote:
> I do set a Configuration (Channel) before calling the snap function, but the
> exposure time is not a property for the Channel group. The "Sync exposure
> between Main and MDA windows" is checked.

Uncheck, and the issue will most likely go away...

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: 3-Channel overview window

Amit Cherian
Dear Nico,


Uncheck, and the issue will most likely go away...


Thank you for your suggestion but the issue seems to have solved by itself.
I'm not sure what has caused this.
I have extended the script to 4-Channel.
<http://micro-manager.3463995.n2.nabble.com/file/t396861/2020-05-22_16_16_47-Preview-377903925_%2825%25%29.png>

Please find the attached script for anyone who would like to use it.
DyMont_4Color_v0.bsh
<http://micro-manager.3463995.n2.nabble.com/file/t396861/DyMont_4Color_v0.bsh>  

Like you had also suggested to implement Dataviewer, as initial steps to
this, I built the DemoDisplay plugin. When hitting the snap button there is
no image displayed within the frame. The message showing the number of
frames does get updated. See attached image.
<http://micro-manager.3463995.n2.nabble.com/file/t396861/2020-05-22_16_19_34-Demo_Display.png>
Any ideas why the frame is not able to paint the image?

Will continue this discussion on the image.sc forum :)

Thanks in advance.
Best,
Amit




_______________________________________________
micro-manager-general mailing list
micro-manager-general@.sourceforge
https://lists.sourceforge.net/lists/listinfo/micro-manager-general



--
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: 3-Channel overview window

Nico Stuurman-2
Hi Amit,

On 5/22/2020 7:44 AM, Amit Cherian wrote:
Like you had also suggested to implement Dataviewer, as initial steps to
this, I built the DemoDisplay plugin. When hitting the snap button there is
no image displayed within the frame. The message showing the number of
frames does get updated. See attached image.
<https://urldefense.proofpoint.com/v2/url?u=http-3A__micro-2Dmanager.3463995.n2.nabble.com_file_t396861_2020-2D05-2D22-5F16-5F19-5F34-2DDemo-5FDisplay.png&d=DwICAg&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=dZblGbnCDKId0wWpSOdhwz07eibxIc9tyNI0Mdt_ec4&s=Y_frXTomrg9OpVQwU0igpUxPiVp4ycOE47GS-FVSce8&e= > 
Any ideas why the frame is not able to paint the image?

You got me there!

I guess that Chris wrote this in the early days of 2.0 (had not seen this code before;).  The source code has the following comment:

// Ordinarily you would paint your images here, but we just
// draw some information about the image.
// No images in the Datastore yet.
// Ensure we're large enough to show our text.
So, I guess that the code does exactly what it promises to do;)

I updated a few functions and made it sure it no longer uses deprecated code.  Let us know (on the forum;)  how it goes!

Best,


Nico





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