1 #ifndef _VOLUMEIMAGET_H_
2 #define _VOLUMEIMAGET_H_
21 #include <IsoEx/Grids/ScalarGridT.hh>
22 #include <IsoEx/Grids/VectorFieldT.hh>
27 #include <QDataStream>
35 #define THRESHOLD 0.05
69 template <
class Scalar>
76 typedef typename VectorField::Vector Vec3;
80 const Vec3& _x_axis = Vec3( 1,0,0 ),
81 const Vec3& _y_axis = Vec3( 0,1,0 ),
82 const Vec3& _z_axis = Vec3( 0,0,1 ),
83 unsigned int _x_res = 10,
84 unsigned int _y_res = 10,
85 unsigned int _z_res = 10 )
86 :
ScalarGridT<Scalar>( _origin, _x_axis, _y_axis, _z_axis, _x_res, _y_res, _z_res )
95 Dimension(
unsigned int _x = 1,
unsigned int _y = 1,
unsigned int _z = 1,
96 Scalar _sx = 1, Scalar _sy = 1, Scalar _sz = 1,
97 Scalar _tx = 0, Scalar _ty = 0, Scalar _tz = 0,
99 : x( _x ), y( _y ),
z( _z ),
100 sx( _sx ), sy( _sy ),
sz( _sz ),
101 tx( _tx ), ty( _ty ),
tz( _tz ),
105 unsigned int x, y,
z;
114 return ( x != di.x &&
122 int max_di(){
return std::max( std::max( x,y ),z );}
127 Neighbor(
int _x,
int _y,
int _z, Scalar _w ) :
140 typedef std::vector< Neighbor > GaussKernel;
153 void init(
const Vec3& _origin,
159 unsigned int _z_res );
162 virtual bool read(
const char* _fname );
165 void getByteData( std::vector<unsigned char> &_result )
const;
166 void getByteDataGradient( std::vector<unsigned char> &_result )
const;
168 void getData( std::vector<float> &_result )
const;
169 void getDataGradient( std::vector<float> &_result )
const;
173 Scalar max_value(){
return max_value_;}
174 Scalar min_value(){
return min_value_;}
178 void bilateral_filter_simple( Scalar _sigma_s, Scalar _sigma_r,
int _iterations );
182 void normalize(
double _min,
double _max );
183 void clamp(
double _min,
double _max );
184 void normalize_with_histogram( Scalar _max, Scalar _percent,
int _n_bins = 1000 );
186 std::vector<unsigned int> &_bins,
188 bool _to_image =
false );
195 void normalize_gradients();
196 Vec3 calcGradient(
const unsigned int &_x,
197 const unsigned int &_y,
198 const unsigned int &_z );
212 VectorField grad_field_;
215 void i_to_xyz(
int _i,
int &_x,
int &_y,
int &_z );
216 void get_neighbors_in_r(
const unsigned int &_p,
const int _r, std::vector<unsigned int> &_n );
217 void set_bandwidth( Scalar _hs, Scalar _hr );
218 void bilateral_update( std::vector<Scalar> &_src,
219 std::vector<Scalar> &_dst,
220 const unsigned int &_point_idx,
223 void bilateral_update_simple( std::vector<Scalar> &_src,
224 std::vector<Scalar> &_dst,
225 int _x,
int _y,
int _z, Scalar _hs );
226 void precalculate_gauss_kernel( Scalar _sigma_s, Scalar _threshold = 0.08 );
230 GaussKernel cur_gauss_kernel_;
234 #if defined(INCLUDE_TEMPLATES) && !defined(ISOEX_VOLUMEIMAGET_C)
235 #define ISOEX_VOLUMEIMAGET_TEMPLATES
236 #include "VolumeImageT.cc"
void histogram(const int _n_bins, std::vector< unsigned int > &_bins, Scalar &_size, bool _to_image=false)
Definition: VolumeImageT.cc:1364
Image will use 32 bit Scalars.
Definition: VolumeImageT.hh:149
Scalar sz
Thickness of each dimension.
Definition: VolumeImageT.hh:106
Image will use 16 bit integers.
Definition: VolumeImageT.hh:147
unsigned int z
Dimensions of the image.
Definition: VolumeImageT.hh:105
bool operator!=(const Dimension &di)
Compares two Dimension structures.
Definition: VolumeImageT.hh:112
Scalar scale
A scaling factor for the data.
Definition: VolumeImageT.hh:108
Image will use bytes.
Definition: VolumeImageT.hh:146
Image will use 16 bit Scalars.
Definition: VolumeImageT.hh:148
virtual ~VolumeImageT()
Destructor.
Definition: VolumeImageT.hh:90
Definition: VolumeImageT.hh:70
void normalize()
normalization and clamping
Definition: VolumeImageT.cc:1038
VectorField & grad_field()
access to gradient field
Definition: VolumeImageT.hh:201
void assign_gradients()
Gradient calculation.
Definition: VolumeImageT.cc:1300
void getByteData(std::vector< unsigned char > &_result) const
Returns an array of bytes.
Definition: VolumeImageT.cc:545
void bilateral_filter(Scalar _hs, Scalar _hr, int _iterations)
Filter.
Definition: VolumeImageT.cc:699
A type for volume images, or 3D textures.
VolumeImageT(const Vec3 &_origin=Vec3(0, 0, 0), const Vec3 &_x_axis=Vec3(1, 0, 0), const Vec3 &_y_axis=Vec3(0, 1, 0), const Vec3 &_z_axis=Vec3(0, 0, 1), unsigned int _x_res=10, unsigned int _y_res=10, unsigned int _z_res=10)
Default constructor.
Definition: VolumeImageT.hh:79
Image will use logarithmic byte encoding.
Definition: VolumeImageT.hh:150
Definition: VolumeImageT.hh:125
Definition: VolumeImageT.hh:93
Scalar tz
Translation to origin.
Definition: VolumeImageT.hh:107
virtual bool read(const char *_fname)
load and save
Definition: VolumeImageT.cc:40
enum IsoEx::VolumeImageT::Formats VolumeImageMode
Determines data type of stored image.
Formats
Determines data type of stored image.
Definition: VolumeImageT.hh:144
void update_min_max()
min/max scalar value
Definition: VolumeImageT.cc:513
Definition: ScalarGridT.hh:39