aimsalgo  5.1.2
Neuroimaging image processing
aims::MeshInterpoler Class Reference

Triangular mesh and texture interpolation. More...

#include <aims/mesh/meshinterpoler.h>

Inheritance diagram for aims::MeshInterpoler:

Classes

struct  Private
 

Public Types

enum  InterpolationType { Linear , NearestNeighbour }
 

Public Member Functions

 MeshInterpoler (const AimsSurfaceTriangle &source, const AimsSurfaceTriangle &dest)
 
 MeshInterpoler (const Point3df *sourceVert, const AimsVector< uint, 3 > *sourcePoly, uint nSourcePolygon, const Point3df *destVertex, const AimsVector< uint, 3 > *destPolygon, uint nDestVertex, uint nDestPolygon)
 This constructor is used when meshes are low-level raw arrays. More...
 
virtual ~MeshInterpoler ()
 
void setDiscontinuityThresholds (float xthresh, float ythresh, float zthresh)
 Discontinuities may occur in some meshes, on their vertices coordinates (especially when built from coordinates fields). More...
 
void project ()
 Main projection function. More...
 
AimsSurfaceTriangleresampleMesh (const AimsSurfaceTriangle &sourceshape) const
 Resample the sourceshape mesh onto the topology of the interpoler destination mesh, but staying in the native space of sourceshape. More...
 
template<typename T >
TimeTexture< T > * resampleTexture (const TimeTexture< T > &, InterpolationType=Linear) const
 
template<typename T >
void resampleTexture (const Texture< T > &source, Texture< T > &dest, int timestep=0, InterpolationType=Linear) const
 
template<typename T >
void resampleTexture (const T *source, T *dest, int timestep=0, InterpolationType=Linear) const
 low level texture resampling, working on preallocated buffers More...
 
const TimeTexture< uint > & projectedTriangles () const
 
const TimeTexture< float > & projectedTriCoord1 () const
 
const TimeTexture< float > & projectedTriCoord2 () const
 
const TimeTexture< float > & projectedTriCoord3 () const
 
void reloadProjectionParams (const TimeTexture< uint > &projTriangles, const TimeTexture< float > &projTriCoord1, const TimeTexture< float > &projTriCoord2, const TimeTexture< float > &projTriCoord3)
 set interpoler internal state (for instance to reload it after saving) More...
 
void setMeshes (const AimsSurfaceTriangle &source, const AimsSurfaceTriangle &dest)
 

Protected Member Functions

 MeshInterpoler ()
 
void findNeighbours ()
 sub-step 1 of project(): calculates projectedTriangles More...
 
void processCoordinates ()
 sub-step 2 of project(): calculates projectedTriCoord* More...
 
void findNeighbours_timestep (const Point3df *sourceVert, const AimsVector< uint, 3 > *sourcePoly, uint nSourcePolygon, const Point3df *destVertex, uint nDestVertex, int timestep)
 
void processCoordinates_timestep (const Point3df *sourceVert, const AimsVector< uint, 3 > *sourcePoly, const Point3df *destVertex, uint nDestVertex, int timestep)
 

Detailed Description

Triangular mesh and texture interpolation.

A source mesh has to be projected onto a destination one. Both have to be registered earlier (we assume there are no long distances in the geometries of both).

The main operation is project(), which calculates the correspondances between the source and destination mesh.

Then a texture from the source mesh can be resampled for the destination one.

If the meshes correspond to registrations, or deformations, of other meshes in a different space (typically, a sphere like for FreeSurfer), then a mesh resampling can be performed back into the native space, to get a destination mesh topology in the native space.

Definition at line 61 of file meshinterpoler.h.

Member Enumeration Documentation

◆ InterpolationType

Enumerator
Linear 
NearestNeighbour 

Definition at line 64 of file meshinterpoler.h.

Constructor & Destructor Documentation

◆ MeshInterpoler() [1/3]

aims::MeshInterpoler::MeshInterpoler ( const AimsSurfaceTriangle source,
const AimsSurfaceTriangle dest 
)

◆ MeshInterpoler() [2/3]

aims::MeshInterpoler::MeshInterpoler ( const Point3df sourceVert,
const AimsVector< uint, 3 > *  sourcePoly,
uint  nSourcePolygon,
const Point3df destVertex,
const AimsVector< uint, 3 > *  destPolygon,
uint  nDestVertex,
uint  nDestPolygon 
)

This constructor is used when meshes are low-level raw arrays.

◆ ~MeshInterpoler()

virtual aims::MeshInterpoler::~MeshInterpoler ( )
virtual

◆ MeshInterpoler() [3/3]

aims::MeshInterpoler::MeshInterpoler ( )
protected

Member Function Documentation

◆ findNeighbours()

void aims::MeshInterpoler::findNeighbours ( )
protected

sub-step 1 of project(): calculates projectedTriangles

◆ findNeighbours_timestep()

void aims::MeshInterpoler::findNeighbours_timestep ( const Point3df sourceVert,
const AimsVector< uint, 3 > *  sourcePoly,
uint  nSourcePolygon,
const Point3df destVertex,
uint  nDestVertex,
int  timestep 
)
protected

◆ processCoordinates()

void aims::MeshInterpoler::processCoordinates ( )
protected

sub-step 2 of project(): calculates projectedTriCoord*

◆ processCoordinates_timestep()

void aims::MeshInterpoler::processCoordinates_timestep ( const Point3df sourceVert,
const AimsVector< uint, 3 > *  sourcePoly,
const Point3df destVertex,
uint  nDestVertex,
int  timestep 
)
protected

◆ project()

void aims::MeshInterpoler::project ( )

Main projection function.

This function has to be called before the various resample*() functions are used. It calculates the projectedTriangles and projectedTriCoord* that can be accessed via the corresponding functions.

◆ projectedTriangles()

const TimeTexture<uint>& aims::MeshInterpoler::projectedTriangles ( ) const

◆ projectedTriCoord1()

const TimeTexture<float>& aims::MeshInterpoler::projectedTriCoord1 ( ) const

◆ projectedTriCoord2()

const TimeTexture<float>& aims::MeshInterpoler::projectedTriCoord2 ( ) const

◆ projectedTriCoord3()

const TimeTexture<float>& aims::MeshInterpoler::projectedTriCoord3 ( ) const

◆ reloadProjectionParams()

void aims::MeshInterpoler::reloadProjectionParams ( const TimeTexture< uint > &  projTriangles,
const TimeTexture< float > &  projTriCoord1,
const TimeTexture< float > &  projTriCoord2,
const TimeTexture< float > &  projTriCoord3 
)

set interpoler internal state (for instance to reload it after saving)

◆ resampleMesh()

AimsSurfaceTriangle* aims::MeshInterpoler::resampleMesh ( const AimsSurfaceTriangle sourceshape) const

Resample the sourceshape mesh onto the topology of the interpoler destination mesh, but staying in the native space of sourceshape.

sourceshape and the source mesh of the interpoler must have the same structure and topology (same vertices number and order, same polygons).

◆ resampleTexture() [1/3]

template<typename T >
void aims::MeshInterpoler::resampleTexture ( const T *  source,
T *  dest,
int  timestep = 0,
InterpolationType  inttype = Linear 
) const

◆ resampleTexture() [2/3]

template<typename T >
void aims::MeshInterpoler::resampleTexture ( const Texture< T > &  source,
Texture< T > &  dest,
int  timestep = 0,
InterpolationType  inttype = Linear 
) const

◆ resampleTexture() [3/3]

template<typename T >
TimeTexture< T > * aims::MeshInterpoler::resampleTexture ( const TimeTexture< T > &  stex,
InterpolationType  inttype = Linear 
) const

Definition at line 44 of file meshinterpoler_d.h.

Referenced by resampleTexture().

◆ setDiscontinuityThresholds()

void aims::MeshInterpoler::setDiscontinuityThresholds ( float  xthresh,
float  ythresh,
float  zthresh 
)

Discontinuities may occur in some meshes, on their vertices coordinates (especially when built from coordinates fields).

In this case triangles which present coordinates differences on their edges larger than the given thresholds are discarded from the projection correspondance map, so that no vertex is projected directly on them. Thresholds of 0 means that no thresholding is applied for the corresponding coordinates.

◆ setMeshes()

void aims::MeshInterpoler::setMeshes ( const AimsSurfaceTriangle source,
const AimsSurfaceTriangle dest 
)

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