[OpendTect_Developers] Working with PreStack Events

Ranojay Sen ranojay.sen at dgbes.com
Tue Nov 22 07:21:29 CET 2011


Dear All,

     OpendTect has built in classes for handling pre-stack data, it is 
possible to pick pre-stack-events on the pre-stack gathers, which appear 
as lines on the pre-stack gathers just like a horizon. In this post I 
would like to discuss how to retrieve pre-stack-events from pre-stack 
events manager and display them on offsets. Let us start with the 
PreStack::EventManager class which is the single interface for a set of 
pre-stack events.  The event-manager will have an entry and an object-id 
in the .omf file which has to be read by PSEventTranslatorGroup. Once 
the object is loaded it contains PreStack::EventSet for all the BinID's 
where the event has been picked. Thus for every BinID being used we have 
a  PreStack::EventSet object which in turn can have multiple events. 
After this much of background information I guess it would be better to 
show a code example to make things easier.

|bool loadPSEvents( MultiID& key )
{
     CtxtIOObj context = PSEventTranslatorGroup::ioContext(); // 
Translator Group
     context.ctxt.forread = true;
     uiIOObjSelDlg dlg(  getUiParent(), context,
             "Select prestack events", false );
     if ( !dlg.go() )
     return false;

     key = dlg.selected( 0 );
     if ( key.isEmpty() || eventname.isEmpty() )
     {
         BufferString errmsg = "Failed to load prestack event";
         uiMSG().error( errmsg );
         return false;
     }

     return true;
}


void showEvents( PreStack::EventManager* psem )
{
     BinIDValueSet locations( 0, false );
     psem.getLocations( locations ); // all the BinIDs where events have 
been picked.


     for ( int lidx=0; lidx<locations.totalSize(); lidx++ )
     {
     const BinID bid = locations.getBinID( locations.getPos(lidx) );
     RefMan<const PreStack::EventSet> eventset = psem.getEvents( bid, 
true ); // Get EventSet for every BinID.
     if ( !eventset )
         return;

     const int size = eventset->events_.size(); // Number of events in 
the eventset.

     for ( int idx=0; idx<size; idx++ )
     {
         const PreStack::Event* psevent = eventset->events_[idx]; // Get 
PreStack::Events one by one from PreStack::EventSet.
         if ( !psevent->sz_ )
         continue;
         const int sz = psevent->sz_; // size of the event ( Number of 
offsets and values )

         for ( int idy=0; idy<sz; idy++ ) // Iterate through each event 
for offset and values
         {
              const float offset = psevent->offsetazimuth_[idy].offset();
              const float pickval = ||psevent->pick_[idy] |
                          std::cout << "Offset : " << offset << "Pick 
Value : " << pickval << std::endl;
|        }


     }

     }

||}


int main()
{
     MultiID key;
||if ( !loadPSEvents( key ) )
         return 1;
     PreStack::EventManager* psem = new PreStack::EventManager;
     psem->setStorageID( key, true );
||showEvents( psem );
}
||

|||  I guess|this code will compile and run.

|    As always, questions and comments are welcome.

Regards
Ranojay|

|

-- 
Ranojay Sen
dGB Earth Sciences (India)
304, Gateway Plaza,
Hiranandani Gardens - Powai
Mumbai 400 076 - India -
Tel. +91 22 25704984 - Fax +91 22 25704977
www.dgbes.com www.opendtect.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20111122/d6cd605d/attachment.html>


More information about the Developers mailing list