![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Stream/IGTL/PolyData.h>
Class to send/receive a single Mesh over an OpenIGTLink connection. More...
Inheritance diagram for MeshData:Class to send/receive a single Mesh over an OpenIGTLink connection.
Public Member Functions | |
| MeshData (Connection &con, const std::string &deviceName) | |
| Constructor. | |
| MeshData (const MeshData &other)=default | |
| MeshData & | operator= (const MeshData &other)=default |
| MeshData (MeshData &&other) noexcept=delete | |
| MeshData & | operator= (MeshData &&other) noexcept=delete |
| bool | sendData (Data *inputData) const override |
Public Member Functions inherited from DataDevice | |
| DataDevice (IGTL::Connection &con, const std::string &deviceName, const Type &iglType, const std::vector< Type > &compatibleIgtlTypes, bool cloneData=false) | |
| Constructor. | |
Public Member Functions inherited from Device | |
| Device (Connection *connection, std::string name, Type igtlType, const std::vector< Type > &compatibleIgtlTypes={}) | |
| Device (const Device &other) | |
| Device & | operator= (const Device &other) |
| Device (Device &&other) noexcept | |
| Device & | operator= (Device &&other) noexcept |
| Type | deviceIgtlType () const |
| Gets the device type. | |
| std::string | deviceName () const |
| Gets the device Name. | |
| std::vector< Type > | compatibleIgtlTypes () const |
| Returns the IgtlTypes compatible with the device. | |
| bool | isCompatible (const Type &type) const |
| returns true if the device is compatible (i.e. can parse/process) the passed Type | |
| bool | isConnected () const |
| returns true if the connection associated to the device is valid. | |
| void | resetConnection () |
| Reset the connection to nullptr. The method can be called e.g. before the connection data is deleted. | |
Public Member Functions inherited from Mesh | |
| Mesh (const std::string &name="") | |
| Constructs an empty mesh. | |
| Mesh (const Mesh &other) | |
| Copy constructor with another mesh instance. | |
| Mesh & | operator= (const Mesh &other) |
| Copy assignment operator. | |
| bool | vertexIndexValid (int index) const |
| Checks whether index is within the vertex range. | |
| bool | faceIndexValid (int index) const |
| Checks whether index is within the face range. | |
| size_t | numberOfVertices () const |
| Number of vertices currently stored. May still include recently deleted vertices if no garbage collection has been performed. | |
| size_t | numberOfFaces () const |
| Number of faces currently stored. May still include recently deleted faces if no garbage collection has been performed. | |
| vec3 | vertex (int index) const |
| void | setVertex (int index, const vec3 &pos) |
| bool | isVertexManifold (int index) const |
| Check if vertex is manifold, i.e. there is maximum one outgoing boundary halfedge and there are no known duplicates. | |
| vec3 | vertexNormal (int vertexIndex) const |
| vec3 | halfedgeNormal (int vertexIndex, int faceIndex) const |
| void | setVertexNormal (int vertexIndex, const vec3 &normal) |
| void | setHalfedgeNormal (int vertexIndex, int faceIndex, const vec3 &normal) |
| vec4f | vertexColor (int vertexIndex) const |
| vec4f | halfedgeColor (int vertexIndex, int faceIndex) const |
| void | setVertexColor (int index, const vec4f &color) |
| void | setHalfedgeColor (int vertexIndex, int faceIndex, const vec4f &color) |
| void | setVertexColor (int index, const vec3f &color, double alpha=1.0) |
| void | setHalfedgeColor (int vertexIndex, int faceIndex, const vec3f &color, double alpha=1.0) |
| vec2f | vertexTexCoord (int vertexIndex) const |
| vec2f | halfedgeTexCoord (int vertexIndex, int faceIndex) const |
| void | setVertexTexCoord (int vertexIndex, const vec2f &coord) |
| void | setHalfedgeTexCoord (int vertexIndex, int faceIndex, const vec2f &coord) |
| vec2i | halfedgeVertices (int vertexIndex, int faceIndex) const |
| Get the indices of halfedge vertices, first being "from" vertex, second being "to" vertex. | |
| std::vector< int > | knownDuplicates (int v) const |
| Get known duplicates of the vertex (usually there should be none, duplicate vertices are explicitely created when the loaded/created mesh has invalid topology, for example if one edge is shared by more than 2 faces) | |
| std::vector< int > | vertexFaces (int v, bool considerDuplicates=true) const |
| Get all the faces which contain an input vertex and optionally vertex duplicates. | |
| std::vector< int > | vertexNeighboringVertices (int v, bool considerDuplicates=true) const |
| Get all the neighboring vertices (and optionally their duplicates) of an input vertex (and optionally its duplicates) | |
| std::vector< int > | faceNeighboringFaces (int v, bool considerDuplicates=true) const |
| Get all the neighboring faces of an input face (those that share an edge). If face vertices have duplicates, optionally the faces which contain those duplicates will also be added. | |
| bool | hasVertexNormals () const |
| void | removeVertexNormals () |
| bool | hasVertexColors () const |
| void | removeVertexColors () |
| bool | hasVertexTexCoords () const |
| void | removeVertexTexCoords () |
| bool | hasHalfedgeNormals () const |
| void | removeHalfedgeNormals () |
| bool | hasHalfedgeColors () const |
| void | removeHalfedgeColors () |
| bool | hasHalfedgeTexCoords () const |
| void | removeHalfedgeTexCoords () |
| void | unifyHalfedgeProperties (bool unifyHalfedgeNormals=true, bool unifyHalfedgeColors=true, bool unifyHalfedgeTexCoords=true, bool forceUnification=false) |
| Converts halfedge to vertex properties if this can be done without losing information Compares the normals, colors and texture coordinates between all halfedges belonging to each vertex. | |
| vec3i | faceVertices (int index) const |
| Returns a list of all vertices associated with the given face. | |
| vec3 | faceNormal (int faceIndex) const |
| Returns the normal of the given face. | |
| void | setFaceLabel (int face, unsigned int label, bool createTexture=true) |
| Set label of the face. | |
| void | setFaceLabels (const std::vector< unsigned int > &labels) |
| Set label of all faces. | |
| unsigned int | faceLabel (int face) const |
| Get label of the face. | |
| bool | hasFaceLabels () const |
| Returns true if mesh contains face labels. | |
| void | requestFaceLabels () |
| If faces have no labels, add them and set labels of all faces to 0. | |
| void | setVertexLabel (int vertex, unsigned int label) |
| Set label of the vertex. | |
| unsigned int | vertexLabel (int vertex) const |
| Get label of the vertex. | |
| bool | hasVertexLabels () const |
| Returns true if mesh contains vertex labels. | |
| void | requestVertexLabels () |
| If vertices have no labels, set labels of all vertices to 0. | |
| int | addVertex (const vec3 &position) |
| Adds a new vertex at the given position. Returns index of newly added vertex. | |
| int | addFace (const vec3i &vertexIndices, bool force=true, TopologyErrors *errorsOut=nullptr, std::map< int, int > *inputToAddedVertexIndices=nullptr) |
| bool | removeFace (int index, bool removeIsolatedVertices=false) |
| Removes a single face from the mesh, reducing the number of faces by 1 (calls garbage collection). | |
| void | removeFaces (const std::vector< int > &faces, bool removeIsolatedVertices=false) |
| Remove faces from face list. | |
| void | removeVertices (const std::vector< int > &vertices, bool removeIsolatedVertices=false) |
| Remove vertices from vertex list. | |
| const vec3 * | verticesPointer () const |
| const vec3 * | vertexNormalsPointer () const |
| const vec4f * | vertexColorsPointer () const |
| const vec2f * | vertexTexCoordsPointer () const |
| TriMesh & | triMesh () |
| When changing underlying TriMesh, the user is responsible for emitting signalMeshChanged signal. | |
| const TriMesh & | triMesh () const |
| MemImage * | texture () const |
| Returns the mesh texture image. | |
| MemImage * | vertexLabelTexture () const |
| Returns the texture image used for colors of mesh vertex labels. | |
| MemImage * | faceLabelTexture () const |
| Returns the texture image used for colors of mesh face labels. | |
| void | setTexture (std::unique_ptr< MemImage > tex) |
| Set mesh texture. The image ownership is transferred to the mesh class. | |
| void | setVertexLabelTexture (std::unique_ptr< MemImage > tex) |
| Set texture for mesh vertex labels. Should have width equal to the number of labels, and height equal to 1. The image ownership is transferred to the mesh class. | |
| void | setFaceLabelTexture (std::unique_ptr< MemImage > tex) |
| Set texture for mesh face labels. Should have width equal to the number of labels, and height equal to 1. The image ownership is transferred to the mesh class. | |
| void | setFilename (const std::string &name) |
| Sets a filename from where this mesh can be loaded. | |
| const std::string & | filename () const |
| Returns the filename from where this mesh can be loaded or an empty string if it's not on disk. | |
| const mat4 & | matrixRef () const |
| void | requestRenderingBuffers (bool useFaceNormals, Utils::OutputEigenVectorWrapper< double, 3 > positions, std::vector< vec3i > &triangleIndices, Utils::OptionalOutputEigenVectorWrapper< double, 3 > normals={}, Utils::OptionalOutputEigenVectorWrapper< float, 4 > colors={}, Utils::OptionalOutputEigenVectorWrapper< float, 2 > texCoords={}, std::vector< uint32_t > *indices=nullptr, bool faceIndices=true, std::vector< uint32_t > *labels=nullptr, bool faceLabels=true) const |
| Copies the mesh data to arrays suitable for OpenGl vertex buffers. | |
| void | requestRenderingBuffers2 (bool useFaceNormals, Utils::OptionalOutputEigenVectorWrapper< double, 3 > positions, Utils::OptionalOutputEigenVectorWrapper< int, 3 > triangleIndices, Utils::OptionalOutputEigenVectorWrapper< double, 3 > normals={}, Utils::OptionalOutputEigenVectorWrapper< float, 4 > colors={}, Utils::OptionalOutputEigenVectorWrapper< float, 2 > texCoords={}, std::vector< uint32_t > *faceIndices=nullptr, std::vector< uint32_t > *faceLabels=nullptr, std::vector< uint32_t > *vertexIndices=nullptr, std::vector< uint32_t > *vertexLabels=nullptr) const |
| More flexible version of requestRenderingBuffers(). | |
| void | requestIndexedBuffers (std::vector< vec3 > &positions, std::vector< vec3i > &triangleIndices, std::vector< vec3 > *normals=nullptr, std::vector< vec4f > *colors=nullptr, std::vector< vec2f > *texCoords=nullptr, std::vector< vec3i > *triangleNormals=nullptr, std::vector< vec3i > *triangleColors=nullptr, std::vector< vec3i > *triangleTexCoords=nullptr) const |
| Copies the mesh data to arrays without performing type conversions. | |
| void | beginUpdate () |
| After this call no signals will be emitted if the mesh data is changed. | |
| void | endUpdate () |
| End update and send mesh changed signal. | |
| bool | signalsBlocked () const |
| Returns true if the signals are blocked. | |
| void | emitMeshChangedSignal () |
| void | garbageCollection () |
| const std::vector< std::unique_ptr< CustomPropertyBase > > & | customVertexProperties () const |
| const std::vector< std::unique_ptr< CustomPropertyBase > > & | customFaceProperties () const |
| template<typename T> | |
| CustomVertexProperty< T > * | addVertexProperty (const std::string &name) |
| Wraps an existing property on the underlying TriMesh or creates a new one. | |
| template<typename T> | |
| CustomVertexProperty< T > * | getVertexProperty (const std::string &name) |
| Retrieves a custom property with a given name. | |
| template<typename T> | |
| CustomFaceProperty< T > * | addFaceProperty (const std::string &name) |
| Wraps an existing property on the underlying TriMesh or creates a new one. | |
| template<typename T> | |
| CustomFaceProperty< T > * | getFaceProperty (const std::string &name) |
| Retrieves a custom property with a given name. | |
| bool | removeVertexProperty (const std::string &name) |
| bool | removeFaceProperty (const std::string &name) |
| void | createDefaultLabelTexture (bool faceLabels, unsigned int numLabels=100u) |
| Create a default texture for vertex or face labels (depending on the input flag 'faceLabels'). | |
| Kind | kind () const override |
| Return the kind of this data. | |
| Geometry::AlignedBox | bounds () const override |
| Returns the axis-aligned bounding box of this data in world space. | |
| Pose::TransformationConvention | matrixConvention () const override |
| Matrices of meshes map to world coordinate system. | |
| void | setMatrix (const mat4 &m) override |
| Sets tha matrix of this data and sets the bounding box dirty. | |
| bool | isAnnotationType () const override |
| Returns true since the object has a dedicated GlMesh annotation. | |
| VertexIterator | v_begin () |
| VertexIterator | v_end () |
| FaceIterator | f_begin () |
| Iterator over all faces. | |
| FaceIterator | f_end () |
| VertexVertexIterator | vv_begin (unsigned int id) |
| Iterator over neighboring vertices of a vertex. | |
| VertexVertexIterator | vv_end (unsigned int id) |
| VertexFaceIterator | vf_begin (unsigned int id) |
| Iterator over faces which contain a provided vertex. | |
| VertexFaceIterator | vf_end (unsigned int id) |
| FaceVertexIterator | fv_begin (unsigned int id) |
| Iterator over vertex which are part of a provided face. | |
| FaceVertexIterator | fv_end (unsigned int id) |
| FaceFaceIterator | ff_begin (unsigned int id) |
| Iterator over neighboring (sharing an edge) faces of a face. | |
| FaceFaceIterator | ff_end (unsigned int id) |
| void | computeVertexNormals (VertexNormalWeighting weighting=VertexNormalWeighting::NelsonMax) |
| Compute vertex normals as weighted average of normals of faces around a vertex. Replaces previous normals. | |
| void | computeFaceNormals () |
| Compute face normals. Replaces previous normals. | |
| Geometry::AlignedBox | boundsLocal () const |
| Returns the axis-aligned bounding box of this data in local space. | |
| bool | isManifold () const |
| Checks whether mesh is manifold, i.e. | |
| bool | isClosed () const |
| Checks whether mesh is closed, i.e. there are no boundary edges and no isolated vertices. | |
| bool | isSelfIntersecting () const |
| Checks whether mesh is self intersecting, i.e. there are triangles that intersect each other. | |
| bool | isWatertight (bool checkSelfIntersection) const |
| Checks whether mesh is watertight, i.e. | |
| std::vector< std::list< std::pair< int, int > > > | listHoles () const |
| Returns holes in the mesh The returned vector contains for every hole a list of its boundary edges in sequential order. | |
Public Member Functions inherited from Data | |
| Data (const std::string &name="") | |
| Data (const Data &other) | |
| Data & | operator= (const Data &other) |
| virtual | ~Data () |
| Mandatory virtual destructor. | |
| virtual Modality | modality () const |
| Return the modality of this data. | |
| const std::string & | name () const |
| Return the name of this data. | |
| void | setName (const std::string &name) |
| Sets the name of this data. | |
| const DataComponentList & | components () const |
| Returns the list of DataComponents for this data. | |
| DataComponentList & | components () |
| virtual std::string | describe () const |
| Human readable description of the data for showing in the info bar. | |
| virtual void | setMatrixFromWorld (const mat4 &m) |
| Set matrix mapping from the world coordinate system to the data coordinate system. | |
| virtual void | setMatrixToWorld (const mat4 &m) |
| Set matrix mapping from the data coordinate system to the world coordinate system. | |
| virtual mat4 | matrixFromWorld () const |
| Get matrix mapping from the world coordinate system to the data coordinate system. | |
| virtual mat4 | matrixToWorld () const |
| Get matrix mapping from the data coordinate system to the world coordinate system. | |
| virtual mat4 | matrix () const |
| Return the transformation matrix. | |
Static Public Member Functions | |
| static std::vector< Type > | supportedIgtlTypes () |
Static Public Member Functions inherited from Device | |
| static IO | ioConfiguration () |
| Returns the IO configuration of the device (whether the device can handle input, output or both input and output operations) | |
Static Public Member Functions inherited from Mesh | |
| static std::unique_ptr< Mesh > | createFromArrays (const Utils::EigenVectorWrapper< double, 3 > &vertices, const Utils::OptionalEigenVectorWrapper< double, 3 > &normals, const Utils::OptionalEigenVectorWrapper< float, 3 > &colors, const Utils::OptionalEigenVectorWrapper< float, 2 > &texCoords, const std::vector< vec3i > &triangleVertices, const std::vector< vec3i > &triangleNormals, const std::vector< vec3i > &triangleColors, const std::vector< vec3i > &triangleTexCoords) |
| Clears the current mesh, then constructs a new one from the given data vectors. | |
Static Public Member Functions inherited from Data | |
| static std::string | modalityString (Data::Modality m) |
| Return the name of an image modality. | |
| static Data::Modality | stringToModality (const std::string &s) |
| Returns the modality corresponding to a modality string or NA if nothing matches. | |
Additional Inherited Members | |
Public Types inherited from Device | |
| enum | IO { INPUT , OUTPUT , INPUT_OUTPUT , UNKNOWN } |
Public Types inherited from Mesh | |
| enum class | VertexNormalWeighting { Uniform , Angle , Area , NelsonMax } |
| Weighting schemes for averaging normals of faces around a vertex to obtain vertex normals. More... | |
| using | index_type = unsigned int |
Public Types inherited from Data | |
| enum | Kind { UNKNOWN = 0 , IMAGE = 1 , VOLUME = 2 , IMAGESET = 3 , VOLUMESET = 4 , IMAGESTREAM = 5 , VOLUMESTREAM = 6 , POINTSET = 7 , SURFACE = 8 , TRACKINGSTREAM = 9 , LIVETRACKINGSTREAM = TRACKINGSTREAM , TRACKINGDATA = 10 , TREE = 11 , TENSOR = 12 , POLYDATASTREAM = 13 , STEREOIMAGESET = 14 , STEREOIMAGESTREAM = 15 , VOLUMETRICMESH = 16 } |
| Kind of data. More... | |
| enum | Modality { NA = 0 , XRAY = 1 , CT = 2 , MRI = 3 , ULTRASOUND = 4 , VIDEO = 5 , NM = 6 , OCT = 7 , LABEL = 8 , DISTANCE = 9 } |
| Image modality of the data. More... | |
Public Attributes inherited from DataDevice | |
| Signal< bool > | signalDataReceived |
Public Attributes inherited from Mesh | |
| Signal | signalMeshChanged |
| Signal emitted when the mesh data has changed. | |
Public Attributes inherited from Data | |
| Signal< const Data * > | signalDeleted |
| Signal emitted when this instance is deleted. | |
| Signal< const Data * > | signalMatrixChanged |
| Signal emitted when the transformation of this Data has changed. | |
| Signal< std::string > | signalNameChanged |
| Signal emitted when the name changed. | |
Protected Member Functions inherited from Data | |
| void | swapWith (Data &other) |
| Swaps the data and emits a matrix and name changed signal for both. | |
Protected Attributes inherited from DataDevice | |
| bool | m_cloneData |
Protected Attributes inherited from Device | |
| std::vector< Type > | m_compatibleIgtlTypes |
| Type | m_iglType |
| The igl types that are supported by this device for conversion from/to ImFusion data. | |
| std::string | m_deviceName |
| Data type of the device. | |
| Connection * | m_iglConnection |
| Device name assigned to this device. | |
| std::unique_ptr< DeviceImpl > | m_impl |
| Igl Connection Object. | |
Protected Attributes inherited from Data | |
| mat4 | m_matrix |
| Transformation matrix. | |
| std::recursive_mutex * | m_matrixMutex |
| Used to internally synchronize access to the matrix of data. | |
| DataComponentList | m_dataComponentList |
| The list of DataComponents for this data. | |
|
overridevirtual |
Implements DataDevice.