00001 /* 00002 TerraLib - a library for developing GIS applications. 00003 Copyright 2001, 2002, 2003 INPE and Tecgraf/PUC-Rio. 00004 00005 This code is part of the TerraLib library. 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 You should have received a copy of the GNU Lesser General Public 00012 License along with this library. 00013 00014 The authors reassure the license terms regarding the warranties. 00015 They specifically disclaim any warranties, including, but not limited to, 00016 the implied warranties of merchantability and fitness for a particular 00017 purpose. The library provided hereunder is on an "as is" basis, and the 00018 authors have no obligation to provide maintenance, support, updates, 00019 enhancements, or modifications. 00020 In no event shall INPE be held liable to any party 00021 for direct, indirect, special, incidental, or consequential damages arising 00022 out of the use of this library and its documentation. 00023 */ 00024 00025 #ifndef TEPDIBUFFEREDFILTER_HPP 00026 #define TEPDIBUFFEREDFILTER_HPP 00027 00028 #include "TePDIAlgorithm.hpp" 00029 #include "TePDIParameters.hpp" 00030 #include "TePDITypes.hpp" 00031 #include "TePDIFilterMask.hpp" 00032 #include "../kernel/TeSharedPtr.h" 00033 00034 /** 00035 * @brief This is the base class for buffer based filters. 00036 * @author Emiliano F. Castejon <castejon@dpi.inpe.br> 00037 * @ingroup TePDIFiltersGroup 00038 */ 00039 class PDI_DLL TePDIBufferedFilter : public TePDIAlgorithm { 00040 public : 00041 /** @typedef Type definition for a instance pointer */ 00042 typedef TeSharedPtr< TePDIBufferedFilter > pointer; 00043 /** @typedef Type definition for a const instance pointer */ 00044 typedef const TeSharedPtr< TePDIBufferedFilter > const_pointer; 00045 00046 /** 00047 * @brief Default Destructor 00048 */ 00049 virtual ~TePDIBufferedFilter(); 00050 00051 protected : 00052 /** 00053 * @brief Convolution Buffer. 00054 */ 00055 double** conv_buf_; 00056 00057 /** 00058 * @brief Convolution Buffer lines. 00059 */ 00060 unsigned int conv_buf_lines_; 00061 00062 /** 00063 * @brief Convolution Buffer columns. 00064 */ 00065 unsigned int conv_buf_columns_; 00066 00067 /** 00068 * @brief Temporary representation of filter masks. 00069 */ 00070 double** temp_maskmatrix_; 00071 00072 /** 00073 * @brief Number of lines of the temporary representation of filter masks. 00074 */ 00075 unsigned int temp_maskmatrix_lines_; 00076 00077 /** 00078 * @brief Number of columns of the temporary representation of filter masks. 00079 */ 00080 unsigned int temp_maskmatrix_columns_; 00081 00082 /** 00083 * @brief Default Constructor. 00084 * 00085 */ 00086 TePDIBufferedFilter(); 00087 00088 /** 00089 * @brief Reset the internal state to the initial state. 00090 * 00091 * @param params The new parameters referente at initial state. 00092 */ 00093 virtual void ResetState( const TePDIParameters& params ); 00094 00095 /** 00096 * @brief Initiates the convolution buffer. 00097 */ 00098 void init_conv_buf(); 00099 00100 /** 00101 * @brief Initiates the internal filter mask matrix representation. 00102 */ 00103 void init_maskmatrix(); 00104 00105 /** 00106 * @brief Resets the convolution buffer. 00107 * 00108 * @param lines Convolution buffer lines. 00109 * @param columns Convolution buffer columns. 00110 */ 00111 void reset_conv_buf( unsigned int lines, unsigned int columns ); 00112 00113 /** 00114 * @brief Resets the internal filter mask matrix representation.. 00115 * 00116 * @param mask The new filter Mask. 00117 */ 00118 void reset_maskmatrix( TePDIFilterMask::pointer& mask ); 00119 00120 /** 00121 * @brief Updates the convolution buffer with a new raster line. 00122 * 00123 * @param inRaster Input Raster. 00124 * @param line Raster line. 00125 * @param band Raster band. 00126 */ 00127 void up_conv_buf( TePDITypes::TePDIRasterPtrType& inRaster, unsigned int line, 00128 unsigned int band ); 00129 00130 /** 00131 * @brief Generates statistics of a suplied window inside the convolution buffer. 00132 * 00133 * @param start_line Convolution buffer start line. 00134 * @param start_column Convolution buffer start column. 00135 * @param width Window width. 00136 * @param height Window height. 00137 * @param mean Mean. 00138 * @param variance variance. 00139 */ 00140 void conv_buf_estatistics( unsigned int start_line, unsigned int start_column, 00141 unsigned int width, unsigned int height, double& mean, double& variance ); 00142 00143 /** 00144 * @brief Rools up the convolution buffer count lines. 00145 * 00146 * @param count Count times to rool convolution buffer. 00147 */ 00148 void conv_buf_roolup( unsigned int count ); 00149 00150 }; 00151 00152 #endif //TEPDIBUFFEREDFILTER_HPP
1.5.3