CortidQCT  1.2.2.52
Classes | Macros
C API

C API for CortidQCT. More...

Collaboration diagram for C API:

Classes

struct  CQCT_VoxelVolumeSize
 VoxelVolume size. More...
 
struct  CQCT_VoxelVolumeVoxelSize
 VoxelVolume voxel size. More...
 
struct  CQCT_BarycentricPoint_t
 Barycentric point type. More...
 
struct  CQCT_Ray_t
 Ray type. More...
 
struct  CQCT_RayMeshIntersection
 

Generic Functions / Object Type

typedef void * Id
 Generic 'object' type.
 
CQCT_EXTERN Id CQCT_retain (Id obj)
 Retains an object, i.e. increments its retain count.
 
CQCT_EXTERN void CQCT_release (Id obj)
 
CQCT_EXTERN Id CQCT_autorelease (Id obj)
 
CQCT_EXTERN void CQCT_autoreleasePoolPush ()
 Adds a new autorelease pool to the stack.
 
CQCT_EXTERN void CQCT_autoreleasePoolPop ()
 

Error type

enum  CQCT_ErrorId {
  CQCT_ErrorId_Unknown, CQCT_ErrorId_InvalidArgument, CQCT_ErrorId_OutOfRange, CQCT_ErrorId_Unknown,
  CQCT_ErrorId_InvalidArgument
}
 Error types/Ids.
 
typedef struct CQCT_Error_tCQCT_Error
 Error type.
 
CQCT_EXTERN CQCT_Error CQCT_createError (enum CQCT_ErrorId id, const char *message)
 Creates an error object.
 
CQCT_EXTERN enum CQCT_ErrorId CQCT_errorType (CQCT_Error error)
 Returns the error id.
 
CQCT_EXTERN const char * CQCT_errorMessage (CQCT_Error error)
 Returns the error message.
 

VoxelVolume type

typedef struct CQCT_VoxelVolume_tCQCT_VoxelVolume
 Voxel volume handle type.
 
CQCT_EXTERN CQCT_VoxelVolume CQCT_createVoxelVolume ()
 Creates an empty voxel volume.
 
CQCT_EXTERN int CQCT_voxelVolumeLoadFromFile (CQCT_VoxelVolume volume, const char *filename, CQCT_Error *error)
 Loads the voxel volume from file.
 
CQCT_EXTERN CQCT_VoxelVolumeSize CQCT_voxelVolumeSize (CQCT_VoxelVolume volume)
 Returns the size of the voxel volume.
 
CQCT_EXTERN CQCT_VoxelVolumeVoxelSize CQCT_voxelVolumeVoxelSize (CQCT_VoxelVolume volume)
 Returns the size of a voxel.
 
CQCT_EXTERN size_t CQCT_voxelVolumeCopyVoxels (CQCT_VoxelVolume volume, float **buffer)
 Copies the voxel data to the given buffer.
 

Custom Color To Label Map

typedef struct CQCT_ColorToLabelMap_tCQCT_ColorToLabelMap
 ColorToLabelMap handle type.
 

Mesh type

typedef struct CQCT_Mesh_tCQCT_Mesh
 Mesh handle type.
 
typedef struct CQCT_BarycentricPoint_t CQCT_BarycentricPoint
 
typedef struct CQCT_Ray_t CQCT_Ray
 
typedef struct CQCT_RayMeshIntersection CQCT_RayMeshIntersection
 
CQCT_EXTERN CQCT_Mesh CQCT_createMesh ()
 Creates an empty mesh.
 
CQCT_EXTERN CQCT_Mesh CQCT_createMeshAndAllocateMemory (size_t nVertices, size_t nTriangles, CQCT_Error *error)
 Creates an mesh and reserve space for vertices and indices. More...
 
CQCT_EXTERN CQCT_Mesh CQCT_meshFromFile (const char *filename, CQCT_Error *error)
 Creates and loads a mesh from file. More...
 
CQCT_EXTERN CQCT_Mesh CQCT_meshFromFileWithCustomMapping (const char *filename, CQCT_ColorToLabelMap map, CQCT_Error *error)
 Creates and loads a mesh from file using the given custom color to label mapping. More...
 
CQCT_EXTERN CQCT_Mesh CQCT_meshAndLabelsFromFile (const char *meshFilename, const char *labelFilename, CQCT_Error *error)
 Creates and loads a mesh from a mesh and a label file. More...
 
CQCT_EXTERN int CQCT_loadMesh (CQCT_Mesh mesh, const char *filename, CQCT_Error *error)
 Loads a mesh from file.
 
CQCT_EXTERN int CQCT_loadMeshWithCustomMapping (CQCT_Mesh mesh, const char *filename, CQCT_ColorToLabelMap map, CQCT_Error *error)
 Loads a mesh from file using a custom color to label map.
 
CQCT_EXTERN int CQCT_loadMeshAndLabels (CQCT_Mesh mesh, const char *meshFilename, const char *labelFilename, CQCT_Error *error)
 Loads a mesh from mesh and label file.
 
CQCT_EXTERN int CQCT_meshAndLabelsWriteToFile (CQCT_Mesh mesh, const char *meshFilename, const char *labelsFilename, CQCT_Error *error)
 Writes mesh and labels to seperate files.
 
CQCT_EXTERN size_t CQCT_meshVertexCount (CQCT_Mesh mesh)
 Return number of vertices of the given mesh.
 
CQCT_EXTERN size_t CQCT_meshTriangleCount (CQCT_Mesh mesh)
 Return number of triangles of the given mesh.
 
CQCT_EXTERN size_t CQCT_meshCopyVertices (CQCT_Mesh mesh, float **bufferPtr)
 Copies the mesh's vertices into the given buffer. More...
 
CQCT_EXTERN void CQCT_meshSetVertices (CQCT_Mesh mesh, float const *buffer)
 Copies the vertices from the given buffer into the mesh data structure. More...
 
CQCT_EXTERN size_t CQCT_meshCopyVertexNormals (CQCT_Mesh mesh, float **bufferPtr)
 Copies the mesh's per-vertex normals into the given buffer. More...
 
CQCT_EXTERN void CQCT_meshSetVertexNormals (CQCT_Mesh mesh, float const *buffer)
 Copies the per-vertex normals from the given buffer into the mesh data structure. More...
 
CQCT_EXTERN size_t CQCT_meshCopyTriangles (CQCT_Mesh mesh, ptrdiff_t **bufferPtr)
 Copies the mesh's indices into the given buffer. More...
 
CQCT_EXTERN void CQCT_meshSetTriangles (CQCT_Mesh mesh, ptrdiff_t const *buffer)
 Copies the triangle indices from the given buffer into the mesh data structure. More...
 
CQCT_EXTERN size_t CQCT_meshCopyLabels (CQCT_Mesh mesh, unsigned int **bufferPtr)
 Copies the mesh's labels into the given buffer. More...
 
CQCT_EXTERN void CQCT_meshSetLabels (CQCT_Mesh mesh, unsigned int const *buffer)
 Copies the vertex labels from the given buffer into the mesh data structure. More...
 
CQCT_EXTERN int CQCT_meshBarycentricToCartesian (CQCT_Mesh mesh, CQCT_BarycentricPoint const *barycentricPtr, size_t nPoints, float **bufferPtr, CQCT_Error *error)
 Converts the given list of barycentric points in cartesian coordinates. More...
 
CQCT_EXTERN int CQCT_meshBarycentricInterpolation (CQCT_Mesh mesh, CQCT_BarycentricPoint const *barycentricPtr, size_t nPoints, float const *attributePtr, size_t attributeDimensions, float **bufferPtr, CQCT_Error *error)
 Interpolates attribute values given at mesh vertices at arbitrary points on the surface of the mesh. More...
 
CQCT_EXTERN size_t CQCT_meshRayIntersections (CQCT_Mesh mesh, CQCT_Ray *raysPtr, size_t nRays, CQCT_RayMeshIntersection **intersectionsOutPtr)
 Computes the intersection of a set of rays with the mesh. More...
 
CQCT_EXTERN void CQCT_meshUpsample (CQCT_Mesh mesh, size_t nTimes)
 Upsamples the given mesh nTimes without touchting the original vertices. More...
 
CQCT_EXTERN void CQCT_meshUpdatePerVertexNormals (CQCT_Mesh mesh)
 Re-computes per-vertex normals. More...
 

ColorToLabelMap object type

CQCT_EXTERN CQCT_ColorToLabelMap CQCT_createColorToLabelMap ()
 Creates a default color to label map.
 
CQCT_EXTERN int CQCT_colorToLabelMapLoadFromFile (CQCT_ColorToLabelMap map, const char *filename, CQCT_Error *error)
 Loads the mapping from YAML file.
 
CQCT_EXTERN size_t CQCT_colorToLabelMapEntryCount (CQCT_ColorToLabelMap map)
 Returns number of entries of the map.
 
CQCT_EXTERN size_t CQCT_colorToLabelMapCopyEntries (CQCT_ColorToLabelMap map, unsigned int **bufferPtr)
 Copies the entries of the map into the given buffer. More...
 
CQCT_EXTERN void CQCT_colorToLabelMapSetEntries (CQCT_ColorToLabelMap map, size_t count, const unsigned int *entries)
 Sets the entries of the mapping.
 

MeshFitterState object type

typedef struct CQCT_MeshFitter_tCQCT_MeshFitter
 Mesh fitter handle type.
 
typedef struct CQCT_MeshFitterState_tCQCT_MeshFitterState
 Mesh fitter state handle type.
 
typedef CQCT_MeshFitterState CQCT_MeshFitterResult
 Mesh fitter result object.
 
CQCT_EXTERN CQCT_MeshFitterState CQCT_createMeshFitterState (CQCT_MeshFitter fitter, CQCT_VoxelVolume volume)
 Creates an MeshFitter optimization state object.
 
CQCT_EXTERN CQCT_Mesh CQCT_meshFitterResultReferenceMesh (CQCT_MeshFitterResult result)
 Returns the result reference mesh.
 
CQCT_EXTERN CQCT_Mesh CQCT_meshFitterResultMesh (CQCT_MeshFitterResult result)
 Returns the result mesh.
 
CQCT_EXTERN size_t CQCT_meshFitterResultCopyDisplacementVector (CQCT_MeshFitterResult result, float **buffer)
 Copies the displacement vector.
 
CQCT_EXTERN void CQCT_meshFitterResultSetDisplacementVector (CQCT_MeshFitterResult result, float const *buffer)
 Sets the displacement vector.
 
CQCT_EXTERN size_t CQCT_meshFitterResultCopyWeights (CQCT_MeshFitterResult result, float **buffer)
 Copies the weight vector.
 
CQCT_EXTERN void CQCT_meshFitterResultSetWeights (CQCT_MeshFitterResult result, float const *buffer)
 Sets the weight vector.
 
CQCT_EXTERN size_t CQCT_meshFitterResultCopyVertexNormals (CQCT_MeshFitterResult result, float **buffer) __attribute__((deprecated("Use normals stored in deformedMesh instead.")))
 
CQCT_EXTERN size_t CQCT_meshFitterResultVolumeSamplingPositionsCount (CQCT_MeshFitterResult result)
 Returns the number of volume sampling positions.
 
CQCT_EXTERN size_t CQCT_meshFitterResultCopyVolumeSamplingPositions (CQCT_MeshFitterResult result, float **buffer)
 Copies the volume sampling positions.
 
CQCT_EXTERN size_t CQCT_meshFitterResultCopyVolumeSamples (CQCT_MeshFitterResult result, float **buffer)
 Copies the volume samples.
 
CQCT_EXTERN float CQCT_meshFitterResultMinimumDisplacementNorm (CQCT_MeshFitterResult result)
 Returns the minimum norm of the displacement vector.
 
CQCT_EXTERN float CQCT_meshFitterResultLogLikelihood (CQCT_MeshFitterResult result)
 Returns the current log likelihood of the model given the input volume.
 
CQCT_EXTERN float CQCT_meshFitterResultCopyPerVertexLogLikelihood (CQCT_MeshFitterResult result, float **buffer)
 
CQCT_EXTERN void CQCT_meshFitterResultSetLogLikelihood (CQCT_MeshFitterResult result, float ll)
 Sets the current log likelihood of the model given the input volume.
 
CQCT_EXTERN float CQCT_meshFitterResultEffectiveSigmaS (CQCT_MeshFitterResult result)
 Returns the current effective sigmaS (after applying decay)
 
CQCT_EXTERN size_t CQCT_meshFitterResultIterationCount (CQCT_MeshFitterResult result)
 Returns the iteration count.
 
CQCT_EXTERN void CQCT_meshFitterResultSetIterationCount (CQCT_MeshFitterResult result, size_t count)
 Sets the iteration count.
 
CQCT_EXTERN int CQCT_meshFitterResultHasConverged (CQCT_MeshFitterResult result)
 Returns whether the optimization has converged.
 
CQCT_EXTERN void CQCT_meshFitterResultSetHasConverged (CQCT_MeshFitterResult result, int converged)
 Sets whether the optimization has converged.
 
CQCT_EXTERN int CQCT_meshFitterResultSuccess (CQCT_MeshFitterResult result)
 Returns whether the optimization was successfull.
 
CQCT_EXTERN void CQCT_meshFitterResultSetSuccess (CQCT_MeshFitterResult result, int success)
 Sets whether the optimization was successfull.
 
CQCT_EXTERN size_t CQCT_meshFitterResultNonDecreasingCount (CQCT_MeshFitterResult result)
 Returns the current non decreasing count.
 
CQCT_EXTERN void CQCT_meshFitterResultSetNonDecreasingCount (CQCT_MeshFitterResult result, size_t count)
 Sets the current non decreasing count.
 
CQCT_EXTERN size_t CQCT_meshFitterStateCopyModelSamplingPositions (CQCT_MeshFitterState state, float **buffer)
 Copies the model sampling positions.
 

MeshFitter object type

CQCT_EXTERN CQCT_MeshFitter CQCT_createMeshFitter (const char *filename, CQCT_Error *error)
 Creates a mesh fitter given the configuration file.
 
CQCT_EXTERN CQCT_MeshFitterResult CQCT_meshFitterFit (CQCT_MeshFitter meshFitter, CQCT_VoxelVolume volume)
 Fits the reference mesh to the given voxel volume.
 
CQCT_EXTERN int CQCT_meshFitterFitOneIteration (CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
 Runs one iteration of the fitting algorithm.
 
CQCT_EXTERN int CQCT_meshFitterVolumeSamplingStep (CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
 Runs the volume sampling step.
 
CQCT_EXTERN int CQCT_meshFitterOptimalDisplacementStep (CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
 Runs the displacement optimization step.
 
CQCT_EXTERN int CQCT_meshFitterOptimalDeformationStep (CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
 Runs the deformation optimization step.
 
CQCT_EXTERN int CQCT_meshFitterLogLikelihoodStep (CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
 Runs the log likelihood computation step.
 
CQCT_EXTERN int CQCT_meshFitterConvergenceTestStep (CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
 Runs the convergence testing step.
 

Detailed Description

C API for CortidQCT.

The C API uses a reference counting object concept. Each 'object' has a retain count. If the user wants to retain / keep an object the retain count have to be incremented by called CQCT_retain(). Once the object is no longer required, CQCT_release() should be called to decrement the retain count. Once the retain count reaces zero the object is destroyed and the allocated memory is released. THIS MECHANISM IS NOT THREAD SAFE!

Naming Conventions

Memory Managfement

Example

An example can be found in bindings/C/examples/cli.c:

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
if (argc != 4) {
fprintf(stderr,
"Usage: %s <configurationFile> <inputVolume> <outputMesh> "
"[outputLabels]",
argv[0]);
return EXIT_FAILURE;
}
int exitCode = EXIT_FAILURE;
// Top level autorelease pool, this is always required.
CQCT_Error error = NULL;
// Load voxel volume from file
CQCT_voxelVolumeLoadFromFile(volume, argv[2], &error);
if (volume == NULL) {
fprintf(stderr, "Error: %s\n", CQCT_errorMessage(error));
goto EXIT;
}
// Load MeshFitter (configuration) from file
CQCT_MeshFitter fitter = CQCT_createMeshFitter(argv[1], &error);
if (fitter == NULL) {
fprintf(stderr, "Error: %s\n", CQCT_errorMessage(error));
goto EXIT;
}
// Call fitting function
CQCT_MeshFitterResult result = CQCT_meshFitterFit(fitter, volume);
// Ger result deformed mesh
CQCT_Mesh deformedMesh = CQCT_meshFitterResultMesh(result);
if (deformedMesh == NULL) {
fprintf(stderr, "Fitting failed with unkown error\n");
goto EXIT;
}
const char *labelFilename = argc == 5 ? argv[4] : "/dev/null";
// Write result mehr to file
if (!CQCT_meshAndLabelsWriteToFile(deformedMesh, argv[3], labelFilename,
&error)) {
fprintf(stderr, "Failed to write result mesh: %s\n",
goto EXIT;
}
// Everything went fine
exitCode = EXIT_SUCCESS;
EXIT:
// Release all created objects, doesn't do anything when passed NULL.
CQCT_release(volume);
CQCT_release(fitter);
// Release all autoreleased objects
return exitCode;
}

Function Documentation

CQCT_EXTERN Id CQCT_autorelease ( Id  obj)

Adds the object to the current autorelease pool. It's released when the pool is released.

CQCT_EXTERN void CQCT_autoreleasePoolPop ( )

Removes the current autorelease pool from the stack and releases all of its objects

CQCT_EXTERN size_t CQCT_colorToLabelMapCopyEntries ( CQCT_ColorToLabelMap  map,
unsigned int **  bufferPtr 
)

Copies the entries of the map into the given buffer.

If *bufferPtr == NULL the memory for the buffer is allocated by the function and the caller is responisble for releasing it. Entries are in the follwing order: [R0, G0, B0, L0, R1, G1, B1, L1, ...].

CQCT_EXTERN CQCT_Mesh CQCT_createMeshAndAllocateMemory ( size_t  nVertices,
size_t  nTriangles,
CQCT_Error error 
)

Creates an mesh and reserve space for vertices and indices.

Creates a mesh data structure and allocate memory for vertices, indices and labels.

Parameters
[in]nVerticesNumber of vertices to allocate memory for
[in]nTrianglesNumber of triangles to allocate memory for
[out]errorIn case of an error, an error object is copied to *error. NULL may be passed here to not get any error objects.
Returns
A newly created CQCT_Mesh opbject or NULL on error.
Note
The ownership of the mesh object is transfered to the caller.
The ownership of the error object is NOT transfered to teh caller.
It is very unlikely that this function returns an error. The only reason for failure is when the system is unable to allocate enough memory. It is therefore kind of save to pass NULL for error here.
CQCT_EXTERN CQCT_Mesh CQCT_meshAndLabelsFromFile ( const char *  meshFilename,
const char *  labelFilename,
CQCT_Error error 
)

Creates and loads a mesh from a mesh and a label file.

Parameters
[in]meshFilenamepath to the file to load the mesh from
[in]labelFilenamepath to the file to load the labels from
[out]errorIn case of an error, an error object is copied to *error. NULL may be passed here to not get any error object.
Returns
A newly created Mesh object.
Note
The ownershop is NOT transfered to the caller.
See also
CortidQCT::Mesh<float>::loadFromFile()
CQCT_EXTERN int CQCT_meshBarycentricInterpolation ( CQCT_Mesh  mesh,
CQCT_BarycentricPoint const *  barycentricPtr,
size_t  nPoints,
float const *  attributePtr,
size_t  attributeDimensions,
float **  bufferPtr,
CQCT_Error error 
)

Interpolates attribute values given at mesh vertices at arbitrary points on the surface of the mesh.

Parameters
[in]meshMesh object
[in]barycentricPtrpointer to a list of points in barycentric representation
[in]nPointsnumber of points
[in]attributePtrpointer to attribute buffer. Note that this buffer must hold attributeDimensions * N values, where N is the number of vertices in the mesh.
[in]attributeDimensionsnumber of attribute dimensions
[out]bufferPtrPointer where the interpolated values are stored. Must be able to hold nPoints * attributeDimensions values. Alternatively, if *bufferPtr == NULL, the required memory is allocated by the function and the pointer is returned in bufferPtr. The caller is responisble for releasing the memory, in both cases.
[out]errorpointer to an error object. If NULL errors are ignored.
Returns
0 on success, a negative value on error.
Precondition
barycentricPtr != NULL || nPoint == 0
bufferPtr != NULL || nPoints == 0
'attributePtr != NULL || nPoints == 0'
CQCT_EXTERN int CQCT_meshBarycentricToCartesian ( CQCT_Mesh  mesh,
CQCT_BarycentricPoint const *  barycentricPtr,
size_t  nPoints,
float **  bufferPtr,
CQCT_Error error 
)

Converts the given list of barycentric points in cartesian coordinates.

Parameters
[in]meshMesh object
[in]barycentricPtrpointer to list of points in barycentric representation
[in]nPointsnumber of points to convert
[out]bufferPtrPointer to the output buffer. The buffer must be able to hold 3 * N floats. Alternatively, bufferPtr can point to a NULL pointer. In this case the required memory is allocated by the function. Note that in both variants the caller is responsible for releasing the memory.
[out]errorpointer to error object where an error is stored in case of an error. Or NULL if no error should be returned.
Returns
0 on success, a negative value on error
Precondition
barycentricPtr != NULL || nPoints == 0
bufferPtr != NULL
CQCT_EXTERN size_t CQCT_meshCopyLabels ( CQCT_Mesh  mesh,
unsigned int **  bufferPtr 
)

Copies the mesh's labels into the given buffer.

See also
CQCT_meshCopyVertices()
CQCT_EXTERN size_t CQCT_meshCopyTriangles ( CQCT_Mesh  mesh,
ptrdiff_t **  bufferPtr 
)

Copies the mesh's indices into the given buffer.

See also
CQCT_meshCopyVertices()
CQCT_EXTERN size_t CQCT_meshCopyVertexNormals ( CQCT_Mesh  mesh,
float **  bufferPtr 
)

Copies the mesh's per-vertex normals into the given buffer.

If the pointer pointed to by bufferPtr (i.e. *bufferPtr) is NULL, memory is allocated, otherwise the pointed to memory is used.

Parameters
meshMesh object to inspect
bufferPtrPointer to a pointer to the start of a memory buffer, that is large enough to hold 3 * N * sizeof(float) (N = number of verices) bytes.* Alternativly, bufferPtr can point to a NULL pointer. In that case the required memory is allocated by the function.
Returns
Number of copied bytes. In case *bufferPtr == NULL it's the size of the allocated buffer.
Note
The caller is responsible to release the memory of the buffer, even if the memory was allocated by the function (when *bufferPtr == NULL).
CQCT_EXTERN size_t CQCT_meshCopyVertices ( CQCT_Mesh  mesh,
float **  bufferPtr 
)

Copies the mesh's vertices into the given buffer.

If the pointer pointed to by bufferPtr (i.e. *bufferPtr) is NULL, memory is allocated, otherwise the pointed to memory is used.

Parameters
meshMesh object to inspect
bufferPtrPointer to a pointer to the start of a memory buffer, that is large enough to hold 3 * N * sizeof(float) (N = number of verices) bytes. Alternativly, bufferPtr can point to a NULL pointer. In that case the required memory is allocated by the function.
Returns
Number of copied bytes. In case *bufferPtr == NULL it's the size of the allocated buffer.
Note
The caller is responsible to release the memory of the buffer, even if the memory was allocated by the function (when *bufferPtr == NULL).
CQCT_EXTERN float CQCT_meshFitterResultCopyPerVertexLogLikelihood ( CQCT_MeshFitterResult  result,
float **  buffer 
)

Copies the current per-vertex log likelihood vector of the model given the input volume to the given buffer

CQCT_EXTERN size_t CQCT_meshFitterResultCopyVertexNormals ( CQCT_MeshFitterResult  result,
float **  buffer 
)

Copies the vertex normals

Deprecated:
Deprecated since version 1.3, will be removed in 2.0. Use the per-vertex normals property of the defomed mesh instead.
CQCT_EXTERN CQCT_Mesh CQCT_meshFromFile ( const char *  filename,
CQCT_Error error 
)

Creates and loads a mesh from file.

Parameters
[in]filenamepath to the file to load the mesh from
[out]errorIn case of an error, an error object is copied to *error. NULL may be passed here to not get any error object.
Returns
A newly created Mesh object.
Note
The ownershop is NOT transfered to the caller.
See also
CortidQCT::Mesh<float>::loadFromFile()
CQCT_EXTERN CQCT_Mesh CQCT_meshFromFileWithCustomMapping ( const char *  filename,
CQCT_ColorToLabelMap  map,
CQCT_Error error 
)

Creates and loads a mesh from file using the given custom color to label mapping.

Parameters
[in]filenamepath to the file to load the mesh from
[in]mapcustom color to label map object
[out]errorIn case of an error, an error object is copied to *error. NULL may be passed here to not get any error object.
Returns
A newly created Mesh object.
Note
The ownershop is NOT transfered to the caller.
See also
CortidQCT::Mesh<float>::loadFromFile()
CQCT_EXTERN size_t CQCT_meshRayIntersections ( CQCT_Mesh  mesh,
CQCT_Ray raysPtr,
size_t  nRays,
CQCT_RayMeshIntersection **  intersectionsOutPtr 
)

Computes the intersection of a set of rays with the mesh.

If for any ray no intersection can be found, its signed distance t is set to infinity.

Parameters
[in]meshMesh object
[in]raysPtrpointer to array of CQCT_Ray objects
[in]nRaysNumber of rays
[out]intersectionsOutPtrPointer that contains the memory address where the intersection object should be stored. the underlying memory must be able to hold nRays * sizeof(CQCT_RayMeshIntersection) bytes. Alternatively, the address contained in intersectionsOutPtr can be set to NULL. In this case the memory is allocated by the function. The caller is responsible for relasing the memory, in all cases.
Precondition
mesh != NULL || nRays == 0
raysPtr != NULL || nRays == 0
intersectionsOutPtr != NULL || nRays == 0
Returns
number of bytes copied to *intersecionsOutPtr
CQCT_EXTERN void CQCT_meshSetLabels ( CQCT_Mesh  mesh,
unsigned int const *  buffer 
)

Copies the vertex labels from the given buffer into the mesh data structure.

Parameters
[in,out]meshmesh to set the indices for
[in]bufferbuffer to copy the indices from
CQCT_EXTERN void CQCT_meshSetTriangles ( CQCT_Mesh  mesh,
ptrdiff_t const *  buffer 
)

Copies the triangle indices from the given buffer into the mesh data structure.

Note
Vertices are expected to have the oder [i11, i12, i13, i21, i22, i23, ...], where im, denotes the m-th index of the n-th triangle.
Parameters
[in,out]meshmesh to set the indices for
[in]bufferbuffer to copy the indices from
CQCT_EXTERN void CQCT_meshSetVertexNormals ( CQCT_Mesh  mesh,
float const *  buffer 
)

Copies the per-vertex normals from the given buffer into the mesh data structure.

Note
Normals are expected to have the oder [n1x, n1y, n1z, n2x, n2y, n2z, ...]
Parameters
[in,out]meshmesh to set the vertex normals for
[in]bufferbuffer to copy the normals from
CQCT_EXTERN void CQCT_meshSetVertices ( CQCT_Mesh  mesh,
float const *  buffer 
)

Copies the vertices from the given buffer into the mesh data structure.

Note
Vertices are expected to have the oder [v1x, v1y, v1z, v2x, v2y, v2z, ...]
Parameters
[in,out]meshmesh to set the vertices for
[in]bufferbuffer to copy the vertices from
CQCT_EXTERN void CQCT_meshUpdatePerVertexNormals ( CQCT_Mesh  mesh)

Re-computes per-vertex normals.

Precondition
mesh != NULL
Parameters
[in]meshMesh object
CQCT_EXTERN void CQCT_meshUpsample ( CQCT_Mesh  mesh,
size_t  nTimes 
)

Upsamples the given mesh nTimes without touchting the original vertices.

Parameters
nTimesnumber of upsample iterations
Precondition
mesh != null || nTimes == 0
CQCT_EXTERN void CQCT_release ( Id  obj)

Releases an object, i.e. decrements its retain count and releases the memory held by the object iff the retain count reaces zero.