Namespaces | Classes | Functions

OpenTissue::grid Namespace Reference

Namespaces

namespace  chan_vese
namespace  detail

Classes

class  Grid
struct  inside_region_tag
struct  outside_region_tag

Functions

template<typename T , typename M >
min_element (OpenTissue::grid::Grid< T, M > const &G)
template<typename T , typename M >
max_element (OpenTissue::grid::Grid< T, M > const &G)
template<typename T , typename M >
Grid< T, M > & fabs (Grid< T, M > &G)
template<typename T , typename M >
Grid< T, M > & negate (Grid< T, M > &G)
template<typename T , typename M >
Grid< T, M > & scale (Grid< T, M > &G, T fac)
template<typename grid_type >
bool binary_read (std::string const &filename, grid_type &grid)
template<typename grid_type >
bool binary_write (std::string const &filename, grid_type &grid)
template<typename grid_type >
bool image_read (std::string const &directory, std::string const &filter, grid_type &grid)
template<typename grid_type >
bool matlab_write (std::string const &mfile, grid_type const &grid)
template<typename grid_type >
bool raw_read (std::string const &filename, grid_type &grid)
template<typename grid_type >
void raw_read_8bit (std::string const &filename, grid_type &target)
template<typename grid_type >
void raw_read_8bit_to_16bit (std::string const &filename, grid_type &target)
template<typename grid_type >
void raw_read_16bit (std::string const &filename, grid_type &target)
template<typename grid_type >
bool raw_write (std::string const &filename, grid_type &grid)
template<typename grid_type >
void aof (grid_type const &phi, grid_type &F)
template<class grid_type >
void approximate_gaussian_filter (grid_type const &src, size_t order, size_t size, grid_type &dst)
template<class grid_type >
void approximate_gaussian_filter_border_correct (grid_type const &src, size_t order, size_t size, grid_type &dst)
template<typename grid_type >
void average (grid_type &phi)
template<typename vector3_type , typename grid_type >
vector3_type bisection_line_search (vector3_type q_a, vector3_type q_b, grid_type &phi, bool maximize=true)
template<typename grid_type >
void blockify (grid_type &phi)
template<typename grid_type , typename value_type >
void blockify (grid_type &phi, value_type inside, value_type outside, size_t offset, size_t spacing)
template<typename grid_type , typename value_type >
void blockify (grid_type &phi, value_type inside, value_type outside, size_t offset, size_t spacing, size_t slice)
template<typename grid_type >
void box_filter (grid_type const &src, size_t size, grid_type &dst)
template<typename grid_type_in , typename image_grid_type , typename real_type , typename grid_type_out >
void chan_vese_auto_in_out (grid_type_in &phi, image_grid_type const &U, real_type const &lambda, real_type const &mu, real_type const &nu, real_type const &dt, grid_type_out &psi, real_type const &epsilon=10e-7, size_t const &max_iterations=10)
template<typename grid_type_in , typename image_type , typename real_type , typename grid_type_out >
void chan_vese_fixed_in_out (grid_type_in const &phi, image_type const &U, typename image_type::value_type const &C_in, typename image_type::value_type const &C_out, real_type const &lambda, real_type const &mu, real_type const &nu, real_type const &dt, grid_type_out &psi)
template<typename grid_type_in , typename image_grid_type , typename real_type , typename grid_type_out >
void chan_vese_fixed_in (grid_type_in const &phi, image_grid_type const &U, typename image_grid_type::value_type C_in, real_type const &lambda, real_type const &mu, real_type const &nu, real_type const &dt, grid_type_out &psi)
template<typename grid_type_in , typename image_grid_type , typename real_type , typename grid_type_out >
void chan_vese_fixed_out (grid_type_in const &phi, image_grid_type const &U, typename image_grid_type::value_type C_out, real_type const &lambda, real_type const &mu, real_type const &nu, real_type const &dt, grid_type_out &psi)
template<typename grid_type_in , typename real_type , typename grid_type_out >
void closing (grid_type_in const &phi, real_type const &radius, real_type const &dt, grid_type_out &psi)
template<typename grid_type >
void compute_sign_function (grid_type const &phi, grid_type &S0)
template<typename grid_type >
size_t connected_components (grid_type const &image, grid_type &components)
template<typename grid_type , typename vector3_type >
void coord2idx (grid_type const &grid, vector3_type const &point, size_t &i, size_t &j, size_t &k)
template<typename grid_type >
void crop (grid_type const &M, grid_type &m, typename grid_type::value_type const &treshold)
template<typename grid_type >
void crop (grid_type const &M, grid_type &m, size_t min_i, size_t min_j, size_t min_k, size_t max_i, size_t max_j, size_t max_k)
template<typename grid_type , typename real_type >
void curvature (grid_type const &grid, size_t i, size_t j, size_t k, real_type &K, real_type &G, real_type &k1, real_type &k2)
template<typename grid_type , typename real_type >
void eigen_curvature (grid_type const &grid, size_t i, size_t j, size_t k, real_type &k1, real_type &k2)
template<typename grid_type , typename real_type >
void algebra_curvature (grid_type const &grid, size_t i, size_t j, size_t k, real_type &k1, real_type &k2)
template<typename grid_type , typename real_type >
void curvature_flow (grid_type const &phi, real_type const &mu, real_type const &dt, grid_type &psi)
template<typename grid_type_in , typename real_type , typename grid_type_out >
void dilation (grid_type_in const &phi, real_type const &radius, real_type const &dt, grid_type_out &psi)
template<typename grid_type >
void div_grad (grid_type const &phi, grid_type &M)
template<typename grid_type , typename vector3_type >
void enclosing_indices (grid_type const &grid, vector3_type const &point, size_t &i0, size_t &j0, size_t &k0, size_t &i1, size_t &j1, size_t &k1)
template<typename grid_type_in , typename real_type , typename grid_type_out >
void erosion (grid_type_in const &phi, real_type const &radius, real_type const &dt, grid_type_out &psi)
template<typename grid_type_in , typename transfer_function , typename grid_type_out >
void extract_voxels (grid_type_in const &in, transfer_function const &func, grid_type_out &out)
template<typename grid_type >
void extrapolation (grid_type &S, grid_type const &phi, size_t max_iterations=10)
template<typename grid_type >
void fast_blur (grid_type &image, double sx, double sy, double sz, double log_base, size_t iterations)
template<typename grid_type >
void fast_blur (grid_type &image, double s, double log_base, size_t iterations)
template<typename grid_type , typename real_type >
void gaussian_convolution (grid_type const &src, grid_type &dst, real_type sx, real_type sy, real_type sz)
template<typename grid_type , typename vector3_type >
void gradient (grid_type const &grid, size_t i, size_t j, size_t k, vector3_type &gradient)
template<typename grid_iterator , typename vector3_type >
void gradient (grid_iterator const &iter, vector3_type &gradient)
template<typename grid_iterator >
grid_iterator::math_types::vector3_type gradient (grid_iterator const &iter)
template<typename grid_type , typename vector3_type >
vector3_type gradient_at_point (grid_type const &grid, vector3_type const &point)
template<typename grid_type , typename real_type >
void gradient_magnitude (grid_type const &grid, size_t i, size_t j, size_t k, real_type &grad_mag)
template<typename grid_iterator , typename real_type >
void gradient_magnitude (grid_iterator const &iter, real_type &grad_mag)
template<typename grid_iterator >
grid_iterator::math_types::real_type gradient_magnitude (grid_iterator const &iter)
template<typename grid_type , typename matrix3x3_type >
void hessian (grid_type const &grid, size_t i, size_t j, size_t k, matrix3x3_type &H)
template<typename grid_iterator , typename matrix3x3_type >
void hessian (grid_iterator const &iter, matrix3x3_type &H)
template<typename grid_iterator >
OpenTissue::math::Matrix3x3
< typename
grid_iterator::math_types::real_type
hessian (grid_iterator const &iter)
template<typename grid_type , typename vector3_type >
void idx2coord (grid_type const &grid, size_t i, size_t j, size_t k, vector3_type &point)
template<typename grid_iterator , typename vector3_type >
void idx2coord (grid_iterator const &iter, vector3_type &point)
template<typename grid_iterator >
grid_iterator::math_types::vector3_type idx2coord (grid_iterator const &iter)
template<typename grid_type >
void ignore_region (grid_type &phi, inside_region_tag const &)
template<typename grid_type >
void ignore_region (grid_type &phi, outside_region_tag const &)
template<typename grid_type , typename vector3_type >
bool is_point_inside (grid_type const &grid, vector3_type const &point)
template<typename grid_type , typename vector3_iterator >
void isosurface_projection (grid_type const &phi, vector3_iterator begin, vector3_iterator end, bool project_inside=true, bool project_outside=true, double isovalue=0.0)
template<typename grid_type , typename mesh_type , typename point_container >
void junctions (grid_type const &aof, grid_type &phi, mesh_type &mesh, point_container &points)
template<typename grid_type , typename mesh_type , typename point_container >
void junctions2 (grid_type const &aof, grid_type const &phi, mesh_type &mesh, point_container &points)
template<typename grid_type >
void laplacian_blur (grid_type &image, double diffusion=1.0, size_t max_iterations=10)
template<typename grid_type , typename point_container >
void local_minima_as_points (grid_type const &phi, point_container &points)
template<typename grid_type , typename point_container >
void local_minima_as_points (grid_type const &phi, grid_type const &mask, point_container &points)
template<typename grid_type , typename real_type >
void mean_curvature (grid_type const &grid, size_t i, size_t j, size_t k, real_type &K)
template<typename grid_iterator , typename real_type >
void mean_curvature (grid_iterator const &iter, real_type &K)
template<typename grid_iterator >
grid_iterator::math_types::real_type mean_curvature (grid_iterator const &iter)
template<typename mesh_type , typename grid_type >
void mesh2phi (mesh_type &mesh, grid_type &phi, size_t max_resolution=64, bool use_gpu=true)
template<typename mesh_type , typename grid_type >
void mesh2phi (mesh_type &mesh, grid_type &phi, double bandsize, size_t resolution, bool use_gpu=true)
template<typename grid_type >
void metamorphosis_speed_function (grid_type const &phi, grid_type const &gamma, grid_type &F)
template<typename grid_type >
void metamorphosis (grid_type &phi, grid_type const &gamma, typename grid_type::math_types::real_type const &dt)
template<typename grid_type_in , typename real_type , typename grid_type_out >
void opening (grid_type_in const &phi, real_type const &radius, real_type const &dt, grid_type_out &psi)
template<typename grid_type >
void poisson_solver (grid_type &phi, grid_type const &W, size_t max_iterations=10)
template<typename grid_type >
void redistance (grid_type const &phi, grid_type &psi, size_t max_iterations=10, double steady_threshold=0.05)
template<typename grid_type , typename real_type >
void resample (grid_type const &M, grid_type &m, real_type factor_i, real_type factor_j, real_type factor_k)
template<typename grid_type >
void rescale_range (grid_type &grid, typename grid_type::value_type src_min, typename grid_type::value_type src_max, typename grid_type::value_type dst_min, typename grid_type::value_type dst_max)
template<typename grid_type , typename real_type >
void second_derivative (grid_type const &grid, size_t i, size_t j, size_t k, real_type &derivative)
template<typename grid_iterator , typename real_type >
void second_derivative (grid_iterator const &iter, real_type &derivative)
template<typename grid_iterator >
grid_iterator::math_types::real_type second_derivative (grid_iterator const &iter)
template<typename grid_type , typename grid_container >
void split2slices (grid_type &grid, grid_container &slices, size_t axis=2)
template<typename grid_type , typename point_container >
void strict_local_minima_as_points (grid_type const &phi, point_container &points)
template<typename grid_type , typename point_container >
void strict_local_minima_as_points (grid_type const &phi, grid_type const &mask, point_container &points)
template<typename input_iterator , typename output_iterator , typename function_type >
void transform (input_iterator in_begin, input_iterator in_end, output_iterator out_begin, function_type func)
template<typename grid_type , typename vector3_int_type >
void translate (grid_type const &src, vector3_int_type const &v, grid_type &dst)
template<typename grid_type , typename vector3_container >
void uniform_point_sampling (grid_type const &phi, vector3_container &points, size_t sub_sample=2u)
template<typename grid_type , typename vector3_type >
void upwind_gradient (grid_type const &phi, grid_type const &F, size_t i, size_t j, size_t k, vector3_type &gradient)
template<typename grid_type >
void upwind_gradient_field (grid_type const &phi, grid_type const &F, grid_type &Nx, grid_type &Ny, grid_type &Nz)
template<typename grid_type , typename vector3_type >
grid_type::value_type value_at_point (grid_type const &grid, vector3_type const &point)
template<typename grid_type , typename plane_type >
void voxel_plane_clip (grid_type const &voxels, plane_type const &plane, grid_type &below, grid_type &above)
template<typename mesh_type , typename grid_type >
void voxelizer (mesh_type &mesh, grid_type &phi)

Function Documentation

template<typename grid_type , typename real_type >
void OpenTissue::grid::algebra_curvature ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
real_type k1,
real_type k2 
) [inline]

Computes principal curvatures based on linear algebra.

This is similar to the approach used in the paper:

{museth.breen.ea02, author = {Ken Museth and David E. Breen and Ross T. Whitaker and Alan H. Barr}, title = {Level set surface editing operators}, booktitle = {Proceedings of the 29th annual conference on Computer graphics and interactive techniques}, year = {2002}, isbn = {1-58113-521-1}, pages = {330--338}, location = {San Antonio, Texas}, doi = {http://doi.acm.org/10.1145/566570.566585}, publisher = {ACM Press}, }

Parameters:
k1 Upon return this value contains the first principal curvature.
k2 Upon return this value contains the second principal curvature.
template<typename grid_type >
void OpenTissue::grid::aof ( grid_type const &  phi,
grid_type F 
) [inline]

Average Outward Flux.

Parameters:
phi A the distance grid.
F A grid containing the values of the average outward flux.
template<class grid_type >
void OpenTissue::grid::approximate_gaussian_filter ( grid_type const &  src,
size_t  order,
size_t  size,
grid_type dst 
) [inline]

Fast convolution by an approximate "integer" guassian filter. This just applies several box_filter's (boxsize=size and order times), and is only efficient for low orders. If size is even, the order must also be even for the resulting image to lay on the same grid (else translated 0.5 voxel towards (0,0,0) ).

Parameters:
src Source grid to be convolved.
order Order of filter. Corresponds to the number of times the boxfilter is applied.
size Size of filter.
dst Upon return, contains the filtered grid.
template<class grid_type >
void OpenTissue::grid::approximate_gaussian_filter_border_correct ( grid_type const &  src,
size_t  order,
size_t  size,
grid_type dst 
) [inline]

Approximate Gaussian filter with compensation on image borders. Attenuation on border regions is compensated. This is equivalent to Gaussian filtering using only filter coefficients that are inside the "shape" being considered.

Parameters:
src Source grid to be convolved.
order Order of filter. Corresponds to the number of times the boxfilter is applied.
size Size of filter.
dst Upon return, contains the filtered grid.
template<typename grid_type >
void OpenTissue::grid::average ( grid_type phi  )  [inline]
template<typename grid_type >
bool OpenTissue::grid::binary_read ( std::string const &  filename,
grid_type grid 
) [inline]
template<typename grid_type >
bool OpenTissue::grid::binary_write ( std::string const &  filename,
grid_type grid 
) [inline]
template<typename vector3_type , typename grid_type >
vector3_type OpenTissue::grid::bisection_line_search ( vector3_type  q_a,
vector3_type  q_b,
grid_type phi,
bool  maximize = true 
) [inline]

Grid Bisection Line Search

Parameters:
q_a 
q_b 
phi 
maximize If true the bisection method tries to find the maximimum value between q_a and q_b otherwise it tries to find the minimum value.
Returns:
The point that maximizes the value of phi on the line between q_a and q_b.
template<typename grid_type >
void OpenTissue::grid::blockify ( grid_type phi  )  [inline]

Level Set Blockifier. This function takes a level set grid and re-initializes it into small cubic blocks (-1 inside and +1 outside).

Parameters:
phi The level set grid.
template<typename grid_type , typename value_type >
void OpenTissue::grid::blockify ( grid_type phi,
value_type  inside,
value_type  outside,
size_t  offset,
size_t  spacing 
) [inline]

Initialize a grid with a pattern of boxes of width offset.

Parameters:
phi The grid to initialize.
inside Value to fill inside blocks
outside Value to fill outside blocks
offset The offset from the borders.
spacing The width, height, depth and half the spacing of boxes.
template<typename grid_type , typename value_type >
void OpenTissue::grid::blockify ( grid_type phi,
value_type  inside,
value_type  outside,
size_t  offset,
size_t  spacing,
size_t  slice 
) [inline]

Initialize a slice of a grid with a pattern of boxes of width offset.

Parameters:
phi The grid to initialize.
inside Value to fill inside blocks
outside Value to fill outside blocks
offset The offset from the borders.
spacing The width, height, and half the spacing of boxes.
slice The slice in z-depth that needs to be filled
template<typename grid_type >
void OpenTissue::grid::box_filter ( grid_type const &  src,
size_t  size,
grid_type dst 
) [inline]

Fast convolution by an integer sized box signal. Variance of the filter is 1/12*(size*size-1).

Parameters:
src Source grid to be convolved.
size Size of box filter.
dst Upon return, contains the filtered grid.
template<typename grid_type_in , typename image_grid_type , typename real_type , typename grid_type_out >
void OpenTissue::grid::chan_vese_auto_in_out ( grid_type_in &  phi,
image_grid_type const &  U,
real_type const &  lambda,
real_type const &  mu,
real_type const &  nu,
real_type const &  dt,
grid_type_out &  psi,
real_type const &  epsilon = 10e-7,
size_t const &  max_iterations = 10 
) [inline]
Parameters:
phi Input level set.
U Input image.
lambda Weight of input/output regions (legal values 0..1) 0.5 means input and output are weighted equally.
mu Mean Curvature regularization (requires input level set to be close to signed distance grid)
nu Area (Well, it is really volume:-) regularization.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance grid then output may not be a signed distance grid, thus you may need to redistance output levelset.
epsilon Steady state threshold testing.
max_iterations Maximum number of iterations allowed to reach steady state.
template<typename grid_type_in , typename image_grid_type , typename real_type , typename grid_type_out >
void OpenTissue::grid::chan_vese_fixed_in ( grid_type_in const &  phi,
image_grid_type const &  U,
typename image_grid_type::value_type  C_in,
real_type const &  lambda,
real_type const &  mu,
real_type const &  nu,
real_type const &  dt,
grid_type_out &  psi 
) [inline]
Parameters:
phi Input level set.
U Input image.
C_in Mean value of inside region. This is the mean value of the region that phi is supposed to enclose.
lambda Weight of input/output regions (legal values 0..1) 0.5 means input and output are weighted equally.
mu Mean Curvature regularization (requires input level set to be close to signed distance grid)
nu Area (Well, it is really volume:-) regularization.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance grid then output may not be a signed distance grid, thus you may need to redistance output levelset.
template<typename grid_type_in , typename image_type , typename real_type , typename grid_type_out >
void OpenTissue::grid::chan_vese_fixed_in_out ( grid_type_in const &  phi,
image_type const &  U,
typename image_type::value_type const &  C_in,
typename image_type::value_type const &  C_out,
real_type const &  lambda,
real_type const &  mu,
real_type const &  nu,
real_type const &  dt,
grid_type_out &  psi 
) [inline]
Parameters:
phi Input level set.
U Input image.
C_in Mean value of inside region. This is the mean value of the region that phi is supposed to enclose.
C_out Mean value of outside region. This is the mean value of the region that is supposed to lie outside phi.
lambda Weight of input/output regions (legal values 0..1) 0.5 means input and output are weighted equally.
mu Mean Curvature regularization (requires input level set to be close to signed distance grid)
nu Area (Well, it is really volume:-) regularization.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance grid then output may not be a signed distance grid, thus you may need to redistance output levelset.
template<typename grid_type_in , typename image_grid_type , typename real_type , typename grid_type_out >
void OpenTissue::grid::chan_vese_fixed_out ( grid_type_in const &  phi,
image_grid_type const &  U,
typename image_grid_type::value_type  C_out,
real_type const &  lambda,
real_type const &  mu,
real_type const &  nu,
real_type const &  dt,
grid_type_out &  psi 
) [inline]
Parameters:
phi Input level set.
U Input image.
C_out Mean value of outside region. This is the mean value of the region that is supposed to lie outside phi.
lambda Weight of input/output regions (legal values 0..1) 0.5 means input and output are weighted equally.
mu Mean Curvature regularization (requires input level set to be close to signed distance grid)
nu Area (Well, it is really volume:-) regularization.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance grid then output may not be a signed distance grid, thus you may need to redistance output levelset.
template<typename grid_type_in , typename real_type , typename grid_type_out >
void OpenTissue::grid::closing ( grid_type_in const &  phi,
real_type const &  radius,
real_type const &  dt,
grid_type_out &  psi 
) [inline]

Closing Operation.

Parameters:
phi Input level set.
radius Radius of spherical structural element.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance map then output may not be a signed distance map, thus you may need to redistance output levelset.
template<typename grid_type >
void OpenTissue::grid::compute_sign_function ( grid_type const &  phi,
grid_type S0 
) [inline]
template<typename grid_type >
size_t OpenTissue::grid::connected_components ( grid_type const &  image,
grid_type components 
) [inline]

Compute the 8-connected components of a binary image. The components in the returned image are labeled with positive integer values. If the image is identically zero, then the components image is identically zero and the returned quantity is zero.

See also:
grid/util/connected_components2D.h for details.
Parameters:
image Input image. Should be binary, with 1 representing data.
components Output image. Each components is labelled with an unique identifier.
Returns:
Number of components found.
template<typename grid_type , typename vector3_type >
void OpenTissue::grid::coord2idx ( grid_type const &  grid,
vector3_type const &  point,
size_t &  i,
size_t &  j,
size_t &  k 
) [inline]

Coordinate 2 Voxel Indices. This method computes the indices (i,j,k) of the voxel containing the specified point.

The voxel index of the voxel containing the points is equal to index of the grid node of the containing voxel with lowest coordinates (ie. lower-left-back grid node).

Parameters:
grid The grid.
point The point.
i Upon return this parameter contains the index of the voxel along the I-axe.
j Upon return this parameter contains the index of the voxel along the J-axe.
k Upon return this parameter contains the index of the voxel along the K-axe.
template<typename grid_type >
void OpenTissue::grid::crop ( grid_type const &  M,
grid_type m,
typename grid_type::value_type const &  treshold 
) [inline]

Crop grid to bounding box that do not include treshold. Can be used to automatically crop emptyness from scanned data.

Parameters:
M Original grid to be cropped.
m Destination grid.
treshold Maximum value that needs to be cropped.
Returns:
Upon return the destination grid m contains the cropped grid.
template<typename grid_type >
void OpenTissue::grid::crop ( grid_type const &  M,
grid_type m,
size_t  min_i,
size_t  min_j,
size_t  min_k,
size_t  max_i,
size_t  max_j,
size_t  max_k 
) [inline]

Crop grid to user specified bounding box.

Parameters:
M Original grid to be cropped.
m Destination grid.
min_i Lower i-coord of bounding box.
min_j Lower j-coord of bounding box.
min_k Lower k-coord of bounding box.
max_i Upper i-coord of bounding box.
max_j Upper j-coord of bounding box.
max_k Upper k-coord of bounding box.
Returns:
Upon return the destination grid m contains the cropped grid.
template<typename grid_type , typename real_type >
void OpenTissue::grid::curvature ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
real_type K,
real_type G,
real_type k1,
real_type k2 
) [inline]

Get Curvature.

Parameters:
i Node coordinate
j Node coordinate
k Node coordinate
H Upon return this value contains the mean curvature.
K Upon return this value contains the gauss curvature.
k1 Upon return this value contains the first principal curvature.
k2 Upon return this value contains the second principal curvature.
template<typename grid_type , typename real_type >
void OpenTissue::grid::curvature_flow ( grid_type const &  phi,
real_type const &  mu,
real_type const &  dt,
grid_type psi 
) [inline]

Calculate curvature flow.

WARNING: Unexpected behavior if input and output level sets are the same.

Parameters:
phi Input level set.
mu Mean Curvature coefficient.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance map then output may not be a signed distance map, thus you may need to redistance output levelset.
template<typename grid_type_in , typename real_type , typename grid_type_out >
void OpenTissue::grid::dilation ( grid_type_in const &  phi,
real_type const &  radius,
real_type const &  dt,
grid_type_out &  psi 
) [inline]

Dilate level set.

Parameters:
phi Input level set.
radius Radius of spherical structural element.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance map then output may not be a signed distance map, thus you may need to redistance output levelset.
template<typename grid_type >
void OpenTissue::grid::div_grad ( grid_type const &  phi,
grid_type M 
) [inline]

Div-Grad. Computes the divergence of the gradient of a specified field. Ie. the flux of the gradient field!

Parameters:
phi A the grid.
M A grid containing the values of the divergence of the gradient field of phi.
template<typename grid_type , typename real_type >
void OpenTissue::grid::eigen_curvature ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
real_type k1,
real_type k2 
) [inline]

Compute principal curvatures based on eigen value decomposition of the shape matrix.

Based on:

Bridson, R., Teran, J., Molino, N. and Fedkiw, R., "Adaptive Physics Based Tetrahedral Mesh Generation Using Level Sets", Engineering with Computers, (in press).

Earlier vesion appears to be (unpublished)

Tetrahedral Mesh Generation for Deformable Bodies Neil Molino (Stanford University) Robert Bridson (Stanford University) Ronald Fedkiw (Stanford University) Submitted to SCA 2003

Parameters:
k1 Upon return this value contains the first principal curvature.
k2 Upon return this value contains the second principal curvature.
template<typename grid_type , typename vector3_type >
void OpenTissue::grid::enclosing_indices ( grid_type const &  grid,
vector3_type const &  point,
size_t &  i0,
size_t &  j0,
size_t &  k0,
size_t &  i1,
size_t &  j1,
size_t &  k1 
) [inline]

Get Enclosing Indices. Finds enclosing node indices for a given point. Assumes that the point is strictly inside the volume.

Parameters:
grid The grid.
point Vector with coordinates of the point.
i0 Upon return, this parameter contains the i-index of the lower-left-back node.
j0 Upon return, this parameter contains the j-index of the lower-left-back node.
k0 Upon return, this parameter contains the k-index of the lower-left-back node.
i1 Upon return, this parameter contains the i-index of the upper-right-front node.
j1 Upon return, this parameter contains the j-index of the upper-right-front node.
k1 Upon return, this parameter contains the k-index of the upper-right-front node.
template<typename grid_type_in , typename real_type , typename grid_type_out >
void OpenTissue::grid::erosion ( grid_type_in const &  phi,
real_type const &  radius,
real_type const &  dt,
grid_type_out &  psi 
) [inline]

Erode level set.

Parameters:
phi Input level set.
radius Radius of spherical structural element.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance map then output may not be a signed distance map, thus you may need to redistance output levelset.
template<typename grid_type_in , typename transfer_function , typename grid_type_out >
void OpenTissue::grid::extract_voxels ( grid_type_in const &  in,
transfer_function const &  func,
grid_type_out &  out 
) [inline]

Extract Voxels using Transfer Function. The transfer function grids voxels to colors, this function creates a new voxel grid containining all visible colored voxels.

Parameters:
in A reference to a input voxel grid.
func A reference to the transfer function that should be used.
out Upon return this argument holds the colored voxels.
template<typename grid_type >
void OpenTissue::grid::extrapolation ( grid_type S,
grid_type const &  phi,
size_t  max_iterations = 10 
) [inline]
Parameters:
max_iterations The maximum number of iterations allowed to do extrapolation.
stead_threshold The threshold value used to test for steady state.
template<typename T , typename M >
Grid<T,M>& OpenTissue::grid::fabs ( Grid< T, M > &  G  ) 

Get absolute value. Note this function changes the values stored in the arugment.

Parameters:
map The map from which the maximum value is wanted.
Returns:
A map containing the absolute value.
template<typename grid_type >
void OpenTissue::grid::fast_blur ( grid_type image,
double  sx,
double  sy,
double  sz,
double  log_base,
size_t  iterations 
) [inline]
template<typename grid_type >
void OpenTissue::grid::fast_blur ( grid_type image,
double  s,
double  log_base,
size_t  iterations 
) [inline]
template<typename grid_type , typename real_type >
void OpenTissue::grid::gaussian_convolution ( grid_type const &  src,
grid_type dst,
real_type  sx,
real_type  sy,
real_type  sz 
) [inline]

Gaussian Convolution.

Parameters:
src Input image
dst Upon return holds the resulting output image.
sx Standard deviation in the x-axis direction.
sy Standard deviation in the y-axis direction.
sz Standard deviation in the z-axis direction.
template<typename grid_type , typename vector3_type >
void OpenTissue::grid::gradient ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
vector3_type gradient 
) [inline]
template<typename grid_iterator , typename vector3_type >
void OpenTissue::grid::gradient ( grid_iterator const &  iter,
vector3_type gradient 
) [inline]
template<typename grid_iterator >
grid_iterator::math_types::vector3_type OpenTissue::grid::gradient ( grid_iterator const &  iter  )  [inline]
template<typename grid_type , typename vector3_type >
vector3_type OpenTissue::grid::gradient_at_point ( grid_type const &  grid,
vector3_type const &  point 
) [inline]
template<typename grid_type , typename real_type >
void OpenTissue::grid::gradient_magnitude ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
real_type grad_mag 
) [inline]
template<typename grid_iterator , typename real_type >
void OpenTissue::grid::gradient_magnitude ( grid_iterator const &  iter,
real_type grad_mag 
) [inline]
template<typename grid_iterator >
grid_iterator::math_types::real_type OpenTissue::grid::gradient_magnitude ( grid_iterator const &  iter  )  [inline]
template<typename grid_type , typename matrix3x3_type >
void OpenTissue::grid::hessian ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
matrix3x3_type &  H 
) [inline]

< Pre-computed value of 1./grid.dx()*grid.dx()

< Pre-computed value of 1./grid.dy()*grid.dy()

< Pre-computed value of 1./grid.dz()*grid.dz()

< Pre-computed value of 1./4*grid.dx()*grid.dy()

< Pre-computed value of 1./4*grid.dx()*grid.dz()

< Pre-computed value of 1./4*grid.dy()*grid.dz()

template<typename grid_iterator , typename matrix3x3_type >
void OpenTissue::grid::hessian ( grid_iterator const &  iter,
matrix3x3_type &  H 
) [inline]
template<typename grid_iterator >
OpenTissue::math::Matrix3x3< typename grid_iterator::math_types::real_type > OpenTissue::grid::hessian ( grid_iterator const &  iter  )  [inline]
template<typename grid_iterator >
grid_iterator::math_types::vector3_type OpenTissue::grid::idx2coord ( grid_iterator const &  iter  )  [inline]

Index To Coordinate Conversion. This method computes the coordinates of the voxel with indices (i,j,k)

Parameters:
iter An iterator to the voxel.
Returns:
Holds the coordinates.
template<typename grid_type , typename vector3_type >
void OpenTissue::grid::idx2coord ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
vector3_type point 
) [inline]

Index To Coordinate Conversion. This method computes the coordinates of the voxel with indices (i,j,k)

Parameters:
map The grid.
i The index of the voxel along the I-axe.
j The index of the voxel along the J-axe.
k The index of the voxel along the K-axe.
point Upon return this parameter contains the coordinates.
template<typename grid_iterator , typename vector3_type >
void OpenTissue::grid::idx2coord ( grid_iterator const &  iter,
vector3_type point 
) [inline]

Index To Coordinate Conversion. This method computes the coordinates of the voxel with indices (i,j,k)

Parameters:
iter An iterator to the voxel.
point Upon return this parameter contains the coordinates.
template<typename grid_type >
void OpenTissue::grid::ignore_region ( grid_type phi,
inside_region_tag const &   
) [inline]

Mask out inside region. This function masks out the inside region of level set function by assigning the unused value to all phi<0.

Parameters:
phi The level set grid.
template<typename grid_type >
void OpenTissue::grid::ignore_region ( grid_type phi,
outside_region_tag const &   
) [inline]

Mask out outside region. This function masks out the inside region of level set function by assigning the unused value to all phi>0.

Parameters:
phi The level set grid.
template<typename grid_type >
bool OpenTissue::grid::image_read ( std::string const &  directory,
std::string const &  filter,
grid_type grid 
) [inline]

Read images into Grid.

Reads a stack of images into a grid data structure. The order of the images are determined by the alphabetic sorting of the filenames and images are stored in increasing k-planes.

It is assumed that all images being read have the same (I,J) dimension, the number of images determined the K-dimension of the resulting grid.

Parameters:
directory The location of a folder containing image files
filter A file filter, for instance "*.bmp" or "*.png" etc.
grid Upon return holds the grid.
Returns:
If images were succesfully read into grid then the return value is true otherwise it is false.
template<typename grid_type , typename vector3_type >
bool OpenTissue::grid::is_point_inside ( grid_type const &  grid,
vector3_type const &  point 
) [inline]

Point Inclusion Test.

Checks if a given points is strictly inside the grid. Notice if point lies on boundary of grid, then it is not consider to be inside the grid.

Parameters:
point Vector with coordinates for a point.
Returns:
True if point is strictly inside. False otherwise.
template<typename grid_type , typename vector3_iterator >
void OpenTissue::grid::isosurface_projection ( grid_type const &  phi,
vector3_iterator  begin,
vector3_iterator  end,
bool  project_inside = true,
bool  project_outside = true,
double  isovalue = 0.0 
) [inline]

Project Point Cloud Onto Iso-surface.

Parameters:
phi The (signed distance grid) level set grid.
begin An iterator to the first point that should be projected.
end An iterator to one position past the last point that should be projected.
project_inside Boolan flag indicating whether points lying inside should be projected.
project_outside Boolan flag indicating whether points lying outside should be projected.
isovalue The isovalue of the iso-surface onto which the points should be projected. WARNING if value is larger or smaller than what is actual in stored in phi, then the projection algorithm may run into an infinite loop.
template<typename grid_type , typename mesh_type , typename point_container >
void OpenTissue::grid::junctions ( grid_type const &  aof,
grid_type phi,
mesh_type mesh,
point_container points 
) [inline]

Detect MREP junctions.

KE 2006-02-15: This is work in progress, please ignore it!

Parameters:
aof A the aof grid.
F A grid containing non-zero values for junctions.
template<typename grid_type , typename mesh_type , typename point_container >
void OpenTissue::grid::junctions2 ( grid_type const &  aof,
grid_type const &  phi,
mesh_type mesh,
point_container points 
) [inline]
template<typename grid_type >
void OpenTissue::grid::laplacian_blur ( grid_type image,
double  diffusion = 1.0,
size_t  max_iterations = 10 
) [inline]

Solves the PDE

^2 = phi(t=0)

Parameters:
image The image to blur.
diffusion The value of the diffusion coefficient.
max_iterations The maximum number of iterations allowed. Default is 30 iterations.
template<typename grid_type , typename point_container >
void OpenTissue::grid::local_minima_as_points ( grid_type const &  phi,
grid_type const &  mask,
point_container points 
) [inline]

Extract Local Minima as Points.

Parameters:
phi 
mask A mask that can be used to mask-out nodes in phi, which is not of interest. Positive values correspond to nodes that are allowed to be classified as local minima.
points 
template<typename grid_type , typename point_container >
void OpenTissue::grid::local_minima_as_points ( grid_type const &  phi,
point_container points 
) [inline]

Extract local minima nodes. Note that local minima may exist at non-nodal locations. This function only considers nodal positions. Thus if you are looking for local minima at sub-pixel accuracy, then you need another approach.

Parameters:
phi The map from where local minima nodes should be extracted from.
points Upon return this container contains all the coordinates of all nodes that where local minima.
template<typename grid_type >
bool OpenTissue::grid::matlab_write ( std::string const &  mfile,
grid_type const &  grid 
) [inline]

Writes a Grid as a Matlab Array.

Parameters:
mfile The path and filename of the generated matlab file.
grid The grid that should be written as a matlab array.
Returns:
If succesfull written the return value is true otherwise it is false.
template<typename T , typename M >
T OpenTissue::grid::max_element ( OpenTissue::grid::Grid< T, M > const &  G  ) 

Get Maximum Value.

Parameters:
map The map from which the maximum value is wanted.
Returns:
The maximum value stored in grid.
template<typename grid_iterator >
grid_iterator::math_types::real_type OpenTissue::grid::mean_curvature ( grid_iterator const &  iter  )  [inline]
template<typename grid_iterator , typename real_type >
void OpenTissue::grid::mean_curvature ( grid_iterator const &  iter,
real_type K 
) [inline]
template<typename grid_type , typename real_type >
void OpenTissue::grid::mean_curvature ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
real_type K 
) [inline]
template<typename mesh_type , typename grid_type >
void OpenTissue::grid::mesh2phi ( mesh_type mesh,
grid_type phi,
size_t  max_resolution = 64,
bool  use_gpu = true 
) [inline]

Mesh to signed distance field conversion.

This function tries to find a reasonable resolution of a signed distance field and uses t4 gpu scan method to compute the signed distance field.

Parameters:
mesh A polygonal mesh.
phi Upon return this argument contains a signed distance field of the specified mesh.
max_resolution This argument can be used to set a maximum upper limit on the resolution of the signed distance field. Default value is 64.
use_gpu Boolean flag indicating whether the gpu should be used to compute the signed distance field. Default value is true.
template<typename mesh_type , typename grid_type >
void OpenTissue::grid::mesh2phi ( mesh_type mesh,
grid_type phi,
double  bandsize,
size_t  resolution,
bool  use_gpu = true 
) [inline]

Mesh to signed distance field conversion.

Parameters:
mesh A polygonal mesh.
phi Upon return this argument contains a signed distance field of the specified mesh.
bandsize This argument can be used to set the size of a band enclosing the mesh.
max_resolution This argument can be used to set the wanted resolution of the resuling distance field.
use_gpu Boolean flag indicating whether the gpu should be used to compute the signed distance field. Default value is true.
template<typename grid_type >
void OpenTissue::grid::metamorphosis ( grid_type phi,
grid_type const &  gamma,
typename grid_type::math_types::real_type const &  dt 
) [inline]

Solid Shape Metamorphosis.

Solve the PDE:

{ (x) }{ t} = | (x)| (x)

where usually is an inside-outside function of the target object. Usually the signed distance map of the target is used as . That is

(x) = (x)

It could be defined more genrally as

(x) = f ( (x) )

where the function f is used to control the speed of the moving interface of phi.

The process is controlled by the user by defining the initial overlapping regions of source and target.

The final metamorphosis strategy is

{ (x) }{ t} = | (x)| ( T(x,alpha) )

Given the coordinate transform:

y = T(x,alpha)

where x is a point in source and y is corresponding point in target, and 0 alpha 1 is a parameterization such that

T(x,0) = x T(x,1) = y

The transform T is for instance useful for alignment of the objects.

The flow is implemented using a upwind (Godonov) scheme. Currently implementation do not support the T-transform. The user do have the option of applying an f-function outside the function, since only the gamma-field is surplied to this function.

Parameters:
phi Input/output level set.
gamma The inside/outside function of the target object.
dt The time-step size.
template<typename grid_type >
void OpenTissue::grid::metamorphosis_speed_function ( grid_type const &  phi,
grid_type const &  gamma,
grid_type F 
) [inline]

Auxilliary function used by metamorphosis().

This function compute the normal velocity flow.

Parameters:
phi The current surface
gamma The inside-outside function of target surface
F Upon return contains the normal velocity flow field.
template<typename T , typename M >
T OpenTissue::grid::min_element ( OpenTissue::grid::Grid< T, M > const &  G  ) 

Get Minimum Value.

Parameters:
map The map from which the minimum value is wanted.
Returns:
The minimum value stored in grid.
template<typename T , typename M >
Grid<T,M>& OpenTissue::grid::negate ( Grid< T, M > &  G  ) 

Negate using '-' operator of class T. This function is thus only valid when T implements unary negation Note this function changes the values stored in the arugment.

Parameters:
map The map to be negated.
Returns:
A map containing the negated values.
template<typename grid_type_in , typename real_type , typename grid_type_out >
void OpenTissue::grid::opening ( grid_type_in const &  phi,
real_type const &  radius,
real_type const &  dt,
grid_type_out &  psi 
) [inline]

Opening Operation.

Parameters:
phi Input level set.
radius Radius of spherical structural element.
dt Time-step to use in update.
psi Output levelset. Note if input is a signed distance map then output may not be a signed distance map, thus you may need to redistance output levelset.
template<typename grid_type >
void OpenTissue::grid::poisson_solver ( grid_type phi,
grid_type const &  W,
size_t  max_iterations = 10 
) [inline]

Gauss-Seidel Poisson Solver with Pure Von Neuman Boundary Conditions.

Theory: Given the PDE

^2 = W

Solve for phi. Writing out we have

{^2}{ x^2} phi + {^2}{ y^2} phi + {^2}{ z^2} phi = W

Using central diff approximation leads to

a_2 ( phi_{i+1,j,k} + phi_{i-1,j,k} ) + a_1( phi_{i,j+1,k} + phi_{i,j-1,k} ) + a_0( phi_{i,j,k+1} + phi_{i,j,k-1} ) - a_3 W phi_{i,j,k} = -------------------------------------------------------------------------------------------------------------------------------- 2 a_4

where

a_0 = (dx*dx*dy*dy) a_1 = (dx*dx*dz*dz) a_2 = (dy*dy*dz*dz) a_3 = (dx*dx*dy*dy*dz*dz) a_4 = a_0 + a_1 + a_2

In case dx=dy=dz this simplifies to

phi_{i+1,j,k} + phi_{i-1,j,k} + phi_{i,j+1,k} + phi_{i,j-1,k} + phi_{i,j,k+1} + phi_{i,j,k-1} - dx*dx W phi_{i,j,k} = ---------------------------------------------------------------------------------------------------------- 8

The solver uses pure Neumann bondary conditions. i.e.:

phi = 0

on any boundary. This means that values outside boundary are copied from nearest boundary voxel => claming out-of-bound indices onto boundary.

Parameters:
phi Contains initial guess for solution, and upon return contains the solution.
b The right hand side of the poisson equation.
max_iterations The maximum number of iterations allowed. Default is 30 iterations.
template<typename grid_type >
bool OpenTissue::grid::raw_read ( std::string const &  filename,
grid_type grid 
) [inline]

Read Raw File. Grid must be initialized to prober dimensions before reading

Parameters:
filename The path and filename of the raw file
grid Upon return holds the grid.
Returns:
If grid was succesfully read then the return value is true otherwise it is false.
template<typename grid_type >
void OpenTissue::grid::raw_read_16bit ( std::string const &  filename,
grid_type target 
) [inline]

Read 16 bit data (mostly just 12 bit)

template<typename grid_type >
void OpenTissue::grid::raw_read_8bit ( std::string const &  filename,
grid_type target 
) [inline]

Read 8 bit data

template<typename grid_type >
void OpenTissue::grid::raw_read_8bit_to_16bit ( std::string const &  filename,
grid_type target 
) [inline]

Read 8 bit data and convert it to 16 bit

template<typename grid_type >
bool OpenTissue::grid::raw_write ( std::string const &  filename,
grid_type grid 
) [inline]

Write Raw file

Parameters:
filename The path and filename of the raw file.
grid The grid that should be written.
Returns:
If file was succesfully written then the return value is true otherwise it is false.
template<typename grid_type >
void OpenTissue::grid::redistance ( grid_type const &  phi,
grid_type psi,
size_t  max_iterations = 10,
double  steady_threshold = 0.05 
) [inline]

Signed Distance Map Reinitialization.

Brute-force implementation of the reinitialization of the distance function. The following Hamilton-Jacobi equation is solved: d_tau + S(d) * ( |grad phi| - 1 ) = 0 d(x,0) = d_0(x) = phi(x,t) to steady state, with S(d) approximated by: s = d / ( sqrt( d^2 + |Dd|^2 * delta_x^2) )

Calculates gradient magnitude of phi using upwind-scheme. Performs PDE update using forward Euler time discretization.

Parameters:
phi Input level set that should be redistanced into a signed distance grid.
psi Output level set. That is the redistanced phi.
max_iterations The maximum number of iterations allowed to do re-initialization.
stead_threshold The threshold value used to test for steady state.
template<typename grid_type , typename real_type >
void OpenTissue::grid::resample ( grid_type const &  M,
grid_type m,
real_type  factor_i,
real_type  factor_j,
real_type  factor_k 
) [inline]

Resample a grid to lower dimensions.

Parameters:
M Original grid to be resampled.
m Destination grid.
factor_i Scale factor in the I-direction of the grid.
factor_j Scale factor in the J-direction of the grid.
factor_k Scale factor in the K-direction of the grid.
Returns:
Upon return the destination grid m contains the resampled grid.
template<typename grid_type >
void OpenTissue::grid::rescale_range ( grid_type grid,
typename grid_type::value_type  src_min,
typename grid_type::value_type  src_max,
typename grid_type::value_type  dst_min,
typename grid_type::value_type  dst_max 
) [inline]

Rescale input range to output range.

Parameters:
grid The grid to re-scale.
src_min Scale factor in the I-direction of the grid.
src_max Scale factor in the J-direction of the grid.
dst_min Scale factor in the K-direction of the grid.
dst_max Scale factor in the K-direction of the grid.
template<typename T , typename M >
Grid<T,M>& OpenTissue::grid::scale ( Grid< T, M > &  G,
fac 
)
template<typename grid_iterator , typename real_type >
void OpenTissue::grid::second_derivative ( grid_iterator const &  iter,
real_type derivative 
) [inline]
template<typename grid_type , typename real_type >
void OpenTissue::grid::second_derivative ( grid_type const &  grid,
size_t  i,
size_t  j,
size_t  k,
real_type derivative 
) [inline]
template<typename grid_iterator >
grid_iterator::math_types::real_type OpenTissue::grid::second_derivative ( grid_iterator const &  iter  )  [inline]
template<typename grid_type , typename grid_container >
void OpenTissue::grid::split2slices ( grid_type grid,
grid_container &  slices,
size_t  axis = 2 
) [inline]

Split a 3D grid into multiple 2D grids along some major axis.

Parameters:
grid The grid that should be split inot slices.
slices Upon return this container holds grids corresponding to all the slices.
axis The axis to split along.
template<typename grid_type , typename point_container >
void OpenTissue::grid::strict_local_minima_as_points ( grid_type const &  phi,
grid_type const &  mask,
point_container points 
) [inline]

Extract Strict Local Minima as Points.

Parameters:
phi 
mask A mask that can be used to mask-out nodes in phi, which is not of interest. Positive values correspond to nodes that are allowed to be classified as local minima.
points 
template<typename grid_type , typename point_container >
void OpenTissue::grid::strict_local_minima_as_points ( grid_type const &  phi,
point_container points 
) [inline]

Extract local minima nodes. Note that local minima may exist at non-nodal locations. This function only considers nodal positions. Thus if you are looking for local minima at sub-pixel accuracy, then you need another approach.

Parameters:
phi The map from where local minima nodes should be extracted from.
points Upon return this container contains all the coordinates of all nodes that where local minima.
template<typename input_iterator , typename output_iterator , typename function_type >
void OpenTissue::grid::transform ( input_iterator  in_begin,
input_iterator  in_end,
output_iterator  out_begin,
function_type  func 
) [inline]

Transform Grid.

This is great for generating maps from other maps, say we want a map, G, with the gradient magnitude of another map, U. Then simply write:

transform( U.begin() , U.end() , G.begin() , boost::bind( gradient_magnitude<intensity_iterator> , _1 ) );

This is very similar to the std::transform. The major difference is that std::transform dereference an iterator before invoking the functor. The transform version simply invokes the functor by passing the iterator as argument.

This is important because map iterators contain spatial information about the location of the iterator. This location information is for instance needed for finite difference computations etc..

Parameters:
in_begin 
in_end 
out_begin 
func 
template<typename grid_type , typename vector3_int_type >
void OpenTissue::grid::translate ( grid_type const &  src,
vector3_int_type const &  v,
grid_type dst 
) [inline]

Translate a grid by an integer vector and wrap around at border.

Behavior is un-expected if input and output grid is the same.... TODO: make it work for zero-trans and negative trans.

Parameters:
src Source grid to be translated.
v translation vector.
dst Upon return, contains the translated grid.
template<typename grid_type , typename vector3_container >
void OpenTissue::grid::uniform_point_sampling ( grid_type const &  phi,
vector3_container &  points,
size_t  sub_sample = 2u 
) [inline]

Uniform Point Sampling of Grid.

Parameters:
phi The (signed distance grid) level set grid.
points Upon return this container containts the random points.
sub_Sample Optimal argument, allows one to control the density of points.
template<typename grid_type , typename vector3_type >
void OpenTissue::grid::upwind_gradient ( grid_type const &  phi,
grid_type const &  F,
size_t  i,
size_t  j,
size_t  k,
vector3_type gradient 
) [inline]

Compute Upwind Gradient at Specified Node location.

Parameters:
phi A the map in which we want to know the gradient.
F A map containing the values of the speed function.
i The i'th index of the node at which we want to compute the gradient.
j The j'th index of the node at which we want to compute the gradient.
k The k'th index of the node at which we want to compute the gradient.
gradient Upon completion contains the upwind gradient
template<typename grid_type >
void OpenTissue::grid::upwind_gradient_field ( grid_type const &  phi,
grid_type const &  F,
grid_type Nx,
grid_type Ny,
grid_type Nz 
) [inline]

Picks upwind direction of gradient according to the speed function (F).

template<typename grid_type , typename vector3_type >
grid_type::value_type OpenTissue::grid::value_at_point ( grid_type const &  grid,
vector3_type const &  point 
) [inline]

Warning this method do not test whether the point lies inside the grid. If the point is outside the behavior is undefined.

template<typename grid_type , typename plane_type >
void OpenTissue::grid::voxel_plane_clip ( grid_type const &  voxels,
plane_type const &  plane,
grid_type below,
grid_type above 
) [inline]

Clip a voxelgrid against a plane.

Parameters:
voxels Input voxel grid.
plane Plane to clip against.
below Upon return, contains grid of all voxels below plane.
above Upon return, contains grid of all voxels above plane.
template<typename mesh_type , typename grid_type >
void OpenTissue::grid::voxelizer ( mesh_type mesh,
grid_type phi 
) [inline]

Voxelizer.

Parameters:
mesh The mesh that should be converted into a voxel grid.
phi Upon return this grid holds the voxels (1: voxel, 0: no voxel).