![]() |
aimsalgo
5.1.2
Neuroimaging image processing
|
Triangular mesh and texture interpolation. More...
#include <aims/mesh/meshinterpoler.h>
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... | |
AimsSurfaceTriangle * | 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. 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) |
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.
Enumerator | |
---|---|
Linear | |
NearestNeighbour |
Definition at line 64 of file meshinterpoler.h.
aims::MeshInterpoler::MeshInterpoler | ( | const AimsSurfaceTriangle & | source, |
const AimsSurfaceTriangle & | dest | ||
) |
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.
|
virtual |
|
protected |
|
protected |
sub-step 1 of project(): calculates projectedTriangles
|
protected |
|
protected |
sub-step 2 of project(): calculates projectedTriCoord*
|
protected |
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.
const TimeTexture<uint>& aims::MeshInterpoler::projectedTriangles | ( | ) | const |
const TimeTexture<float>& aims::MeshInterpoler::projectedTriCoord1 | ( | ) | const |
const TimeTexture<float>& aims::MeshInterpoler::projectedTriCoord2 | ( | ) | const |
const TimeTexture<float>& aims::MeshInterpoler::projectedTriCoord3 | ( | ) | const |
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)
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).
void aims::MeshInterpoler::resampleTexture | ( | const T * | source, |
T * | dest, | ||
int | timestep = 0 , |
||
InterpolationType | inttype = Linear |
||
) | const |
low level texture resampling, working on preallocated buffers
Definition at line 85 of file meshinterpoler_d.h.
References Linear, NearestNeighbour, AimsSurface< D, class >::polygon(), aims::MeshInterpoler::Private::projCoord1, aims::MeshInterpoler::Private::projCoord2, aims::MeshInterpoler::Private::projCoord3, aims::MeshInterpoler::Private::projTriangles, aims::MeshInterpoler::Private::source, aims::MeshInterpoler::Private::sourcePoly, and aims::MeshInterpoler::Private::sourceVert.
void aims::MeshInterpoler::resampleTexture | ( | const Texture< T > & | source, |
Texture< T > & | dest, | ||
int | timestep = 0 , |
||
InterpolationType | inttype = Linear |
||
) | const |
Definition at line 57 of file meshinterpoler_d.h.
References Texture< class >::data(), aims::MeshInterpoler::Private::projTriangles, resampleTexture(), aims::MeshInterpoler::Private::source, and aims::MeshInterpoler::Private::sourceVert.
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().
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.
void aims::MeshInterpoler::setMeshes | ( | const AimsSurfaceTriangle & | source, |
const AimsSurfaceTriangle & | dest | ||
) |