[Developers] Prepare an attribute for computation: 3 specific functions

Helene Huck helene.huck at dgb-group.com
Fri Nov 16 10:29:43 CET 2007


Dear all,

As an increasing number of programmers are now developing plugins to
OpendTect, we get more and more feedback and requests for
attribute-specific functions.
Of course every attribute is different and as such requires a specific
handling, thus it is now obvious for instance that a single 'init'
function cannot  be enough to fulfill all the needs.
 
I would like here to put the accent on three different functions which
will help preparing the attribute at different time levels before the
actual computation starts; as every attribute is a 'Attrib::Provider',
all these functions are virtual and visible in 
/AttributeEngine/attribprovider.h.

let's review them in chronological order:

* First of all a new function, prepPriorToOutputSetup(): this function
is especially helpful for those who plan to create multi-components
outputs. It returns whether the outputs plan acquired from the parameter
file has to be overruled.
To make it clear let's take an example: just imagine that your attribute
can output 5 different results, and for some reason you want to compute
all of them in one go ( and use this as input for another specific
attribute for instance );  there was no way to do it before, unless
hacking yourself in the parameter file to duplicate the attribute (which
I think we all agree a user will not really like to do...);
you can now use this new function to do it:

bool MyAttrib::prepPriorToOutputSetup()
{
    enableAllOutputs( true );
    return true;
}

* Then again a new function, prepPriorToBoundsCalc(); as said in its
name, this virtual function will be called before the boundaries - i.e.
the desired and possible volumes - are computed; at that time the Z
reference step is known. This is very handy for instance if your
attribute requires a user-defined timegate as parameter,  this is the 
place were you can adjust the gate so that start and stop are at sample
location; this is indeed what we now use in the Similarity or Volume
Statistics attributes ( Attributes/similarityattrib.cc,
Attributes/volstatsattrib.cc ).

* And the last one, prepareForComputeData() is the last function called
before the actual computation starts, which means that everything is
known : outputs number and shape, Z reference step, possible volume...

I think it now covers the whole range of what you may want to do to
prepare your attribute;

as a remark I can still mention that the old function 'init' has been
replaced by
bool checkInpAndParsAtStart() as its name was far too confusing; this
function is used at attribute creation.

For further information you can always get back to us,
best regards,
Helene

-- 
-- Helene Huck
-- Geophysical software engineer
-- dGB Earth Sciences B.V.
-- Nijverheidstraat 11-2, 7511 JM Enschede, The Netherlands
-- mailto: helene.huck at dgb-group.com, http://www.dgb-group.com
-- Tel: +31 53 4315155 , Fax: +31 53 4315104





More information about the Developers mailing list