OpenStructure
Loading...
Searching...
No Matches
map_iso.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License as published by the Free
8// Software Foundation; either version 3.0 of the License, or (at your option)
9// any later version.
10// This library is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this library; if not, write to the Free Software Foundation, Inc.,
17// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//------------------------------------------------------------------------------
19#ifndef OST_GFX_MAP_ISO_HH
20#define OST_GFX_MAP_ISO_HH
21
22/*
23 Author: Ansgar Philippsen, Marco Biasini
24*/
25
26#include <boost/shared_ptr.hpp>
27
28#include <ost/img/map.hh>
29#include <ost/img/alg/stat.hh>
31
33#include "gfx_object.hh"
34#include "map_iso_prop.hh"
35
36namespace ost { namespace gfx {
37
42
43class MapIso;
44typedef boost::shared_ptr<MapIso> MapIsoP;
45
53public:
54 MapIso(const String& name, const img::MapHandle& mh,float level, uint a=0);
55
57 virtual geom::AlignedCuboid GetBoundingBox(bool use_global=false) const;
58
60 virtual geom::Vec3 GetCenter() const;
61
62 virtual void CustomRenderGL(RenderPass pass);
63
64 virtual void CustomRenderPov(PovState& pov);
65
66 virtual void OnInput(const InputEvent& e);
67
68 virtual void OnRenderModeChange();
69
70 void Rebuild();
71
75 void SetLevel(float l);
76
77 float GetMinLevel() const;
78 float GetMaxLevel() const;
79
81 float GetLevel() const;
82
84 float GetMean() const;
85
87 float GetStdDev() const;
88
89
91 std::vector<int> GetHistogram() const;
92
94 void SetHistogramBinCount(int count);
95
98
100 // The following is a hack. For the DataViewer I need to pass a reference to an ImagHandle
101 // that never goes out of scope, so I get a reference from here
103
105 // The following is a hack. For the DataViewer I need to pass a reference to an ImagHandle
106 // that never goes out of scope, so I get a reference from here
108
110 // The following is a hack. For the DataViewer I need to pass a reference to an ImagHandle
111 // that never goes out of scope, so I get a reference from here
113
116
119
122
125
130 void SetColor(const Color& color)
131 {
132 color_=color;
133 this->FlagRebuild();
134 }
137 const Color& GetColor() const { return color_; }
138 void SetNSF(float smoothf);
139 void SetDebugOctree(bool flag) { debug_octree_=flag; }
140
143
145 bool IfOctreeDirty() const;
146
148
149protected:
151 void CalculateStat() const;
152 void CalculateHistogram() const;
153 virtual void CustomPreRenderGL(bool flag);
155
156private:
157 img::MapHandle original_mh_;
158 img::MapHandle downsampled_mh_;
159 img::MapHandle mh_;
160 impl::MapOctree octree_;
161 mutable img::alg::Stat stat_;
162 mutable bool stat_calculated_;
163 mutable img::alg::Histogram histogram_;
164 mutable bool histogram_calculated_;
165 int histogram_bin_count_;
166 float level_;
167 bool normals_calculated_;
168 float smoothf_;
169 float min_;
170 float max_;
171 float std_dev_;
172 float min_max_;
173 bool debug_octree_;
174 Color color_;
175 bool dirty_octree_;
176 mutable geom::AlignedCuboid bb_;
177 mutable bool recalc_bb_;
178};
179
180}}
181
182#endif
axis-aligned cuboid
Three dimensional vector class, using Real precision.
Definition vec3.hh:48
main class for all graphic objects
Definition gfx_object.hh:52
isocontour rendering for 3D image data
Definition map_iso.hh:52
img::ImageHandle & GetOriginalMap()
get the map handle of the original map
img::ImageHandle & GetMap()
get the map handle of the currently displayed map
virtual void CustomRenderPov(PovState &pov)
void SetNSF(float smoothf)
std::vector< int > GetHistogram() const
get histogram
void ShowOriginalMap()
sets the original map to active
void CalculateHistogram() const
void MakeOctreeDirty()
flags the octree to be rebuilt
float GetMinLevel() const
void SetLevel(float l)
set isocontouring level
virtual void OnRenderModeChange()
void SetHistogramBinCount(int count)
set Histogram bin count
float GetLevel() const
get current isocontouring level
void ShowDownsampledMap()
sets the donwsampled map to active
static img::ImageHandle DownsampleMap(const img::ImageHandle &mh)
void SetColor(const Color &color)
set color
Definition map_iso.hh:130
virtual void OnInput(const InputEvent &e)
float GetStdDev() const
get std dev of map.
void SetDebugOctree(bool flag)
Definition map_iso.hh:139
void CalculateStat() const
virtual geom::AlignedCuboid GetBoundingBox(bool use_global=false) const
returns bounding box of iso-contour object, not overall map
bool IfOctreeDirty() const
checks is the octree needs to be rebuilt
int GetHistogramBinCount() const
get Histogram bin count
img::ImageHandle & GetDownsampledMap()
get the map handle of the downsampled map
float GetMaxLevel() const
virtual geom::Vec3 GetCenter() const
returns center of iso-contour object, not overall map
MapIso(const String &name, const img::MapHandle &mh, float level, uint a=0)
virtual void CustomRenderGL(RenderPass pass)
static bool global_downsampling_flag
Definition map_iso.hh:147
const Color & GetColor() const
get color
Definition map_iso.hh:137
MapIsoType GetShownMapType() const
returns the type of map currently being show
void UpdateRenderParams()
virtual void CustomPreRenderGL(bool flag)
float GetMean() const
get mean value of map
bool IsDownsampledMapAvailable() const
checks if the downsampled map is available
Octree datastructure for 3D images.
Manage shared instances of images.
non-modifying image state visitor plus non-mod algorithm
#define DLLEXPORT_OST_GFX
unsigned int uint
Definition base.hh:29
std::string String
Definition base.hh:54
@ DOWNSAMPLED_MAP
Definition map_iso.hh:40
@ ORIGINAL_MAP
Definition map_iso.hh:39
boost::shared_ptr< MapIso > MapIsoP
Definition map_iso.hh:44
Definition base.dox:1