18 #ifndef CORTIDQCT_MATLAB_BINDINGS_CORTIDQCT_H__ 19 # define CORTIDQCT_MATLAB_BINDINGS_CORTIDQCT_H__ 24 # define CQCT_EXTERN extern "C" 66 enum CQCT_ErrorId { CQCT_ErrorId_Unknown, CQCT_ErrorId_InvalidArgument };
101 const char *filename,
215 const char *filename, CQCT_ColorToLabelMap map, CQCT_Error *error);
229 const char *labelFilename,
233 CQCT_EXTERN
int CQCT_loadMesh(CQCT_Mesh mesh,
const char *filename,
238 const char *filename,
239 CQCT_ColorToLabelMap map,
244 const char *labelFilename,
249 const char *meshFilename,
250 const char *labelsFilename,
324 ptrdiff_t **bufferPtr);
342 unsigned int **bufferPtr);
372 CQCT_Mesh mesh, CQCT_BarycentricPoint
const *barycentricPtr,
size_t nPoints,
373 float **bufferPtr, CQCT_Error *error);
399 CQCT_Mesh mesh, CQCT_BarycentricPoint
const *barycentricPtr,
size_t nPoints,
400 float const *attributePtr,
size_t attributeDimensions,
float **bufferPtr,
424 CQCT_Mesh mesh, CQCT_Ray *raysPtr,
size_t nRays,
float **positionsOutPtr,
425 ptrdiff_t **indicesOutPtr,
float **distancesOutPtr);
463 const char *filename,
475 unsigned int **bufferPtr);
480 const unsigned int *entries);
502 CQCT_EXTERN CQCT_MeshFitterState
506 CQCT_EXTERN CQCT_Mesh
514 CQCT_MeshFitterResult result,
float **buffer);
519 float const *buffer);
527 float const *buffer);
532 CQCT_MeshFitterResult result,
float **buffer)
533 __attribute__((deprecated(
"Use normals stored in deformedMesh instead.")));
541 CQCT_MeshFitterResult result,
float **buffer);
545 CQCT_MeshFitterResult result,
float **buffer);
604 CQCT_MeshFitterState state,
float **buffer);
621 CQCT_VoxelVolume volume);
625 CQCT_MeshFitterState state,
630 CQCT_MeshFitterState state,
635 CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error);
639 CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error);
643 CQCT_MeshFitterState state,
648 CQCT_MeshFitterState state,
CQCT_EXTERN CQCT_MeshFitter CQCT_createMeshFitter(const char *filename, CQCT_Error *error)
Creates a mesh fitter given the configuration file.
Definition: MeshFitter.cpp:12
CQCT_EXTERN int CQCT_meshFitterResultSuccess(CQCT_MeshFitterResult result)
Returns whether the optimization was successfull.
Definition: MeshFitterState.cpp:297
CQCT_EXTERN float CQCT_meshFitterResultCopyPerVertexLogLikelihood(CQCT_MeshFitterResult result, float **buffer)
Definition: MeshFitterState.cpp:224
CQCT_EXTERN CQCT_Mesh CQCT_createMesh()
Creates an empty mesh.
Definition: Mesh.cpp:10
CQCT_EXTERN float CQCT_meshFitterResultLogLikelihood(CQCT_MeshFitterResult result)
Returns the current log likelihood of the model given the input volume.
Definition: MeshFitterState.cpp:216
CQCT_EXTERN void CQCT_meshFitterResultSetLogLikelihood(CQCT_MeshFitterResult result, float ll)
Sets the current log likelihood of the model given the input volume.
Definition: MeshFitterState.cpp:242
ptrdiff_t triangleIndex
second barycentric coordinate
Definition: CortidQCT.h:186
CQCT_EXTERN void CQCT_autoreleasePoolPop()
Definition: ObjectBase.cpp:63
Ray type.
Definition: CortidQCT.h:191
CQCT_EXTERN const char * CQCT_errorMessage(CQCT_Error error)
Returns the error message.
Definition: Error.cpp:42
CQCT_ErrorId
Error types/Ids.
Definition: CortidQCT.h:98
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.
Definition: Mesh.cpp:90
CQCT_EXTERN size_t CQCT_colorToLabelMapCopyEntries(CQCT_ColorToLabelMap map, unsigned int **bufferPtr)
Copies the entries of the map into the given buffer.
Definition: ColorToLabelMap.cpp:54
CQCT_EXTERN Id CQCT_autorelease(Id obj)
Definition: ObjectBase.cpp:53
CQCT_EXTERN CQCT_Mesh CQCT_meshFitterResultReferenceMesh(CQCT_MeshFitterResult result)
Returns the result reference mesh.
Definition: MeshFitterState.cpp:73
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.
Definition: Mesh.cpp:14
CQCT_EXTERN size_t CQCT_meshCopyVertexNormals(CQCT_Mesh mesh, float **bufferPtr)
Copies the mesh's per-vertex normals into the given buffer.
Definition: Mesh.cpp:190
CQCT_EXTERN CQCT_Error CQCT_createError(enum CQCT_ErrorId id, const char *message)
Creates an error object.
Definition: Error.cpp:32
CQCT_EXTERN CQCT_ColorToLabelMap CQCT_createColorToLabelMap()
Creates a default color to label map.
Definition: ColorToLabelMap.cpp:11
CQCT_EXTERN size_t CQCT_meshFitterResultCopyVolumeSamplingPositions(CQCT_MeshFitterResult result, float **buffer)
Copies the volume sampling positions.
Definition: MeshFitterState.cpp:172
CQCT_EXTERN int CQCT_voxelVolumeLoadFromFile(CQCT_VoxelVolume volume, const char *filename, CQCT_Error *error)
Loads the voxel volume from file.
Definition: VoxelVolume.cpp:15
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...
Definition: Mesh.cpp:321
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.
Definition: Mesh.cpp:240
Definition: CortidQCT-Common.h:81
CQCT_EXTERN int CQCT_meshFitterVolumeSamplingStep(CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
Runs the volume sampling step.
Definition: MeshFitter.cpp:88
struct CQCT_MeshFitterState_t * CQCT_MeshFitterState
Mesh fitter state handle type.
Definition: CortidQCT.h:537
CQCT_EXTERN size_t CQCT_meshFitterResultCopyVertexNormals(CQCT_MeshFitterResult result, float **buffer) __attribute__((deprecated("Use normals stored in deformedMesh instead.")))
Definition: MeshFitterState.cpp:146
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.
Definition: Mesh.cpp:56
CQCT_EXTERN int CQCT_meshFitterResultHasConverged(CQCT_MeshFitterResult result)
Returns whether the optimization has converged.
Definition: MeshFitterState.cpp:278
CQCT_EXTERN size_t CQCT_meshFitterResultCopyVolumeSamples(CQCT_MeshFitterResult result, float **buffer)
Copies the volume samples.
Definition: MeshFitterState.cpp:190
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.
Definition: Mesh.cpp:272
CQCT_EXTERN size_t CQCT_meshCopyVertices(CQCT_Mesh mesh, float **bufferPtr)
Copies the mesh's vertices into the given buffer.
Definition: Mesh.cpp:160
CQCT_EXTERN void CQCT_colorToLabelMapSetEntries(CQCT_ColorToLabelMap map, size_t count, const unsigned int *entries)
Sets the entries of the mapping.
Definition: ColorToLabelMap.cpp:84
CQCT_EXTERN int CQCT_colorToLabelMapLoadFromFile(CQCT_ColorToLabelMap map, const char *filename, CQCT_Error *error)
Loads the mapping from YAML file.
Definition: ColorToLabelMap.cpp:17
CQCT_EXTERN size_t CQCT_meshCopyLabels(CQCT_Mesh mesh, unsigned int **bufferPtr)
Copies the mesh's labels into the given buffer.
Definition: Mesh.cpp:253
CQCT_EXTERN size_t CQCT_meshCopyTriangles(CQCT_Mesh mesh, ptrdiff_t **bufferPtr)
Copies the mesh's indices into the given buffer.
Definition: Mesh.cpp:221
CQCT_EXTERN size_t CQCT_voxelVolumeDepth(CQCT_VoxelVolume volume)
Returns the depth of the voxel volume.
Definition: matlab-addons.c:29
CQCT_EXTERN size_t CQCT_meshRayIntersectionsBuffers(CQCT_Mesh mesh, CQCT_Ray *raysPtr, size_t nRays, float **positionsOutPtr, ptrdiff_t **indicesOutPtr, float **distancesOutPtr)
Computes the intersection of a set of rays with the mesh.
Definition: matlab-addons.c:62
CQCT_EXTERN enum CQCT_ErrorId CQCT_errorType(CQCT_Error error)
Returns the error id.
Definition: Error.cpp:36
CQCT_EXTERN void CQCT_meshUpdatePerVertexNormals(CQCT_Mesh mesh)
Re-computes per-vertex normals.
Definition: Mesh.cpp:395
CQCT_EXTERN float CQCT_voxelVolumeVoxelHeight(CQCT_VoxelVolume volume)
Returns the height of a voxel.
Definition: matlab-addons.c:39
CQCT_EXTERN int CQCT_meshFitterConvergenceTestStep(CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
Runs the convergence testing step.
Definition: MeshFitter.cpp:232
Definition: CortidQCT-Common.h:67
CQCT_EXTERN float CQCT_voxelVolumeVoxelDepth(CQCT_VoxelVolume volume)
Returns the depth of a voxel.
Definition: matlab-addons.c:44
CQCT_EXTERN Id CQCT_retain(Id obj)
Retains an object, i.e. increments its retain count.
Definition: ObjectBase.cpp:73
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. ...
Definition: Mesh.cpp:208
CQCT_MeshFitterState CQCT_MeshFitterResult
Mesh fitter result object.
Definition: CortidQCT.h:540
CQCT_EXTERN void CQCT_meshFitterResultSetSuccess(CQCT_MeshFitterResult result, int success)
Sets whether the optimization was successfull.
Definition: MeshFitterState.cpp:306
Barycentric point type.
Definition: CortidQCT.h:183
CQCT_EXTERN void CQCT_autoreleasePoolPush()
Adds a new autorelease pool to the stack.
Definition: ObjectBase.cpp:59
CQCT_EXTERN size_t CQCT_voxelVolumeWidth(CQCT_VoxelVolume volume)
Returns the width of the voxel volume.
Definition: matlab-addons.c:19
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.
Definition: Mesh.cpp:42
struct CQCT_Error_t * CQCT_Error
Error type.
Definition: CortidQCT.h:106
CQCT_EXTERN size_t CQCT_meshFitterResultCopyDisplacementVector(CQCT_MeshFitterResult result, float **buffer)
Copies the displacement vector.
Definition: MeshFitterState.cpp:87
struct CQCT_Mesh_t * CQCT_Mesh
Mesh handle type.
Definition: CortidQCT.h:180
struct CQCT_MeshFitter_t * CQCT_MeshFitter
Mesh fitter handle type.
Definition: CortidQCT.h:533
CQCT_EXTERN void CQCT_meshUpsample(CQCT_Mesh mesh, size_t nTimes)
Upsamples the given mesh nTimes without touchting the original vertices.
Definition: Mesh.cpp:385
CQCT_EXTERN size_t CQCT_meshVertexCount(CQCT_Mesh mesh)
Return number of vertices of the given mesh.
Definition: Mesh.cpp:148
CQCT_EXTERN size_t CQCT_voxelVolumeHeight(CQCT_VoxelVolume volume)
Returns the height of the voxel volume.
Definition: matlab-addons.c:24
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.
Definition: Mesh.cpp:284
struct CQCT_VoxelVolume_t * CQCT_VoxelVolume
Voxel volume handle type.
Definition: CortidQCT.h:139
CQCT_EXTERN size_t CQCT_meshFitterResultNonDecreasingCount(CQCT_MeshFitterResult result)
Returns the current non decreasing count.
Definition: MeshFitterState.cpp:315
CQCT_EXTERN CQCT_Mesh CQCT_meshFromFile(const char *filename, CQCT_Error *error)
Creates and loads a mesh from file.
Definition: Mesh.cpp:29
CQCT_EXTERN CQCT_MeshFitterState CQCT_createMeshFitterState(CQCT_MeshFitter fitter, CQCT_VoxelVolume volume)
Creates an MeshFitter optimization state object.
Definition: MeshFitterState.cpp:47
CQCT_EXTERN float CQCT_meshFitterResultMinimumDisplacementNorm(CQCT_MeshFitterResult result)
Returns the minimum norm of the displacement vector.
Definition: MeshFitterState.cpp:207
CQCT_EXTERN CQCT_Mesh CQCT_meshFitterResultMesh(CQCT_MeshFitterResult result)
Returns the result mesh.
Definition: MeshFitterState.cpp:59
CQCT_EXTERN float CQCT_meshFitterResultEffectiveSigmaS(CQCT_MeshFitterResult result)
Returns the current effective sigmaS (after applying decay)
Definition: MeshFitterState.cpp:251
CQCT_EXTERN int CQCT_meshFitterOptimalDisplacementStep(CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
Runs the displacement optimization step.
Definition: MeshFitter.cpp:123
void * Id
Generic 'object' type.
Definition: CortidQCT.h:68
CQCT_EXTERN CQCT_VoxelVolume CQCT_createVoxelVolume()
Creates an empty voxel volume.
Definition: VoxelVolume.cpp:10
CQCT_EXTERN int CQCT_meshAndLabelsWriteToFile(CQCT_Mesh mesh, const char *meshFilename, const char *labelsFilename, CQCT_Error *error)
Writes mesh and labels to seperate files.
Definition: Mesh.cpp:120
CQCT_EXTERN void CQCT_release(Id obj)
Definition: ObjectBase.cpp:83
CQCT_EXTERN size_t CQCT_meshTriangleCount(CQCT_Mesh mesh)
Return number of triangles of the given mesh.
Definition: Mesh.cpp:154
CQCT_EXTERN CQCT_MeshFitterResult CQCT_meshFitterFit(CQCT_MeshFitter meshFitter, CQCT_VoxelVolume volume)
Fits the reference mesh to the given voxel volume.
Definition: MeshFitter.cpp:37
float v
first barycentric coordinate
Definition: CortidQCT.h:185
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. ...
Definition: Mesh.cpp:34
CQCT_EXTERN int CQCT_meshFitterFitOneIteration(CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
Runs one iteration of the fitting algorithm.
Definition: MeshFitter.cpp:53
CQCT_EXTERN int CQCT_meshFitterLogLikelihoodStep(CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
Runs the log likelihood computation step.
Definition: MeshFitter.cpp:196
CQCT_EXTERN size_t CQCT_colorToLabelMapEntryCount(CQCT_ColorToLabelMap map)
Returns number of entries of the map.
Definition: ColorToLabelMap.cpp:48
CQCT_EXTERN void CQCT_meshFitterResultSetIterationCount(CQCT_MeshFitterResult result, size_t count)
Sets the iteration count.
Definition: MeshFitterState.cpp:268
Definition: CortidQCT-Common.h:87
CQCT_EXTERN size_t CQCT_voxelVolumeCopyVoxels(CQCT_VoxelVolume volume, float **buffer)
Copies the voxel data to the given buffer.
Definition: VoxelVolume.cpp:62
CQCT_EXTERN int CQCT_loadMesh(CQCT_Mesh mesh, const char *filename, CQCT_Error *error)
Loads a mesh from file.
Definition: Mesh.cpp:51
CQCT_EXTERN size_t CQCT_meshFitterResultVolumeSamplingPositionsCount(CQCT_MeshFitterResult result)
Returns the number of volume sampling positions.
Definition: MeshFitterState.cpp:164
CQCT_EXTERN void CQCT_meshFitterResultSetNonDecreasingCount(CQCT_MeshFitterResult result, size_t count)
Sets the current non decreasing count.
Definition: MeshFitterState.cpp:324
CQCT_EXTERN size_t CQCT_meshFitterResultCopyWeights(CQCT_MeshFitterResult result, float **buffer)
Copies the weight vector.
Definition: MeshFitterState.cpp:118
CQCT_EXTERN void CQCT_meshFitterResultSetHasConverged(CQCT_MeshFitterResult result, int converged)
Sets whether the optimization has converged.
Definition: MeshFitterState.cpp:287
Definition: CortidQCT-Common.h:73
CQCT_EXTERN size_t CQCT_meshFitterResultIterationCount(CQCT_MeshFitterResult result)
Returns the iteration count.
Definition: MeshFitterState.cpp:259
CQCT_EXTERN int CQCT_meshFitterOptimalDeformationStep(CQCT_MeshFitter meshFitter, CQCT_MeshFitterState state, CQCT_Error *error)
Runs the deformation optimization step.
Definition: MeshFitter.cpp:158
CQCT_EXTERN void CQCT_meshFitterResultSetDisplacementVector(CQCT_MeshFitterResult result, float const *buffer)
Sets the displacement vector.
Definition: MeshFitterState.cpp:105
CQCT_EXTERN float CQCT_voxelVolumeVoxelWidth(CQCT_VoxelVolume volume)
Returns the width of a voxel.
Definition: matlab-addons.c:34
Definition: CortidQCT-Common.h:77
CQCT_EXTERN size_t CQCT_meshFitterStateCopyModelSamplingPositions(CQCT_MeshFitterState state, float **buffer)
Copies the model sampling positions.
Definition: MeshFitterState.cpp:334
struct CQCT_ColorToLabelMap_t * CQCT_ColorToLabelMap
ColorToLabelMap handle type.
Definition: CortidQCT.h:168
CQCT_EXTERN void CQCT_meshFitterResultSetWeights(CQCT_MeshFitterResult result, float const *buffer)
Sets the weight vector.
Definition: MeshFitterState.cpp:134
CQCT_EXTERN void CQCT_meshSetVertices(CQCT_Mesh mesh, float const *buffer)
Copies the vertices from the given buffer into the mesh data structure.
Definition: Mesh.cpp:178