Re: [micro-manager-general] Steps to get a functional plugin, lesson n+1
Status: Beta
Brought to you by:
nicost
|
From: Carlos G M. <tr...@ac...> - 2020-04-07 22:00:58
|
Nico,
Nico Stuurman @ 07/04/2020 00:36 -0300 dixit:
> In the mean time, you could add a button that gets the active DataViewer:
>
> studio_.displays().getActiveDataViewer();
>
> and take it from there.
Ok, I've defined my plan for the time being:
1- get hold of a field image
do a snap, get its image.
Working!
2- get hold of a ROI set
via mm.displays().getCurrentWindow().getImagePlus().getRoi()
Also working! (I even check that the ROI is actually defined)
3- get intensities of acquisition images and plot them
Here, I was hoping to be informed using DataProviderHasNewImageEvent.
But my first try did not work.
I'm doing:
// Run an acquisition using the current MDA parameters.
acquireButton_ = new JButton("Run Acquisition");
acquireButton_.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// All GUI event handlers are invoked on the EDT (Event Dispatch
// Thread). Acquisitions are not allowed to be started from the
// EDT. Therefore we must make a new thread to run this.
Thread acqThread = new Thread(new Runnable() {
@Override
public void run() {
ds_ = studio_.acquisitions().runAcquisition();
ds_.registerForEvents(me);
}
});
acqThread.start();
}
});
where "me" is a reference to the Frame instance, and there:
@Subscribe
public void onNewImage(DataProviderHasNewImageEvent event) {
imagesReceived_++;
title.setText("We have an image to work with!");
}
I'm not getting along this bus thing.
Help ?
>> I did not see an easy way to get a new MDA step done event either... so
>> I guess I will have to implement the whole acquisition control logic ?
>> Or ask for a new event be created...
>>
>> -Carlos
>>
>>
>> Nico Stuurman @ 06/04/2020 21:11 -0300 dixit:
>>> Hi Carlos,
>>>
>>> On 4/6/2020 1:15 PM, Carlos G Mendioroz wrote:
>>>> I'm modifying the example plugin, and as I need to get hold of a
>>>> display
>>>> (to determine a ROI set) I decided to try:
>>>>
>>>>
>>>> @Subscribe
>>>> public void onNewDisplay(NewDisplayEvent event) {
>>>> title.setText("We have an image to work with!");
>>>> }
>>>>
>>>> after making "title" a class variable much like the example's
>>>> exposureTimeLabel_.
>>>>
>>>> As far as I understand the documentation, I should be getting an event
>>>> (and title should change) when a display window is created by, e.g., a
>>>> new snap.
>>>>
>>>> But it does not work.
>>> Looking into this, it turns out that the NewDisplayEvent is not
>>> implemented, and is never generated. It either was never implemented,
>>> or was lost in refactoring. I asked the architect (Mark) for
>>> directions.
>>>
>>> Looked around for alternatives, but nothing pops up. Certainly looks
>>> like we need to fix this!
>>>
>>> Best,
>>>
>>> Nico
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> micro-manager-general mailing list
>>> mic...@li...
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_micro-2Dmanager-2Dgeneral&d=DwIDaQ&c=iORugZls2LlYyCAZRB3XLg&r=UwP8SWqih8VHO1LwZpgcx83I4o21yLj6V6QD-25Dt4I&m=6GuJnANG_0c-Re6WVZcB5mQAT6viGaBB6gXR84rbx-8&s=_ZOh7WeTxp32ZcB_H_wonRqQz26Kq9DEkj0twobn7Bs&e=
>>>
>
>
>
> _______________________________________________
> micro-manager-general mailing list
> mic...@li...
> https://lists.sourceforge.net/lists/listinfo/micro-manager-general
--
Carlos G Mendioroz <tr...@ac...>
|