diff --git a/CHANGES.MD b/CHANGES.MD
index 8116b13..05587c0 100644
--- a/CHANGES.MD
+++ b/CHANGES.MD
@@ -1,4 +1,8 @@
-# OpendTect v5+ Plugins Release Notes
+# OpendTect Plugins Release Notes
+
+## Release 6.0.0
+### GradientAttrib
+- New attribute for calculating inline, crossline or z gradient using various derivative operators
## Release 6.0.0pre7-1
#### ExternalAttrib
diff --git a/CHANGES.html b/CHANGES.html
index db529a1..6542991 100644
--- a/CHANGES.html
+++ b/CHANGES.html
@@ -9,7 +9,8 @@
-OpendTect v5+ Plugins Release Notes
Release 6.0.0pre7-1
ExternalAttrib
+OpendTect Plugins Release Notes
Release 6.0.0
GradientAttrib
+- New attribute for calculating inline, crossline or z gradient using various derivative operators
Release 6.0.0pre7-1
ExternalAttrib
- Allow %ENVVAR% construct in interpreter field where ENVVAR is a system environment variable with the interpreter path [#12]
- Use environment variable, OD_EX_DIR, as the root of the folder structure containing the external attribute files [#13]
- Export ExternalAttrib and ExtProc classes to fix link errors during Windows build
Release 6.0.0pre7
- Port all attributes for compatibility with OpendTect v6
ExternalAttrib
- Hide input ui controls on change of attribute [#11]
Release 5.0.7
ExternalAttrib
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4420a5..821e769 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,6 +25,7 @@ set ( PLUGINS RSpecAttrib uiRSpecAttrib
MLVFilterAttrib uiMLVFilterAttrib
AVOAttrib uiAVOAttrib
ExternalAttrib uiExternalAttrib
+ GradientAttrib uiGradientAttrib
LTFAttrib uiLTFAttrib )
OD_ADD_MODULES( plugins ${PLUGINS} )
diff --git a/README.MD b/README.MD
index 5514af2..4cd617c 100644
--- a/README.MD
+++ b/README.MD
@@ -2,7 +2,7 @@
This is the source code for a collection of plugins for the open source seismic interpretation system [OpendTect v5+](http://www.opendtect.org). All code is provided under the terms of the [GNU General Public License Version 3](./LICENSE.txt).
-As of 24-Sep-2015 code development in the master branch is being transitioned to support the soon to be released OpendTect 6. If you are interested in the latest source code for OpendTect 5 please refer to the v5-stable branch of this repository.
+As of 24-Sep-2015 code development in the master branch is for plugin development for OpendTect 6. If you are interested in the latest source code for OpendTect 5 please refer to the v5-stable branch of this repository.
For details please see the [documentation](http://waynegm.github.io/OpendTect-Plugin-Docs/).
@@ -12,6 +12,7 @@ For details please see the [documentation](http://waynegm.github.io/OpendTect-Pl
|--------|-------------|
| [AVOAttrib](http://waynegm.github.io/OpendTect-Plugin-Docs/Attributes/AVOAttrib/) | Six attributes derived from reflection intercept and gradient |
| [ExternalAttrib](http://waynegm.github.io/OpendTect-Plugin-Docs/Attributes/ExternalAttrib/) | Calculate attribute using an external process such as a python script |
+| [GradientAttrib](http://waynegm.github.io/OpendTect-Plugin-Docs/Attributes/GradientAttrib/) | Calculate inline, crossline or z gradient using rotationally invariant operators |
| [LTFAttrib](http://waynegm.github.io/OpendTect-Plugin-Docs/Attributes/LTFAttrib/) | Local time-frequency decomposition |
| [MLVFilter](http://waynegm.github.io/OpendTect-Plugin-Docs/Attributes/MLVFilter/) | Structure preserving filtering |
| [RSpecAttrib](http://waynegm.github.io/OpendTect-Plugin-Docs/Attributes/RSpecAttrib/) | Recursive time-frequency decomposition |
diff --git a/README.html b/README.html
index 9bcb826..f20c998 100644
--- a/README.html
+++ b/README.html
@@ -9,7 +9,7 @@
-OpendTect v5+ Plugins
This is the source code for a collection of plugins for the open source seismic interpretation system OpendTect v5+. All code is provided under the terms of the GNU General Public License Version 3.
For details please see the documentation.
Plugins
+OpendTect v5+ Plugins
This is the source code for a collection of plugins for the open source seismic interpretation system OpendTect v5+. All code is provided under the terms of the GNU General Public License Version 3.
As of 24-Sep-2015 code development in the master branch is for plugin development for OpendTect 6. If you are interested in the latest source code for OpendTect 5 please refer to the v5-stable branch of this repository.
For details please see the documentation.
Plugins
PLUGIN |
@@ -26,6 +26,10 @@ GradientAttrib
+Calculate inline, crossline or z gradient using rotationally invariant operators |
+
+
LTFAttrib |
Local time-frequency decomposition |
diff --git a/plugins/GradientAttrib/CMakeLists.txt b/plugins/GradientAttrib/CMakeLists.txt
new file mode 100644
index 0000000..9319db4
--- /dev/null
+++ b/plugins/GradientAttrib/CMakeLists.txt
@@ -0,0 +1,13 @@
+#_______________________Pmake___________________________________________________
+#
+# Makefile : GradientAttrib plugin
+# Nov 2015 Wayne Mogg
+#_______________________________________________________________________________
+
+SET(OD_MODULE_DEPS AttributeEngine)
+SET(OD_IS_PLUGIN yes)
+SET(OD_MODULE_SOURCES
+ gradientattribpi.cc
+ gradientattrib.cc)
+SET( OD_PLUGIN_ALO_EXEC ${OD_ATTRIB_EXECS} )
+OD_INIT_MODULE()
diff --git a/plugins/GradientAttrib/gradientattrib.cc b/plugins/GradientAttrib/gradientattrib.cc
new file mode 100644
index 0000000..b798c41
--- /dev/null
+++ b/plugins/GradientAttrib/gradientattrib.cc
@@ -0,0 +1,220 @@
+/*Copyright (C) 2015 Wayne Mogg All rights reserved.
+
+This file may be used either under the terms of:
+
+1. The GNU General Public License version 3 or higher, as published by
+the Free Software Foundation,
+
+This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/*+
+________________________________________________________________________
+
+ Author: Wayne Mogg
+ Date: November 2015
+________________________________________________________________________
+
+-*/
+
+#include "gradientattrib.h"
+
+#include "arrayndimpl.h"
+#include "attribdataholder.h"
+#include "attribdesc.h"
+#include "attribdescset.h"
+#include "attribfactory.h"
+#include "attribparam.h"
+#include
+
+namespace Attrib
+{
+
+mAttrDefCreateInstance(GradientAttrib)
+
+
+void GradientAttrib::initClass()
+{
+ mAttrStartInitClass
+
+ EnumParam* op_type = new EnumParam( operatorStr() );
+ op_type->addEnum("Kroon_3");
+ op_type->addEnum("Farid_5");
+ op_type->addEnum("Farid_7");
+ op_type->setDefaultValue( GradientAttrib::Kroon_3 );
+ desc->addParam( op_type );
+
+ EnumParam* out_type = new EnumParam( outputStr() );
+ out_type->addEnum( "Inline" );
+ out_type->addEnum( "Crossline" );
+ out_type->addEnum( "Z" );
+ out_type->setDefaultValue( GradientAttrib::Z );
+ desc->addParam( out_type );
+
+ desc->addInput( InputSpec("Input data",true) );
+ desc->addOutputDataType( Seis::UnknowData );
+
+ desc->setLocality( Desc::MultiTrace );
+ mAttrEndInitClass
+}
+
+const float GradientAttrib::kroon_3_d[] = { -0.500000, 0.000000, 0.500000 };
+const float GradientAttrib::kroon_3_s[] = { 0.178947, 0.642105, 0.178947 };
+const float GradientAttrib::farid_5_d[] = { -0.109604, -0.276691, 0.000000, 0.276691, 0.109604 };
+const float GradientAttrib::farid_5_s[] = { 0.037659, 0.249153, 0.426375, 0.249153, 0.037659 };
+const float GradientAttrib::farid_7_d[] = { -.018708, -0.125376, -0.193091, 0.000000, 0.193091, 0.125376, 0.018708 };
+const float GradientAttrib::farid_7_s[] = { 0.004711, 0.069321, 0.245410, 0.361117, 0.245410, 0.069321, 0.004711 };
+
+
+GradientAttrib::GradientAttrib( Desc& desc )
+ : Provider( desc )
+ , size_(0)
+ , stepout_(0,0)
+ , zmargin_(0,0)
+{
+ if ( !isOK() ) return;
+
+ inputdata_.allowNull(true);
+
+ mGetEnum( outtype_, outputStr() );
+ mGetEnum( optype_, operatorStr() );
+ float* skernel = NULL;
+ float* dkernel = NULL;
+
+ switch(optype_)
+ {
+ case Kroon_3: size_ = 3;
+ skernel = new float[size_];
+ dkernel = new float[size_];
+ OD::memCopy( skernel, kroon_3_s, size_*sizeof(float) );
+ OD::memCopy( dkernel, kroon_3_d, size_*sizeof(float) );
+ break;
+ case Farid_5: size_ = 5;
+ skernel = new float[size_];
+ dkernel = new float[size_];
+ OD::memCopy( skernel, farid_5_s, size_*sizeof(float) );
+ OD::memCopy( dkernel, farid_5_d, size_*sizeof(float) );
+ break;
+ case Farid_7: size_ = 7;
+ skernel = new float[size_];
+ dkernel = new float[size_];
+ OD::memCopy( skernel, farid_7_s, size_*sizeof(float) );
+ OD::memCopy( dkernel, farid_7_d, size_*sizeof(float) );
+ break;
+ };
+
+ ikernel_ = new float[size_];
+ xkernel_ = new float[size_];
+ zkernel_ = new float[size_];
+ OD::memCopy( ikernel_, skernel, size_*sizeof(float) );
+ OD::memCopy( xkernel_, skernel, size_*sizeof(float) );
+ OD::memCopy( zkernel_, skernel, size_*sizeof(float) );
+ switch(outtype_)
+ {
+ case Inline: OD::memCopy( ikernel_, dkernel, size_*sizeof(float) );
+ break;
+ case Crossline: OD::memCopy( xkernel_, dkernel, size_*sizeof(float) );
+ break;
+ case Z: OD::memCopy( zkernel_, dkernel, size_*sizeof(float) );
+ break;
+ };
+ delete [] skernel;
+ delete [] dkernel;
+
+ const int hsz = size_/2;
+
+ stepout_ = is2D() ? BinID(0,hsz) : BinID(hsz,hsz);
+ getTrcPos();
+ zmargin_ = Interval(-hsz, hsz);
+ inputdata_.allowNull( true );
+}
+
+GradientAttrib::~GradientAttrib()
+{
+ delete [] ikernel_;
+ delete [] xkernel_;
+ delete [] zkernel_;
+}
+
+bool GradientAttrib::getTrcPos()
+{
+ trcpos_.erase();
+ BinID bid;
+ int trcidx = 0;
+ centertrcidx_ = 0;
+ for ( bid.inl()=-stepout_.inl(); bid.inl()<=stepout_.inl(); bid.inl()++ )
+ {
+ for ( bid.crl()=-stepout_.crl(); bid.crl()<=stepout_.crl(); bid.crl()++ )
+ {
+ if ( !bid.inl() && !bid.crl() )
+ centertrcidx_ = trcidx;
+ trcpos_ += bid;
+ trcidx++;
+ }
+ }
+
+ return true;
+}
+
+bool GradientAttrib::getInputData( const BinID& relpos, int zintv )
+{
+ while ( inputdata_.size() < trcpos_.size() )
+ inputdata_ += 0;
+
+ const BinID bidstep = inputs_[0]->getStepoutStep();
+ for ( int idx=0; idxgetData( relpos+trcpos_[idx]*bidstep, zintv );
+ if ( !data ) return false;
+ inputdata_.replace( idx, data );
+ }
+
+ dataidx_ = getDataIndex( 0 );
+
+ return true;
+}
+
+bool GradientAttrib::computeData( const DataHolder& output, const BinID& relpos,
+ int z0, int nrsamples, int threadid ) const
+{
+
+ if ( inputdata_.isEmpty() ) return false;
+
+ const int sz = zmargin_.width() + nrsamples;
+ Array1DImpl vals( sz );
+ const int hsz = size_/2;
+
+ for ( int idx=0; idx* desZSampMargin(int input,int output) const
+ { return &zmargin_; }
+
+ bool getTrcPos();
+
+ BinID stepout_;
+ Interval zmargin_;
+ TypeSet trcpos_;
+ int centertrcidx_;
+ int outtype_;
+ int optype_;
+ int size_;
+
+ float *ikernel_, *xkernel_, *zkernel_;
+
+ int dataidx_;
+
+ ObjectSet inputdata_;
+};
+
+}; // namespace Attrib
+
+
+#endif
+
+
diff --git a/plugins/GradientAttrib/gradientattribpi.cc b/plugins/GradientAttrib/gradientattribpi.cc
new file mode 100644
index 0000000..0c23f8b
--- /dev/null
+++ b/plugins/GradientAttrib/gradientattribpi.cc
@@ -0,0 +1,46 @@
+/*Copyright (C) 2015 Wayne Mogg All rights reserved.
+
+This file may be used either under the terms of:
+
+1. The GNU General Public License version 3 or higher, as published by
+the Free Software Foundation, or
+
+This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+*/
+/*+
+________________________________________________________________________
+
+ Author: Wayne Mogg
+ Date: November 2015
+ ________________________________________________________________________
+
+-*/
+
+#include "gradientattrib.h"
+#include "odplugin.h"
+#include "gradientattribmod.h"
+
+
+
+mDefODPluginEarlyLoad(GradientAttrib)
+
+mDefODPluginInfo(GradientAttrib)
+{
+ mDefineStaticLocalObject( PluginInfo, retpi,(
+ "Gradient Attribute (base)",
+ "Gradient Attribute (base)",
+ "Wayne Mogg",
+ "6.0",
+ "Inline, crossline and Z gradients for OpendTect v5+",
+ PluginInfo::GPL ) );
+ return &retpi;
+}
+
+
+mDefODInitPlugin(GradientAttrib)
+{
+ Attrib::GradientAttrib::initClass();
+ return 0;
+}
+
diff --git a/plugins/MLVFilterAttrib/mlvfilterattrib.h b/plugins/MLVFilterAttrib/mlvfilterattrib.h
index a0a8512..f6407fd 100644
--- a/plugins/MLVFilterAttrib/mlvfilterattrib.h
+++ b/plugins/MLVFilterAttrib/mlvfilterattrib.h
@@ -40,7 +40,7 @@ typedef TypeSet PlanePointSet;
typedef Geom::Point2D SamplePoint;
typedef TypeSet SamplePointSet;
-mClass(MLVFilterAttrib_5) MLVFilter : public Provider
+mClass(MLVFilterAttrib) MLVFilter : public Provider
{
public:
static void initClass();
diff --git a/plugins/uiGradientAttrib/CMakeLists.txt b/plugins/uiGradientAttrib/CMakeLists.txt
new file mode 100644
index 0000000..96ca3b3
--- /dev/null
+++ b/plugins/uiGradientAttrib/CMakeLists.txt
@@ -0,0 +1,13 @@
+#_______________________Pmake___________________________________________________
+#
+# Makefile : uiGradientAttrib plugin
+# Nov 2015 Wayne Mogg
+#_______________________________________________________________________________
+
+SET(OD_MODULE_DEPS GradientAttrib uiODMain)
+SET(OD_IS_PLUGIN yes)
+SET(OD_MODULE_SOURCES
+ uigradientattribpi.cc
+ uigradientattrib.cc)
+SET( OD_PLUGIN_ALO_EXEC ${OD_MAIN_EXEC} )
+OD_INIT_MODULE()
\ No newline at end of file
diff --git a/plugins/uiGradientAttrib/uigradientattrib.cc b/plugins/uiGradientAttrib/uigradientattrib.cc
new file mode 100644
index 0000000..8314c87
--- /dev/null
+++ b/plugins/uiGradientAttrib/uigradientattrib.cc
@@ -0,0 +1,106 @@
+/*Copyright (C) 2015 Wayne Mogg. All rights reserved.
+
+This file may be used either under the terms of:
+
+1. The GNU General Public License version 3 or higher, as published by
+the Free Software Foundation, or
+
+This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/*+
+________________________________________________________________________
+
+ Author: Wayne Mogg
+ Date: November 2015
+ _______________________________________________________________________
+
+-*/
+
+#include "uigradientattrib.h"
+#include "gradientattrib.h"
+
+#include "attribdesc.h"
+#include "attribparam.h"
+#include "uiattribfactory.h"
+#include "uiattrsel.h"
+#include "uigeninput.h"
+
+using namespace Attrib;
+
+static const char* opstr[] =
+{
+ "Kroon 3x3x3",
+ "Farid 5x5x5",
+ "Farid 7x7x7",
+ 0
+};
+static const char* outstr[] =
+{
+ "Inline",
+ "Crossline",
+ "Z",
+ 0
+};
+
+mInitAttribUI(uiGradientAttrib,GradientAttrib,"Gradient Attribute",sKeyFilterGrp())
+
+
+uiGradientAttrib::uiGradientAttrib( uiParent* p, bool is2d )
+ : uiAttrDescEd(p,is2d,"mToDoHelpID")
+
+{
+ inpfld_ = createInpFld( is2d );
+
+ outfld_ = new uiGenInput( this, tr("Output Gradient"), StringListInpSpec(outstr) );
+ outfld_->attach( alignedBelow, inpfld_ );
+
+ operatorfld_ = new uiGenInput( this, tr("Operator"), StringListInpSpec(opstr) );
+ operatorfld_->attach( alignedBelow, outfld_ );
+
+ setHAlignObj( outfld_ );
+}
+
+
+
+
+bool uiGradientAttrib::setParameters( const Attrib::Desc& desc )
+{
+ if ( desc.attribName() != GradientAttrib::attribName() )
+ return false;
+
+ mIfGetEnum(GradientAttrib::outputStr(),output, outfld_->setValue(output) )
+ mIfGetEnum(GradientAttrib::operatorStr(), opert, operatorfld_->setValue(opert))
+ return true;
+}
+
+
+bool uiGradientAttrib::setInput( const Attrib::Desc& desc )
+{
+ putInp( inpfld_, desc, 0 );
+ return true;
+}
+
+
+bool uiGradientAttrib::getParameters( Attrib::Desc& desc )
+{
+ if ( desc.attribName() != GradientAttrib::attribName() )
+ return false;
+
+ mSetEnum( GradientAttrib::outputStr(), outfld_->getIntValue() );
+ mSetEnum( GradientAttrib::operatorStr(), operatorfld_->getIntValue() );
+
+ return true;
+}
+
+
+bool uiGradientAttrib::getInput( Attrib::Desc& desc )
+{
+ inpfld_->processInput();
+ fillInp( inpfld_, desc, 0 );
+ return true;
+}
+
+
+
diff --git a/plugins/uiGradientAttrib/uigradientattrib.h b/plugins/uiGradientAttrib/uigradientattrib.h
new file mode 100644
index 0000000..bbd0676
--- /dev/null
+++ b/plugins/uiGradientAttrib/uigradientattrib.h
@@ -0,0 +1,57 @@
+/*Copyright (C) 2015 Wayne Mogg. All rights reserved.
+
+This file may be used either under the terms of:
+
+1. The GNU General Public License version 3 or higher, as published by
+the Free Software Foundation, or
+
+This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+#ifndef uigradientattrib_h
+#define uigradientattrib_h
+
+/*+
+________________________________________________________________________
+
+ Author: Wayne Mogg
+ Date: November 2015
+ ________________________________________________________________________
+
+-*/
+
+#include "uigradientattribmod.h"
+#include "uiattrdesced.h"
+
+class uiAttrSel;
+class uiGenInput;
+
+
+
+/*! \brief Compute Inline,Crossline or Z Gradient description editor */
+
+class uiGradientAttrib : public uiAttrDescEd
+{ mODTextTranslationClass(uiGradientAttrib);
+public:
+
+ uiGradientAttrib(uiParent*,bool);
+
+protected:
+
+ uiAttrSel* inpfld_;
+ uiGenInput* operatorfld_;
+ uiGenInput* outfld_;
+
+ bool setParameters(const Attrib::Desc&);
+ bool setInput(const Attrib::Desc&);
+ bool getParameters(Attrib::Desc&);
+ bool getInput(Attrib::Desc&);
+
+ mDeclReqAttribUIFns
+};
+
+
+#endif
+
+
diff --git a/plugins/uiGradientAttrib/uigradientattribpi.cc b/plugins/uiGradientAttrib/uigradientattribpi.cc
new file mode 100644
index 0000000..d32323a
--- /dev/null
+++ b/plugins/uiGradientAttrib/uigradientattribpi.cc
@@ -0,0 +1,46 @@
+/*Copyright (C) 2015 Wayne Mogg. All rights reserved.
+
+This file may be used either under the terms of:
+
+1. The GNU General Public License version 3 or higher, as published by
+the Free Software Foundation, or
+
+This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+*/
+
+/*+
+________________________________________________________________________
+
+ Author: Wayne Mogg
+ Date: November 2015
+ ________________________________________________________________________
+
+-*/
+
+#include "uimenu.h"
+#include "uiodmain.h"
+#include "odplugin.h"
+
+#include "uigradientattrib.h"
+
+
+mDefODPluginInfo(uiGradientAttrib)
+{
+ mDefineStaticLocalObject( PluginInfo, retpi,(
+ "Inline, Crossline or Z gradient Attribute (UI)",
+ "Inline, Crossline or Z gradient Attribute (UI)",
+ "Wayne Mogg",
+ "6.0",
+ "",
+ PluginInfo::GPL ) );
+ return &retpi;
+}
+
+
+mDefODInitPlugin(uiGradientAttrib)
+{
+ uiGradientAttrib::initClass();
+ return 0;
+}
+