Skip to content

Libs/Mesh/meshFIM.h

Classes

Name
class meshFIM

Defines

Name
_EPS
ONE
CURVATURE
GENERATE_GEO_FILES

Macros Documentation

define _EPS

```cpp

define _EPS 1e-06

```

define ONE

```cpp

define ONE 1

```

define CURVATURE

```cpp

define CURVATURE 2

```

define GENERATE_GEO_FILES

```cpp

define GENERATE_GEO_FILES 1

```

Source code

```cpp

ifndef MESHFIM_H

define MESHFIM_H

include "TriMesh.h"

include "TriMesh_algo.h"

include "KDtree.h"

include "Color.h"

//#include "itkImageToImageFilter.h" //#include "itkLevelSet.h" //#include "itkIndex.h" //#include "vnl/vnl_math.h" //#include "itkDiffusionTensor3D.h"

include

include

include

include

include

include

include

include

include

include

include

include

include

//#include //#include

include

include

include

include

include

include

include

ifndef _EPS

define _EPS 1e-06

endif

define ONE 1

define CURVATURE 2

// SHIREEN

define GENERATE_GEO_FILES 1 // now disable till we incorporate the geodesic repulsion

// end SHIREEN

using trimesh::TriMesh; using trimesh::vec3; using trimesh::point; using trimesh::KDtree; using trimesh::Color;

class meshFIM {

public: typedef int VoxelIndexType;

typedef int index;
enum LabelType { MaskPoint, SeedPoint, ActivePoint, FarPoint, StopPoint, AlivePoint,ToBeAlivePoint };

TriMesh *m_meshPtr;
int NumComputation;
float imageOrigin[3];
float imageSpacing[3];
int imageSize[3];
int imageIndex[3];

std::vector<Color> colors;


void ComputeDistanceToLandmarksGivenTriangleInfo(TriMesh *mesh, const char *infilename, const char *outfilename);
void computeFIM(TriMesh *mesh, const char *vertT_filename);
void GetFeatureValues(point x, std::vector<float> &vals);
void ReadFaceIndexMap(const char *infilename);
void ReadFeatureFromFile(const char *infilename);
void ReadFeatureGradientFromFile(const char *infilename);
point GetFeatureDerivative(point p, int fIndex);

void need_abs_curvatures();
void need_edge_lengths();
void need_speed();
void need_oneringfaces();
void need_kdtree();


void SetMesh(TriMesh *mesh);
void SetStopDistance(float d) {
  m_StopDistance = d;
}
void setSpeedType(int st) {
  speedType = st;
  if (st != ONE && st != CURVATURE) {
    std::cout << "Impossible SpeedType set" << std::endl;
    throw(1);
  }
}


meshFIM() {
  m_meshPtr = NULL;
};
~meshFIM() {};

protected:

private:

std::list m_ActivePoints; std::vector m_SeedPoints; std::vector m_Label; float m_StopDistance;

TriMesh GetOutputMesh() { return m_meshPtr; } void MeshReader(char filename);

bool IsNonObtuse(int v, TriMesh::Face f); void SplitFace(std::vector &acFaces, int v, TriMesh::Face cf, int nfAdj); std::vector GetOneRing(int v); float Upwind(index currentVert, index vet); void InitializeAttributes(int currentVert, std::vector seeds); void CleanupAttributes(); float LocalSolver(index C, TriMesh::Face triangle, index currentVert);

void SetSeedPoint(std::vector SeedPoints) { m_SeedPoints = SeedPoints; }

int getSpeedType() { return speedType; } float GetStopDistance() { return m_StopDistance; }

void InitializeLabels(); void InitializeActivePoints(); float PointLength(point v);

void GenerateReducedData();

void loadGeodesicFile(TriMesh mesh, const char geoFilename);

void computeCoordXFiles(TriMesh mesh, const char vertT_filename); void computeCoordYFiles(TriMesh mesh, const char vertT_filename); void computeCoordZFiles(TriMesh mesh, const char vertT_filename); void computeCurvFiles(TriMesh mesh, const char vertT_filename);

void ComputeDistanceToCurve(TriMesh mesh, std::vector< point > curvePoints, const char outfilename);

void physicalPointToXYZ(point x, VoxelIndexType imageX, float imageOrigin[3], float imageSpacing[3]); VoxelIndexType indexToLinearIndex(VoxelIndexType imageX, int imageSize[3]); VoxelIndexType physicalPointToLinearIndex(point x); VoxelIndexType physicalPointToLinearIndex(point x, float imageOrigin[3], float imageSpacing[3], int imageSize[3]); double pointTriangleDistance(point P, TriMesh::Face face, point &PP); vec3 ComputeBarycentricCoordinates(point p, TriMesh::Face f); void need_maxedgelength(); int FindNearestVertex(point pt); int GetTriangleInfoForPoint(point x, TriMesh::Face &triangleX, float &alphaX, float &betaX, float &gammaX);

//Praful - for Riddhish project //float GetVirtualSource(vnl_vector baryCoord, vnl_matrix X, vnl_vector ds, vnl_vector< float > &x0); //float ComputeThreePointApproximatedGeodesic(vnl_vector x, vnl_vector baryCoord, vnl_matrix X, vnl_vector ds, char method); float ComputeCanonicalForm(point s, vnl_vector &x, vnl_matrix &X); float GetGeodesicDistance(int v1, int v2); //float GetBronsteinGeodesicDistance(TriMesh::Face Sa, TriMesh::Face Sb, vnl_vector baryCoord_a, vnl_vector baryCoord_b, char method);

// SHIREEN - compute distance to landmarks based on geodesic approximation //float GetBronsteinGeodesicDistance(point a, point b, char method); void ComputeDistanceToLandmark(TriMesh mesh, point landmark, bool apply_log, const char *outfilename); void UpdateGeodesicMapWithDistancesFromVertices(std::vector vertexIdlist); // end SHIREEN

// SHIREEN - computing geo distance on the fly for fuzzy geodesics int GetVertexInfoForPoint(point x); //std::vector ComputeDistanceToCurve(TriMesh mesh, std::vector< point > curvePoints); void WriteFeaFile(TriMesh mesh, char outfilename); void WriteFeaFile(std::vector fea, char outfilename); // end SHIREEN

point ComputeFeatureDerivative(int v, int nFeature);

int speedType;

// maps face index to speedInv std::vector speedInvVector;

// maps vertex index to abs_curv std::vector abs_curv;

// maps face index to vec3 of edge lengths with edges in this order: {01, 12, 20} std::vector edgeLengthsVector;

// maps vertex index to vertex index to distance? std::vector< std::map > geodesicMap;

// maps vertex index to something to do with the geodesic computation std::vector geodesic;

// maps something to something std::map > faceIndexMap;

// Used for ComputeBaryCentricCoordinates when faceIndexMap is unavailable. KDtree *kd;

// Used for GetNearestVertex; double maxEdgeLength;

std::vector< std::vector > vertOneringFaces;

std::vector< std::vector > features;

std::vector < std::vector > featureGradients;

};

endif

```


Updated on 2026-03-31 at 16:02:11 +0000