[OpendTect_Developers] Horizon Z transformer class
Ranojay Sen
ranojay.sen at dgbes.com
Tue Aug 30 09:18:19 CEST 2011
Dear All,
While working with some flattening mechanism, I had to add a
EM::HorizonZTransformer class in EarthModel which can flatten/unflatten
horizons based on a reference horizon and creates a new output horizon
with flattened z values. It is an executor, and for every BinID it uses
z value of reference horizon and target horizon and calculates the new
flattened z value, and puts it to the new horizon. I have made a sample
program with a simple UI for reading the reference, target and output
horizons and do the processing in the accecptOK function. I will explain
a part of the code here the rest of the code will be in the attached files.
EM::Horizon* uiHorizonTransformer::getHorizon( const IOObj& ioobj ) //
simple function to read horizon objects
{}
#define mGetHor( hornm, fld ) // macro defined in the file
bool uiHorizonTransformer::acceptOK( CallBacker* )
{
EM::Horizon* hor;
const IOObj* ioobj;
mGetHor( refhor, refhorizonfld_ ); // call the function with the
macro and load the horizon.
mGetHor( tarhor, tarhorizonfld_ );
mGetHor( newhor, outputhorizonfld_ );
const StepInterval<int> inlrg = refhor->geometry().rowRange();
const StepInterval<int> crlrg = refhor->geometry().colRange();
newhor->ref();
newhor->geometry().removeAll();
newhor->enableGeometryChecks( false );
const RowCol step( inlrg.step, crlrg.step );
newhor->geometry().setStep( step, step );
newhor->geometry().addSection( "", false ); // clear all the
geometries of the new horizon and initialise as an empty horizon
EM::HorizonZTransform* transform = new EM::HorizonZTransform;
transform->setHorizon( *refhor ); // create a Horizon transfrom
from from the refhor
EM::HorizonZTransformer transformer( *transform, *tarhor, true );
//This is the transformer object with its parameters last parameter
true/false for flattening/unflattening
transformer.setOutputHorizon( *newhor ); // sets the output horizon
uiTaskRunner tr( this );
if ( !tr.execute( transformer ) )
return false;
PtrMan<Executor> saver = newhor->saver(); // once the execution
succeeds .. save it
return tr.execute( *saver.ptr() );
}
This was just a simple description for using this class. The source
codes can be compiled and run just to see how it works.
Regards
Ranojay
--
Ranojay Sen
dGB Earth Sciences - India
304, Gateway Plaza
Hiranandani Gardens, Powai
Mumbai-400076
India
http://www.dgbes.com http://www.opendtect.org
Phone: +91 22 25704984
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: uihorizontransformer.cc
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20110830/e45aacbc/attachment.cc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: uihorizontransformer.h
URL: <http://lists.opendtect.org/pipermail/developers/attachments/20110830/e45aacbc/attachment.h>
More information about the Developers
mailing list