NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
niftk::CMC33 Class Reference

Marching Cubes - CMC33 algorithm. More...

Collaboration diagram for niftk::CMC33:
Collaboration graph
[legend]

Public Member Functions

 CMC33 (const int size_x=-1, const int size_y=-1, const int size_z=-1)
 constructor More...
 
 ~CMC33 ()
 
const int nverts () const
 
const int ntrigs () const
 
const int size_x () const
 
const int size_y () const
 
const int size_z () const
 
void set_method (const bool originalMC=false)
 
void set_input_data (real *data)
 
void set_output_data (MeshData *meshData)
 
void enable_normal_computing (bool value)
 
void init_temps ()
 
void init_all ()
 
void clean_temps ()
 
void clean_all ()
 
void restart ()
 
void run (real iso=(real) 0.0)
 

Protected Member Functions

void process_cube ()
 
bool test_face (schar face)
 
bool test_interior (schar s)
 
bool modified_test_interior (schar s)
 
int interior_ambiguity (int amb_face, int s)
 
int interior_ambiguity_verification (int edge)
 
bool interior_test_case13 ()
 
bool interior_test_case13_2 (float isovalue)
 
const real get_data (const int i, const int j, const int k) const
 
void compute_intersection_points (real iso)
 
void add_triangle (const char *trig, char n, int v12=-1)
 
void test_vertex_addition ()
 
int add_x_vertex ()
 
int add_y_vertex ()
 
int add_z_vertex ()
 
int add_c_vertex ()
 
real get_x_grad (const int i, const int j, const int k) const
 
real get_y_grad (const int i, const int j, const int k) const
 
real get_z_grad (const int i, const int j, const int k) const
 
int get_x_vert (const int i, const int j, const int k) const
 
int get_y_vert (const int i, const int j, const int k) const
 
int get_z_vert (const int i, const int j, const int k) const
 
void set_x_vert (const int val, const int i, const int j, const int k)
 
void set_y_vert (const int val, const int i, const int j, const int k)
 
void set_z_vert (const int val, const int i, const int j, const int k)
 
void print_cube ()
 
void resizeAndAllocateConnectivity (int index)
 

Protected Attributes

bool _originalMC
 
bool _ext_data
 
bool _computeNormals
 
int _size_x
 
int _size_y
 
int _size_z
 
real_data
 
int_x_verts
 
int_y_verts
 
int_z_verts
 
int _nverts
 
int _ntrigs
 
int _Nverts
 
int _Ntrigs
 
MeshDatam_MeshDataExt
 
int _i
 
int _j
 
int _k
 
real _cube [8]
 
uchar _lut_entry
 
uchar _case
 
uchar _config
 
uchar _subconfig
 

Detailed Description

Marching Cubes - CMC33 algorithm.

Marching Cubes algorithm wrapper

Constructor & Destructor Documentation

niftk::CMC33::CMC33 ( const int  size_x = -1,
const int  size_y = -1,
const int  size_z = -1 
)

constructor

Main and default constructor

Parameters
size_xwidth of the grid
size_ydepth of the grid
size_zheight of the grid
niftk::CMC33::~CMC33 ( )

Destructor

Member Function Documentation

int niftk::CMC33::add_c_vertex ( )
protected

adds a vertex inside the current cube

void niftk::CMC33::add_triangle ( const char *  trig,
char  n,
int  v12 = -1 
)
protected

routine to add a triangle to the mesh

Parameters
trigthe code for the triangle as a sequence of edges index
nthe number of triangles to produce
v12the index of the interior vertex to use, if necessary
int niftk::CMC33::add_x_vertex ( )
protected

adds a vertex on the current horizontal edge

int niftk::CMC33::add_y_vertex ( )
protected

adds a vertex on the current longitudinal edge

int niftk::CMC33::add_z_vertex ( )
protected

adds a vertex on the current vertical edge

void niftk::CMC33::clean_all ( )

clears all structures : the temporary structures and the mesh buffers

void niftk::CMC33::clean_temps ( )

clears temporary structures : the grid and the main

void niftk::CMC33::compute_intersection_points ( real  iso)
protected

computes almost all the vertices of the mesh by interpolation along the cubes edges

Parameters
isoisovalue
void niftk::CMC33::enable_normal_computing ( bool  value)
inline

turns normal computing on / off

const real niftk::CMC33::get_data ( const int  i,
const int  j,
const int  k 
) const
inlineprotected

accesses a specific cube of the grid

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
real niftk::CMC33::get_x_grad ( const int  i,
const int  j,
const int  k 
) const
protected

interpolates the horizontal gradient of the implicit function at the lower vertex of the specified cube

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
int niftk::CMC33::get_x_vert ( const int  i,
const int  j,
const int  k 
) const
inlineprotected

accesses the pre-computed vertex index on the lower horizontal edge of a specific cube

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
real niftk::CMC33::get_y_grad ( const int  i,
const int  j,
const int  k 
) const
protected

interpolates the longitudinal gradient of the implicit function at the lower vertex of the specified cube

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
int niftk::CMC33::get_y_vert ( const int  i,
const int  j,
const int  k 
) const
inlineprotected

accesses the pre-computed vertex index on the lower longitudinal edge of a specific cube

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
real niftk::CMC33::get_z_grad ( const int  i,
const int  j,
const int  k 
) const
protected

interpolates the vertical gradient of the implicit function at the lower vertex of the specified cube

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
int niftk::CMC33::get_z_vert ( const int  i,
const int  j,
const int  k 
) const
inlineprotected

accesses the pre-computed vertex index on the lower vertical edge of a specific cube

Parameters
iabscisse of the cube
jordinate of the cube
kheight of the cube
void niftk::CMC33::init_all ( )

inits all structures (must set sizes before call) : the temporary structures and the mesh buffers

void niftk::CMC33::init_temps ( )

inits temporary structures (must set sizes before call) : the grid and the vertex index per cube

int niftk::CMC33::interior_ambiguity ( int  amb_face,
int  s 
)
protected

tests the ambigous cases

int niftk::CMC33::interior_ambiguity_verification ( int  edge)
protected

verify that the ambigous cases were treated right

bool niftk::CMC33::interior_test_case13 ( )
protected
bool niftk::CMC33::interior_test_case13_2 ( float  isovalue)
protected
bool niftk::CMC33::modified_test_interior ( schar  s)
protected

IMPROVED - tests if the components of the tesselation of the cube should be connected through the interior of the cube

const int niftk::CMC33::ntrigs ( ) const
inline

accesses the number of triangles of the generated mesh

const int niftk::CMC33::nverts ( ) const
inline

accesses the number of vertices of the generated mesh

void niftk::CMC33::print_cube ( )
protected

prints cube for debug

void niftk::CMC33::process_cube ( )
protected

tesselates one cube

void niftk::CMC33::resizeAndAllocateConnectivity ( int  index)
protected

checks the size of the connectivity vectors and allocates more space if required

void niftk::CMC33::restart ( )

restart with a new mesh: erases all vertices and faces

void niftk::CMC33::run ( real  iso = (real)0.0)

Main algorithm : must be called after init_all

Parameters
isoisovalue
void niftk::CMC33::set_input_data ( real data)
inline

selects to use data from another class

Parameters
datais the pointer to the external data, allocated as a size_x*size_y*size_z vector running in x first
void niftk::CMC33::set_method ( const bool  originalMC = false)
inline

changes the size of the grid

Parameters
size_xwidth of the grid
size_ydepth of the grid
size_zheight of the grid selects wether the algorithm will use the enhanced topologically controlled lookup table or the original MarchingCubes
originalMCtrue for the original Marching Cubes
void niftk::CMC33::set_output_data ( MeshData meshData)
inline

Set pointer to the data structure that will be used internally to store the mesh data

void niftk::CMC33::set_x_vert ( const int  val,
const int  i,
const int  j,
const int  k 
)
inlineprotected

sets the pre-computed vertex index on the lower horizontal edge of a specific cube

Parameters
valthe index of the new vertex
iabscisse of the cube
jordinate of the cube
kheight of the cube
void niftk::CMC33::set_y_vert ( const int  val,
const int  i,
const int  j,
const int  k 
)
inlineprotected

sets the pre-computed vertex index on the lower longitudinal edge of a specific cube

Parameters
valthe index of the new vertex
iabscisse of the cube
jordinate of the cube
kheight of the cube
void niftk::CMC33::set_z_vert ( const int  val,
const int  i,
const int  j,
const int  k 
)
inlineprotected

sets the pre-computed vertex index on the lower vertical edge of a specific cube

Parameters
valthe index of the new vertex
iabscisse of the cube
jordinate of the cube
kheight of the cube
const int niftk::CMC33::size_x ( ) const
inline

accesses the width of the grid

const int niftk::CMC33::size_y ( ) const
inline

accesses the depth of the grid

const int niftk::CMC33::size_z ( ) const
inline

accesses the height of the grid

bool niftk::CMC33::test_face ( schar  face)
protected

tests if the components of the tesselation of the cube should be connected by the interior of an ambiguous face

bool niftk::CMC33::test_interior ( schar  s)
protected

tests if the components of the tesselation of the cube should be connected through the interior of the cube

void niftk::CMC33::test_vertex_addition ( )
protected

tests and eventually doubles the vertex buffer capacity for a new vertex insertion

Member Data Documentation

uchar niftk::CMC33::_case
protected

case of the active cube in [0..15]

bool niftk::CMC33::_computeNormals
protected

selects wether to compute normals or not

uchar niftk::CMC33::_config
protected

configuration of the active cube

real niftk::CMC33::_cube[8]
protected

values of the implicit function on the active cube

real* niftk::CMC33::_data
protected

implicit function values sampled on the grid

bool niftk::CMC33::_ext_data
protected

selects wether to allocate data or use data from another class

int niftk::CMC33::_i
protected

abscisse of the active cube

int niftk::CMC33::_j
protected

height of the active cube

int niftk::CMC33::_k
protected

ordinate of the active cube

uchar niftk::CMC33::_lut_entry
protected

cube sign representation in [0..255]

int niftk::CMC33::_ntrigs
protected

number of allocated triangles in the triangle buffer

int niftk::CMC33::_Ntrigs
protected

allocated size of the triangle buffer - buffer might have fewer elements

int niftk::CMC33::_nverts
protected

number of allocated vertices in the vertex buffer

int niftk::CMC33::_Nverts
protected

allocated size of the vertex buffer - buffer might have fewer elements

bool niftk::CMC33::_originalMC
protected

selects wether the algorithm will use the enhanced topologically controlled lookup table or the original MarchingCubes

int niftk::CMC33::_size_x
protected

width of the grid

int niftk::CMC33::_size_y
protected

depth of the grid

int niftk::CMC33::_size_z
protected

height of the grid

uchar niftk::CMC33::_subconfig
protected

subconfiguration of the active cube

int* niftk::CMC33::_x_verts
protected

pre-computed vertex indices on the lower horizontal edge of each cube

int* niftk::CMC33::_y_verts
protected

pre-computed vertex indices on the lower longitudinal edge of each cube

int* niftk::CMC33::_z_verts
protected

pre-computed vertex indices on the lower vertical edge of each cube

MeshData* niftk::CMC33::m_MeshDataExt
protected

externally allocated data structure that contains the mesh that we're working on


The documentation for this class was generated from the following files: