Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

EMAN::MarchingCubes Class Reference

#include <marchingcubes.h>

Inheritance diagram for EMAN::MarchingCubes:

Inheritance graph
[legend]
Collaboration diagram for EMAN::MarchingCubes:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MarchingCubes ()
 Default constructor.
 MarchingCubes (EMData *em)
 Most commonly used constructor calls set_data(em).
virtual ~MarchingCubes ()
void set_data (EMData *data)
 Sets Voxel data for Isosurface implementation Calls calculate_min_max_vals which generates the tree of data.
void set_surface_value (const float value)
 Set Isosurface value.
float get_surface_value () const
 Get the current isosurface value being used.
void set_sampling (const int rate)
 Set sampling rates A smaller value means a finer sampling.
int get_sampling () const
 Current the current sampling rate Finest sampling is -1.
int get_sampling_range ()
 Get the range of feasible sampling rates.
void color_vertices ()
 Color the vertices.
Dict get_isosurface ()
 Get the isosurface as dictionary Traverses the tree and marches the cubes.
void surface_face_z ()
void setRGBorigin (int x, int y, int z)
 Functions to control colroing mode.
void setRGBscale (float i, float o)
void setRGBmode (int mode)
int getRGBmode ()
 Return RGB mode.
void setCmapData (EMData *data)
 Sets the colormap.
void setCmapMinMax (float min, float max)
 Sets the colormap mix max range.

Private Member Functions

bool calculate_min_max_vals ()
 Calculate the min and max value trees Stores minimum and maximum cube neighborhood values in a tree structure.
void clear_min_max_vals ()
 Clear the minimum and maximum value search trees Frees memory in the minvals and maxvals.
void draw_cube (const int x, const int y, const int z, const int cur_level)
 The main cube drawing function To start the process of generate triangles call with draw_cube(0,0,0,minvals.size()-1) Once cur_level becomes drawing_level marching_cube is called.
void marching_cube (int fX, int fY, int fZ, const int cur_level)
 Function for managing cases where a triangles can potentially be rendered Called by draw_cube.
void calculate_surface ()
 Calculate and generate the entire set of vertices and normals using current states Calls draw_cube(0,0,0,minvals.size()-1).
float get_offset (float fValue1, float fValue2, float fValueDesired)
 Find the approximate point of intersection of the surface between two points with the values fValue1 and fValue2.
int get_edge_num (int x, int y, int z, int edge)
 Get edge num needs better commenting.
void get_normal (Vector3 &normal, int fX, int fY, int fZ)
 Find the gradient of the scalar field at a point.

Private Attributes

map< int, int > point_map
unsigned long _isodl
GLuint buffer [4]
vector< EMData * > minvals
 Vectors for storing the search trees.
vector< EMData * > maxvals
 Vectors for storing the search trees.
int drawing_level
 The "sampling rate".
CustomVector< float > pp
 .Custom vectors for storing points, normals and faces
CustomVector< float > cc
CustomVector< int > vv
CustomVector< float > nn
CustomVector< unsigned int > ff
ColorRGBGenerator rgbgenerator
 COlor by radius generator.
bool needtobind

Friends

class GLUtil

Constructor & Destructor Documentation

EMAN::MarchingCubes::MarchingCubes  ) 
 

Default constructor.

EMAN::MarchingCubes::MarchingCubes EMData em  ) 
 

Most commonly used constructor calls set_data(em).

Parameters:
em the EMData object to generate triangles and normals for

virtual EMAN::MarchingCubes::~MarchingCubes  )  [virtual]
 


Member Function Documentation

bool EMAN::MarchingCubes::calculate_min_max_vals  )  [private]
 

Calculate the min and max value trees Stores minimum and maximum cube neighborhood values in a tree structure.

Exceptions:
NullPointerException if _emdata is null... this should not happen but is left for clarity for programmers

void EMAN::MarchingCubes::calculate_surface  )  [private]
 

Calculate and generate the entire set of vertices and normals using current states Calls draw_cube(0,0,0,minvals.size()-1).

void EMAN::MarchingCubes::clear_min_max_vals  )  [private]
 

Clear the minimum and maximum value search trees Frees memory in the minvals and maxvals.

void EMAN::MarchingCubes::color_vertices  ) 
 

Color the vertices.

void EMAN::MarchingCubes::draw_cube const int  x,
const int  y,
const int  z,
const int  cur_level
[private]
 

The main cube drawing function To start the process of generate triangles call with draw_cube(0,0,0,minvals.size()-1) Once cur_level becomes drawing_level marching_cube is called.

Parameters:
x the current x value, relative to cur_level
y the current y value, relative to cur_level
z the current z value, relative to cur_level
cur_level the current tree traversal level

int EMAN::MarchingCubes::get_edge_num int  x,
int  y,
int  z,
int  edge
[private]
 

Get edge num needs better commenting.

Dict EMAN::MarchingCubes::get_isosurface  )  [virtual]
 

Get the isosurface as dictionary Traverses the tree and marches the cubes.

Returns:
a dictionary object containing to float pointers (to vertex and normal data), and an int pointer (to face data)

Implements EMAN::Isosurface.

void EMAN::MarchingCubes::get_normal Vector3 normal,
int  fX,
int  fY,
int  fZ
[private]
 

Find the gradient of the scalar field at a point.

This gradient can be used as a very accurate vertx normal for lighting calculations.

THIS FUNCTION IS NO LONGER CALLED - d.woolford but is retained because it may be useful, perhaps even for saving time

Parameters:
normal where to store the normal
fX 
fY 
fZ 

float EMAN::MarchingCubes::get_offset float  fValue1,
float  fValue2,
float  fValueDesired
[private]
 

Find the approximate point of intersection of the surface between two points with the values fValue1 and fValue2.

Parameters:
fValue1 
fValue2 
fValueDesired 
Returns:
offset

int EMAN::MarchingCubes::get_sampling  )  const [inline, virtual]
 

Current the current sampling rate Finest sampling is -1.

Implements EMAN::Isosurface.

Definition at line 319 of file marchingcubes.h.

00319 { return drawing_level; }

int EMAN::MarchingCubes::get_sampling_range  )  [inline, virtual]
 

Get the range of feasible sampling rates.

Implements EMAN::Isosurface.

Definition at line 323 of file marchingcubes.h.

00323 { return minvals.size()-1; }

float EMAN::MarchingCubes::get_surface_value  )  const [inline, virtual]
 

Get the current isosurface value being used.

Returns:
the current isosurface value

Implements EMAN::Isosurface.

Definition at line 304 of file marchingcubes.h.

00304 { return _surf_value; }

int EMAN::MarchingCubes::getRGBmode  )  [inline]
 

Return RGB mode.

Definition at line 355 of file marchingcubes.h.

00356                 {
00357                         return rgbgenerator.getRGBmode();
00358                 }

void EMAN::MarchingCubes::marching_cube int  fX,
int  fY,
int  fZ,
const int  cur_level
[private]
 

Function for managing cases where a triangles can potentially be rendered Called by draw_cube.

Generates vertices, normals, and keeps track of common points

Parameters:
fX the current x coordinate, relative to cur_level
fY the current y coordinate, relative to cur_level
fZ the current z coordinate, relative to cur_level
cur_level 

void EMAN::MarchingCubes::set_data EMData data  )  [virtual]
 

Sets Voxel data for Isosurface implementation Calls calculate_min_max_vals which generates the tree of data.

Parameters:
data the emdata object to be rendered in 3D
Exceptions:
ImageDimensionException if the image z dimension is 1

Reimplemented from EMAN::Isosurface.

void EMAN::MarchingCubes::set_sampling const int  rate  )  [inline, virtual]
 

Set sampling rates A smaller value means a finer sampling.

The finest sampling level is -1 Sampling values increment in steps of 1, and a single increment is interpreted as one step up or down the tree stored in minvals and maxvals

Parameters:
rate the tree level to render

Implements EMAN::Isosurface.

Definition at line 314 of file marchingcubes.h.

00314 { drawing_level = rate; }

void EMAN::MarchingCubes::set_surface_value const float  value  )  [virtual]
 

Set Isosurface value.

Parameters:
value the new isosurface value

Implements EMAN::Isosurface.

void EMAN::MarchingCubes::setCmapData EMData data  )  [inline, virtual]
 

Sets the colormap.

Implements EMAN::Isosurface.

Definition at line 361 of file marchingcubes.h.

References data.

00362                 {
00363                         rgbgenerator.set_cmap_data(data);
00364                 }

void EMAN::MarchingCubes::setCmapMinMax float  min,
float  max
[inline, virtual]
 

Sets the colormap mix max range.

Implements EMAN::Isosurface.

Definition at line 367 of file marchingcubes.h.

References max, and min.

00368                 {
00369                         rgbgenerator.setMinMax(min, max);
00370                 }

void EMAN::MarchingCubes::setRGBmode int  mode  )  [inline, virtual]
 

Implements EMAN::Isosurface.

Definition at line 349 of file marchingcubes.h.

00350                 {
00351                         rgbgenerator.setRGBmode(mode);
00352                 }

void EMAN::MarchingCubes::setRGBorigin int  x,
int  y,
int  z
[inline, virtual]
 

Functions to control colroing mode.

Implements EMAN::Isosurface.

Definition at line 339 of file marchingcubes.h.

References x, and y.

00340                 {
00341                         rgbgenerator.setOrigin(x, y, z);
00342                 }

void EMAN::MarchingCubes::setRGBscale float  i,
float  o
[inline, virtual]
 

Implements EMAN::Isosurface.

Definition at line 344 of file marchingcubes.h.

00345                 {
00346                         rgbgenerator.setScale(i, o);
00347                 }

void EMAN::MarchingCubes::surface_face_z  ) 
 


Friends And Related Function Documentation

friend class GLUtil [friend]
 

Definition at line 276 of file marchingcubes.h.


Member Data Documentation

unsigned long EMAN::MarchingCubes::_isodl [private]
 

Definition at line 374 of file marchingcubes.h.

GLuint EMAN::MarchingCubes::buffer[4] [private]
 

Definition at line 375 of file marchingcubes.h.

CustomVector<float> EMAN::MarchingCubes::cc [private]
 

Definition at line 451 of file marchingcubes.h.

int EMAN::MarchingCubes::drawing_level [private]
 

The "sampling rate".

Definition at line 394 of file marchingcubes.h.

CustomVector<unsigned int> EMAN::MarchingCubes::ff [private]
 

Definition at line 454 of file marchingcubes.h.

vector<EMData*> EMAN::MarchingCubes::maxvals [private]
 

Vectors for storing the search trees.

Definition at line 391 of file marchingcubes.h.

vector<EMData*> EMAN::MarchingCubes::minvals [private]
 

Vectors for storing the search trees.

Definition at line 391 of file marchingcubes.h.

bool EMAN::MarchingCubes::needtobind [private]
 

Definition at line 459 of file marchingcubes.h.

CustomVector<float> EMAN::MarchingCubes::nn [private]
 

Definition at line 453 of file marchingcubes.h.

map<int, int> EMAN::MarchingCubes::point_map [private]
 

Definition at line 373 of file marchingcubes.h.

CustomVector<float> EMAN::MarchingCubes::pp [private]
 

.Custom vectors for storing points, normals and faces

Definition at line 450 of file marchingcubes.h.

ColorRGBGenerator EMAN::MarchingCubes::rgbgenerator [private]
 

COlor by radius generator.

Definition at line 457 of file marchingcubes.h.

CustomVector<int> EMAN::MarchingCubes::vv [private]
 

Definition at line 452 of file marchingcubes.h.


The documentation for this class was generated from the following file:
Generated on Tue Jun 11 13:42:06 2013 for EMAN2 by  doxygen 1.3.9.1