From 27fee82dfb0f0896aa57d4ab347ad8dad8273f5c Mon Sep 17 00:00:00 2001 From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org> Date: Sat, 10 Apr 2010 10:02:34 +0800 Subject: [PATCH] BUG: remove TreeNeighborhood class as unused and untested after 4 years (considered useless) --- Code/FeatureExtraction/otbTreeNeighborhood.h | 123 ------------------ .../FeatureExtraction/otbTreeNeighborhood.txx | 123 ------------------ 2 files changed, 246 deletions(-) delete mode 100644 Code/FeatureExtraction/otbTreeNeighborhood.h delete mode 100644 Code/FeatureExtraction/otbTreeNeighborhood.txx diff --git a/Code/FeatureExtraction/otbTreeNeighborhood.h b/Code/FeatureExtraction/otbTreeNeighborhood.h deleted file mode 100644 index 3412d73b9d..0000000000 --- a/Code/FeatureExtraction/otbTreeNeighborhood.h +++ /dev/null @@ -1,123 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef __otbTreeNeighborhood_h -#define __otbTreeNeighborhood_h - -#if defined(_MSC_VER) -#pragma warning ( disable : 4786 ) -#endif - -#include "otbShape.h" - -namespace otb -{ - -/** \class TreeNeighborhood - * \brief Classe de base pour tous les objets de type "TreeNeighborhood". - * - * .... - * - * \ingroup TreeNeighborhoodObjects - */ - -class ITK_EXPORT Neighbor -{ -public: - Point_plane point; /* Neighbor pixel */ - float value; /* Its gray level */ - Neighbor() {}; - ~Neighbor() {} - -protected: - -private: - -}; - -class ITK_EXPORT Neighborhood -{ -public: - typedef enum {AMBIGUOUS, MIN, MAX, INVALID} TypeOfTree; - - Neighbor * tabPoints; /* The array of neighbors, organized as a binary tree */ - int iNbPoints; /* The size of the previous arrays */ - TypeOfTree type; /* max- or min- oriented heap? */ - float otherBound; /* Min gray level if max-oriented, max if min-oriented */ - - void reinit_neighborhood(TypeOfTree type); - void init_neighborhood(int iMaxArea, int iWidth, int iHeight); - void free_neighborhood(); - - void print_neighborhood(); - - int ORDER_MAX(int k, int l) - { - return (tabPoints[k].value > tabPoints[l].value); - } - int ORDER_MIN(int k, int l) - { - return (tabPoints[k].value < tabPoints[l].value); - } - int ORDER_MAX2(int k, int l) - { - return (tabPoints[k].value >= tabPoints[l].value); - } - int ORDER_MIN2(int k, int l) - { - return (tabPoints[k].value <= tabPoints[l].value); - } - void SWAP(int k, int l) - { - tabPoints[0] = tabPoints[k]; - tabPoints[k] = tabPoints[l]; - tabPoints[l] = tabPoints[0]; - } - - void fix_up(); - void fix_down(); - - Neighborhood() {}; - ~Neighborhood() {} - -protected: - -private: -}; - -class ITK_EXPORT Connection -{ -public: - Shape *shape; /* Largest shape of the monotone section */ - float level; /* Connection level */ - Connection() {}; - ~Connection() {} - -protected: - -private: - -}; - -} // end namespace otb - -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbTreeNeighborhood.txx" -#endif - -#endif diff --git a/Code/FeatureExtraction/otbTreeNeighborhood.txx b/Code/FeatureExtraction/otbTreeNeighborhood.txx deleted file mode 100644 index b898a1ca56..0000000000 --- a/Code/FeatureExtraction/otbTreeNeighborhood.txx +++ /dev/null @@ -1,123 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef __otbTreeNeighborhood_txx -#define __otbTreeNeighborhood_txx - -#include "otbTreeNeighborhood.h" -#include "otbMacro.h" - -namespace otb -{ - -/** - * - */ -/* Reinitialise the neighborhood, so that it will be used for a new region */ -void -Neighborhood::reinit_neighborhood(TypeOfTree type) -{ - iNbPoints = 0; - type = type; -} - -/* To allocate the structure representing the neighborhood of a region */ -void -Neighborhood::init_neighborhood(int iMaxArea, - int iWidth, int iHeight) -{ - iMaxArea = 4 * (iMaxArea + 1); - if (iMaxArea > iWidth * iHeight) iMaxArea = iWidth * iHeight; - - tabPoints = new Neighbor[iMaxArea + 1]; - if (tabPoints == NULL) std::cerr << "init_neighborhood --> neighbors allocation error" << std::endl; - reinit_neighborhood(AMBIGUOUS); -} - -/* Free the structure representing the neighborhood of a region */ -void -Neighborhood::free_neighborhood() -{ - delete[] tabPoints; -} - -/* Put the last neighbor at a position so that we fix the heap */ -void -Neighborhood::fix_up() -{ - Neighbor *tabPoints = tabPoints; - int k = iNbPoints; - int l; - - if (type == MAX) - while (k > 1 && ORDER_MAX(k, l = k >> 1)) - { - SWAP(k, l); - k = l; - } - else - while (k > 1 && ORDER_MIN(k, l = k >> 1)) - { - SWAP(k, l); - k = l; - } -} - -/* Put the first neighbor at a position so that we fix the heap */ -void -Neighborhood::fix_down() -{ - Neighbor *tabPoints = tabPoints; - int N = iNbPoints; - int k = 1; - int l; - - if (type == MAX) - while ((l = k << 1) <= N) - { - if (l < N && ORDER_MAX(l + 1, l)) ++l; - if (ORDER_MAX2(k, l)) break; - SWAP(k, l); - k = l; - } - else - while ((l = k << 1) <= N) - { - if (l < N && ORDER_MIN(l + 1, l)) ++l; - if (ORDER_MIN2(k, l)) break; - SWAP(k, l); - k = l; - } -} - -void -Neighborhood::print_neighborhood() -{ - otbMsgDevMacro(<< "pNeighborhood : "); - otbMsgDevMacro(<< " iNbPoints : " << iNbPoints); - for (int i = 0; i <= iNbPoints; ++i) - { - otbMsgDevMacro( - << "tabPoints[" << i << "] =" << tabPoints[i].value << " Position: (" << tabPoints[i].point.x << " , " << - tabPoints[i].point.y << ")"); - } - -} - -} -#endif -- GitLab