Fastest way to see which pixel has changed when using a listener

大兔子大兔子 提交于 2021-01-28 08:54:00

问题


I am trying to get EDS spectra on every scanned pixel using STEM. I am using the EDSStartAcquisition( 2048, 10,fexposure*2, 1) command and I have attached the following simple listener object into the shown 1D spectrum image:

string messagemap = "data_value_changed:MyImageAction"  
    Class MyListenerClass1
    {
    String event_desc;

    MyListenerClass1(Object self); //Result("\n");
    ~MyListenerClass1(Object self);// Result("\n");
    
        
        Void MyImageAction(Object self, Number e_fl, Image Img)
        {   
        ImageGetEventMap().DeconstructEventFlags( e_fl, event_desc )
        Result(GetTime(1)+": Image message : " + event_desc + " 0x" + Binary(e_fl) + "\n" ) 
        }
    }

ListenerID1 = EDSIm.ImageAddEventListener( Listener1, messagemap)

Since speed is the issue here, I figured to try the continuous mode of the EDS acquisition. But then I would need to listen which counts belong to each scanned pixel. The following topic (How to getting acquired frames at full speed ? - Image Event Listener does not seem to be executing after every event) shows how to listen to the last pixel change of an image. But what would be the fastest way to directly see which slice of the 1D spectrum has changed on every event? Without going through every slice...

thanks in advance!


回答1:


An images' data_value_changed is fired whenever a) an image locker (the object that ensures there is single access to the memory) is released, or b) a specific update-call is made in the code.

As such, when a cumulative EDS spectrum is acquired, the whole array gets "locked", then modified (on one or more positions) and then 'updated'. There is no specific information carried on where the array was modified.

Therefore, the only way to find out where the spectrum changed is by comparing a copy of the "before" with the "now" - which is not super efficient.



来源:https://stackoverflow.com/questions/63632018/fastest-way-to-see-which-pixel-has-changed-when-using-a-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!