MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLKernel/mlSobel3DFilter.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //--------------------------------------------------------------------------------
00004 
00010 //--------------------------------------------------------------------------------
00011 // Prevent multiple including of this file.
00012 #if !defined(__mlSobel3DFilter_H)
00013 #define __mlSobel3DFilter_H
00014 
00015 // ML-includes
00016 #ifndef __mlInitSystemKernel_H
00017 #include "mlInitSystemKernel.h"
00018 #endif
00019 #ifndef __mlKernel_H
00020 #include "mlKernel.h"
00021 #endif
00022 #ifndef __mlKernelModule_H
00023 #include "mlKernelModule.h"
00024 #endif
00025 
00026 ML_START_NAMESPACE
00027 
00028   //--------------------------------------------------------------------------------
00036   //--------------------------------------------------------------------------------
00037   class MLKERNELEXPORT Sobel3DFilter : public KernelModule {
00038 
00039   public:
00040 
00041     //-------------------------------------------------------------------
00056     //-------------------------------------------------------------------
00057     Sobel3DFilter();
00058 
00059     //-------------------------------------------------------------------
00061 
00062     //-------------------------------------------------------------------
00063     inline FloatField*  getEdgeThresholdMinimumValueFld() const { return _edgeThresholdMinimumValueFld; }
00064     inline FloatField*  getEdgeThresholdMaximumValueFld() const { return _edgeThresholdMaximumValueFld; }
00065     inline FloatField*  getDetectedEdgeValueFld        () const { return _detectedEdgeValueFld        ; }
00066     inline FloatField*  getDetectedNonEdgeValueFld     () const { return _detectedNonEdgeValueFld     ; }
00067     inline EnumField*   getFilterModeFld               () const { return _filterModeFld               ; }
00068     inline BoolField*   getVoxelSizeFld                () const { return _useVoxelSizeFld             ; }
00069   
00071 
00073   enum Sobel3DModeTypes {
00074       GRAD_STRENGTH       = 0,
00075       EDGE_DETECTION      = 1,
00076       GRAD_ESTIMATION     = 2,
00077 
00078   SELECT_MODE
00079   };
00080 
00083   static const char* const Sobel3DModeNames[SELECT_MODE];
00084 
00085 /*
00086 enum BitMorphologyFilterTypes {
00087       ID                        = 0,
00088       BIT_DILATION              ,
00089       BIT_EROSION               ,
00090 
00091       NUM_BIT_MORPHOLOGY_FILTERS
00092     };
00093 
00095     static const char* const BitMorphologyFilterNames[NUM_BIT_MORPHOLOGY_FILTERS];
00096 */
00097 
00098   protected:
00099 
00100     //----------------------------------------------------------------------------
00101     // Here you can implement your own methods or you can overload
00102     // methods like \c handleNotification(), \c calcOutImgProps(), 
00103     // _updateKernel(), etc.
00104     // IMPORTANT: When deriving from \c KernelModule you need to
00105     //            call the overloaded superclass methods correctly
00106     //            to be sure that no functionality is lost.
00107     //            When deriving from \c Module that's often not
00108     //            necessary.
00109     //----------------------------------------------------------------------------
00110 
00116     CALC_ROW_H();
00117 
00120     template <typename DATATYPE>                                            
00121       void calcRow(MLsoffset         *indexTab,
00122                    size_t            indexTabSize,
00123                    MLsoffset         /*srcVoxelOffset*/,    
00124                    size_t            numVox,
00125                    TSubImageWithCursor<DATATYPE> &inSubImg,
00126                    TSubImageWithCursor<DATATYPE> &outSubImg,
00127                    const ImageVector &/*rowStart*/);
00128 
00130     virtual void handleNotification(Field* field);
00131 
00133     virtual void calculateOutputImageProperties(int outIndex);
00134 
00135 private:
00136 
00138     FloatField*  _edgeThresholdMinimumValueFld;
00139 
00141     FloatField*  _edgeThresholdMaximumValueFld;
00142 
00144     FloatField*  _detectedEdgeValueFld;
00145 
00147     FloatField*  _detectedNonEdgeValueFld;
00148 
00151     EnumField*   _filterModeFld;
00152 
00154     BoolField* _useVoxelSizeFld;
00155    
00157     Kernel       _sobelKernX;    
00158 
00160     Kernel       _sobelKernY;
00161 
00163     Kernel       _sobelKernZ;
00164 
00166     static KernelDataType _sKernX[27];
00167 
00169     static KernelDataType _sKernY[27];
00170 
00172     static KernelDataType _sKernZ[27];
00173 
00175     static KernelDataType _dKern[27];
00176 
00179     MLdouble _scaleFac;
00180 
00185     ML_MODULE_CLASS_HEADER(Sobel3DFilter);
00186   };
00187 
00188 ML_END_NAMESPACE
00189 
00190 #endif //of __mlSobel3DFilter_H
00191 
00192