00001 // $Revision: 1.7 $ $Author: schwehr $ $Date: 2004/11/03 00:29:23 $ 00002 #ifndef _DENSITY_FLAGGED_H_ 00003 #define _DENSITY_FLAGGED_H_ 00004 /* 00005 Copyright (C) 2004 Kurt Schwehr 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 */ 00022 00023 #include <vector> 00024 00027 00028 00029 //#include "Density.H" 00030 class Density; 00031 00036 00037 class DensityFlagged : public Density { 00038 public: 00039 DensityFlagged(const size_t width, const size_t height, const size_t depth, 00040 const float minX, const float maxX, 00041 const float minY, const float maxY, 00042 const float minZ, const float maxZ 00043 ); 00044 00046 size_t getLargest() const; 00048 size_t getLargestUnflagged() const; 00049 00053 size_t getLargestNeighbor(const size_t index) const; 00057 size_t getLargestUnflaggedNeighbor(const size_t index) const; 00058 00061 bool isFlagged(size_t i) const {assert(isValidCell(i)); return(flags[i]);} 00062 void setFlag(size_t i, bool v=true) {assert(isValidCell(i)); flags[i]=v;} 00063 size_t getNumFlagged() const; 00064 00067 size_t getFlaggedCount() const; 00068 00070 size_t getNumUsed() const {return(used.size());} 00072 size_t getUsedIndex(const size_t i) const {assert(i<used.size());return(used[i]);} 00073 00075 size_t getLargestNeighborOfFlagged() const; 00076 00080 void buildBlob(const float percent); 00081 00083 void printBlob() const; 00084 00085 private: 00086 std::vector<bool> flags; 00087 std::vector<size_t> used; 00088 }; 00089 00090 00091 #endif // _DENSITY_FLAGGED_H_