include/voreen/core/datastructures/volume/bricking/errorlodselector.h
00001 /********************************************************************** 00002 * * 00003 * Voreen - The Volume Rendering Engine * 00004 * * 00005 * Copyright (C) 2005-2010 The Voreen Team. <http://www.voreen.org> * 00006 * * 00007 * This file is part of the Voreen software package. Voreen is free * 00008 * software: you can redistribute it and/or modify it under the terms * 00009 * of the GNU General Public License version 2 as published by the * 00010 * Free Software Foundation. * 00011 * * 00012 * Voreen 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 * in the file "LICENSE.txt" along with this program. * 00019 * If not, see <http://www.gnu.org/licenses/>. * 00020 * * 00021 * The authors reserve all rights not expressly granted herein. For * 00022 * non-commercial academic use see the license exception specified in * 00023 * the file "LICENSE-academic.txt". To get information about * 00024 * commercial licensing please contact the authors. * 00025 * * 00026 **********************************************************************/ 00027 00028 #ifndef VRN_ERRORLODSELECTOR_H 00029 #define VRN_ERRORLODSELECTOR_H 00030 00031 #include "voreen/core/datastructures/volume/bricking/bricklodselector.h" 00032 00033 namespace voreen { 00034 00039 struct ErrorStruct { 00040 00045 float improvementPerByte; 00046 00050 int memRequiredForImprovement; 00051 00055 int numVoxels; 00056 00060 int nextLod; 00061 00065 Brick* brick; 00066 00071 bool operator < (ErrorStruct const & other) const { 00072 return improvementPerByte < other.improvementPerByte; 00073 } 00074 00075 bool operator > (ErrorStruct const & other) const { 00076 return improvementPerByte > other.improvementPerByte; 00077 } 00078 00082 bool operator = (ErrorStruct const & other) const { 00083 return brick > other.brick; 00084 } 00085 }; 00086 00092 class ErrorLodSelector : public BrickLodSelector { 00093 00094 public: 00095 00096 ErrorLodSelector(BrickingInformation& brickingInformation); 00097 00102 virtual void selectLods(); 00103 00104 protected: 00105 00109 void initializeErrorSet(); 00110 00116 void calculateNextImprovement(ErrorStruct errorStruct); 00117 00123 std::set<ErrorStruct, std::greater<ErrorStruct> > errorSet_; 00124 00128 int voxelSizeInByte_; 00129 00133 int availableMemoryInByte_; 00134 00138 int usedMemoryInByte_; 00139 00140 private: 00141 00142 00143 00144 }; //end of class 00145 00146 00147 00148 } //namespace 00149 00150 00151 00152 00153 #endif