MeVisLab Scripting Reference
MLWEMPatchWrapper Class Reference

#include <mlWEMPatchWrapper.h>

Inherits QObject.

Public Slots

Identification methods.

Accessing the id, label, and description.

unsigned int getId () const
 
void setLabel (const QString &label)
 
QString getLabel () const
 
void setDescription (const QString &desc)
 
QString getDescription () const
 
bool isTrianglePatch () const
 
bool isQuadPatch () const
 
Global information.

Accessing global / geometric information of this WEMPatch.

double getArea () const
 
double getVolume () const
 
double getLUTMin () const
 
double getLUTMax () const
 
QVariantList getMinBoundingBox () const
 
QVariantList getMaxBoundingBox () const
 
bool isPointInside (const QList< double > &position) const
 
double getPointToTriangleAtDistance (const QList< double > &position, int triangleIndex) const
 
QVariantMap calculatePCA () const
 
PrimitiveValueList access.

Access methods for the PrimitiveValueLists.

MLWEMPrimitiveValueListWrappercreateOrGetPrimitiveValueList (const QString &description)
 
MLWEMPrimitiveValueListWrappergetPrimitiveValueList (const QString &description)
 
QStringList getRegisteredPrimitiveValueLists () const
 
bool removePrimitiveValueList (const QString &name)
 
NumPy access.

Methods to access the patch via NumPy arrays.

QVariant getNodePositionsAsNumPyArray ()
 
QVariant getNodeNormalsAsNumPyArray ()
 
QVariant getNodeColorsAsNumPyArray ()
 
QVariant getFaceNormalsAsNumPyArray ()
 
QVariant getTrianglesAsNumPyArray ()
 
QVariant getQuadsAsNumPyArray ()
 
WEMNode properties.

Accessing the properties of the WEMNodes of this WEMPatch.

int getNumNodes () const
 
QVariantList getNodeNormalAt (int index) const
 
void setNodeNormalAt (int index, const QVariantList &normal)
 
QVariantList getNodePositionAt (int index) const
 
void setNodePosition (int index, const QVariantList &position)
 
void translateNodeAt (int index, const QVariantList &offset)
 
QVariantList getNodeColorAt (int index) const
 
void setNodeColorAt (int index, const QVariantList &color)
 
bool isNodeBoundaryAt (int index) const
 
double getNodeLargestDihedralAngleAt (int index) const
 
WEMNode neighborhood access.

Methods to access the neighboring primitives of a WEMNode.

int getNodeNumEdgesAt (int index) const
 
int getNodeNumFacesAt (int index) const
 
int getNodeEdgeIndexAt (int index, int attachedEdgeIndex) const
 
int getNodeFaceIndexAt (int index, int attachedFaceIndex) const
 
WEMEdge properties.

Accessing the properties of the WEMEdges of this WEMPatch.

bool hasEdges () const
 
int getNumEdges () const
 
double getEdgeLengthAt (int index) const
 
double getEdgeDihedralAngleAt (int index) const
 
WEMEdge neighborhood access.

Methods for accessing the neighboring primitives of a WEMEdge.

int getEdgeHeadNodeIndexAt (int index) const
 
int getEdgeTailNodeIndexAt (int index) const
 
int getEdgeRightFaceIndexAt (int index) const
 
int getEdgeLeftFaceIndexAt (int index) const
 
int getEdgeRightPredecessorEdgeIndexAt (int index) const
 
int getEdgeLeftPredecessorEdgeIndexAt (int index) const
 
int getEdgeRightSuccessorEdgeIndexAt (int index) const
 
int getEdgeLeftSuccessorEdgeIndexAt (int index) const
 
WEMFace properties.

Accessing the properties of the WEMFaces of this WEMPatch.

int getNumFaces () const
 
QVariantList getFaceNormalAt (int index) const
 
void setFaceNormalAt (int index, const QVariantList &normal)
 
QVariantList getFaceCentroidAt (int index) const
 
double getFacePerimeterAt (int index) const
 
double getFaceAreaAt (int index) const
 
int isFaceConcaveAt (int index) const
 
WEMFace neighborhood access.

Methods for accessing the neighboring primitives of a WEMFace.

int getFaceNumNodesAt (int index) const
 
int getFaceNumEdgesAt (int index) const
 
int getFaceNodeIndexAt (int index, int attachedNodeIndex) const
 
int getFaceEdgeIndexAt (int index, int attachedEdgeIndex) const
 
Normals/BoundingBox/Edge connectivity.

Methods for accessing the neighboring primitives of a WEMFace.

void buildEdgeConnectivity ()
 
void computeNormals ()
 
void computeBoundingBox ()
 

Detailed Description

A class that wraps WEMPatch objects for use in scripting.

If you need fast ray intersection with the WEMPatch, have a look at the MLWEMBoundingVolumeHierarchyWrapper.

Member Function Documentation

◆ buildEdgeConnectivity

void MLWEMPatchWrapper::buildEdgeConnectivity ( )
slot

(re-) builds the edge connectivity.

◆ calculatePCA

QVariantMap MLWEMPatchWrapper::calculatePCA ( ) const
slot

Calculates the main axes using PCA.

Returns a dictionary with the following values:

  • "center" the center of the object (aka mid point)
  • "centerOfMass" the center of mass (aka barycenter)
  • "longestAxis" the longest axis (normalized)
  • "middleAxis" the middle axis (normalized)
  • "shortestAxis" the shortest axis (normalized)
  • "longestExtent" the extent along the longest axis
  • "middleExtent" the extent along the middle axis
  • "shortestExtent" the extent along the shortest axis

◆ computeBoundingBox

void MLWEMPatchWrapper::computeBoundingBox ( )
slot

computes the bounding box.

◆ computeNormals

void MLWEMPatchWrapper::computeNormals ( )
slot

computes the node normals from face normals.

◆ createOrGetPrimitiveValueList

MLWEMPrimitiveValueListWrapper * MLWEMPatchWrapper::createOrGetPrimitiveValueList ( const QString & description)
slot

Creates a new PVL if it does not exist or returns the existing PVL under the given name.

◆ getArea

double MLWEMPatchWrapper::getArea ( ) const
slot

Returns the area of this patch in square mm.

◆ getDescription

QString MLWEMPatchWrapper::getDescription ( ) const
slot

Returns the 'description' attribute of this WEMPatch.

◆ getEdgeDihedralAngleAt

double MLWEMPatchWrapper::getEdgeDihedralAngleAt ( int index) const
slot

Returns the dihedral angle in radians of the edge at the given index.

◆ getEdgeHeadNodeIndexAt

int MLWEMPatchWrapper::getEdgeHeadNodeIndexAt ( int index) const
slot

Returns the global index of the head node of the edge with the given index.

◆ getEdgeLeftFaceIndexAt

int MLWEMPatchWrapper::getEdgeLeftFaceIndexAt ( int index) const
slot

Returns the global index of the left face of the edge with the given index.

◆ getEdgeLeftPredecessorEdgeIndexAt

int MLWEMPatchWrapper::getEdgeLeftPredecessorEdgeIndexAt ( int index) const
slot

Returns the global index of the left predecessor edge of the edge with the given index.

◆ getEdgeLeftSuccessorEdgeIndexAt

int MLWEMPatchWrapper::getEdgeLeftSuccessorEdgeIndexAt ( int index) const
slot

Returns the global index of the left successor edge of the edge with the given index.

◆ getEdgeLengthAt

double MLWEMPatchWrapper::getEdgeLengthAt ( int index) const
slot

Returns the length in mm of the edge at the given index.

◆ getEdgeRightFaceIndexAt

int MLWEMPatchWrapper::getEdgeRightFaceIndexAt ( int index) const
slot

Returns the global index of the right face of the edge with the given index.

◆ getEdgeRightPredecessorEdgeIndexAt

int MLWEMPatchWrapper::getEdgeRightPredecessorEdgeIndexAt ( int index) const
slot

Returns the global index of the right predecessor edge of the edge with the given index.

◆ getEdgeRightSuccessorEdgeIndexAt

int MLWEMPatchWrapper::getEdgeRightSuccessorEdgeIndexAt ( int index) const
slot

Returns the global index of the right successor edge of the edge with the given index.

◆ getEdgeTailNodeIndexAt

int MLWEMPatchWrapper::getEdgeTailNodeIndexAt ( int index) const
slot

Returns the global index of the tail node of the edge with the given index.

◆ getFaceAreaAt

double MLWEMPatchWrapper::getFaceAreaAt ( int index) const
slot

Returns the area in square mm of the face with the given index.

◆ getFaceCentroidAt

QVariantList MLWEMPatchWrapper::getFaceCentroidAt ( int index) const
slot

Returns the geometric centroid of the face with the given index.

◆ getFaceEdgeIndexAt

int MLWEMPatchWrapper::getFaceEdgeIndexAt ( int index,
int attachedEdgeIndex ) const
slot

Returns the global index of the edge attached to the face with the given index.

◆ getFaceNodeIndexAt

int MLWEMPatchWrapper::getFaceNodeIndexAt ( int index,
int attachedNodeIndex ) const
slot

Returns the global index of the node attached to the face with the given index.

◆ getFaceNormalAt

QVariantList MLWEMPatchWrapper::getFaceNormalAt ( int index) const
slot

Returns the normal of the face with the given index.

◆ getFaceNormalsAsNumPyArray

QVariant MLWEMPatchWrapper::getFaceNormalsAsNumPyArray ( )
slot

Returns all face normals as NumPyArray of 3D vectors.

◆ getFaceNumEdgesAt

int MLWEMPatchWrapper::getFaceNumEdgesAt ( int index) const
slot

Returns the number of edges attached to the face with the given index.

The number of edges is not explicitly stored for a face but it is the same as the number of nodes. This method is just for convenience.

◆ getFaceNumNodesAt

int MLWEMPatchWrapper::getFaceNumNodesAt ( int index) const
slot

Returns the number of nodes attached to the face with the given index.

◆ getFacePerimeterAt

double MLWEMPatchWrapper::getFacePerimeterAt ( int index) const
slot

Returns the perimeter of the face with the given index.

◆ getId

unsigned int MLWEMPatchWrapper::getId ( ) const
slot

Returns the unique ID of this CSO.

◆ getLabel

QString MLWEMPatchWrapper::getLabel ( ) const
slot

Returns the 'label' attribute of this WEMPatch.

◆ getLUTMax

double MLWEMPatchWrapper::getLUTMax ( ) const
slot

Returns the LUT max value.

◆ getLUTMin

double MLWEMPatchWrapper::getLUTMin ( ) const
slot

Returns the LUT min value.

◆ getMaxBoundingBox

QVariantList MLWEMPatchWrapper::getMaxBoundingBox ( ) const
slot

Returns the max position of the axis aligned bounding box of this WEMPatch.

◆ getMinBoundingBox

QVariantList MLWEMPatchWrapper::getMinBoundingBox ( ) const
slot

Returns the min position of the axis aligned bounding box of this WEMPatch.

◆ getNodeColorAt

QVariantList MLWEMPatchWrapper::getNodeColorAt ( int index) const
slot

Returns the color of the node at the given index.

◆ getNodeColorsAsNumPyArray

QVariant MLWEMPatchWrapper::getNodeColorsAsNumPyArray ( )
slot

Get all node colors as NumPy array of 4D vectors (RGBA).

◆ getNodeEdgeIndexAt

int MLWEMPatchWrapper::getNodeEdgeIndexAt ( int index,
int attachedEdgeIndex ) const
slot

Returns the global index of the edge attached to the node at the given index.

◆ getNodeFaceIndexAt

int MLWEMPatchWrapper::getNodeFaceIndexAt ( int index,
int attachedFaceIndex ) const
slot

Returns the global index of the face attached to the node at the given index.

◆ getNodeLargestDihedralAngleAt

double MLWEMPatchWrapper::getNodeLargestDihedralAngleAt ( int index) const
slot

Returns the largest dihedral angle in radians of faces attached to the node at the given index.

◆ getNodeNormalAt

QVariantList MLWEMPatchWrapper::getNodeNormalAt ( int index) const
slot

Returns the normal of the node at the given index.

◆ getNodeNormalsAsNumPyArray

QVariant MLWEMPatchWrapper::getNodeNormalsAsNumPyArray ( )
slot

Get all node normals as NumPy array of 3D vectors.

◆ getNodeNumEdgesAt

int MLWEMPatchWrapper::getNodeNumEdgesAt ( int index) const
slot

Returns the number of attached edges to the node at the given index.

◆ getNodeNumFacesAt

int MLWEMPatchWrapper::getNodeNumFacesAt ( int index) const
slot

Returns the number of attached faces to the node at the given index.

◆ getNodePositionAt

QVariantList MLWEMPatchWrapper::getNodePositionAt ( int index) const
slot

Returns the position of the node at the given index.

◆ getNodePositionsAsNumPyArray

QVariant MLWEMPatchWrapper::getNodePositionsAsNumPyArray ( )
slot

Get all node positions as NumPy array of 3D vectors.

◆ getNumEdges

int MLWEMPatchWrapper::getNumEdges ( ) const
slot

Returns the number of edges.

◆ getNumFaces

int MLWEMPatchWrapper::getNumFaces ( ) const
slot

Returns the number of faces.

◆ getNumNodes

int MLWEMPatchWrapper::getNumNodes ( ) const
slot

Returns the number of nodes.

◆ getPointToTriangleAtDistance

double MLWEMPatchWrapper::getPointToTriangleAtDistance ( const QList< double > & position,
int triangleIndex ) const
slot

Returns the distance of the given point to a triangle at the given index.

If the mesh is not a triangle mesh, -1 is returned.

◆ getPrimitiveValueList

MLWEMPrimitiveValueListWrapper * MLWEMPatchWrapper::getPrimitiveValueList ( const QString & description)
slot

Returns the PVL with the given name or NULL if that PVL does not exist.

◆ getQuadsAsNumPyArray

QVariant MLWEMPatchWrapper::getQuadsAsNumPyArray ( )
slot

Returns an array of node indices (4 per quad) describing the node indices for each quad/face.

The indices are to be used with the array returned by getNodePositionsAsNumPyArray(). Throws an error if the patch is not a quad patch.

◆ getRegisteredPrimitiveValueLists

QStringList MLWEMPatchWrapper::getRegisteredPrimitiveValueLists ( ) const
slot

Get descriptions of all registered PrimitiveValueLists.

◆ getTrianglesAsNumPyArray

QVariant MLWEMPatchWrapper::getTrianglesAsNumPyArray ( )
slot

Returns an array of node indices (3 per triangle) describing the node indices for each triangle/face.

The indices are to be used with the array returned by getNodePositionsAsNumPyArray(). Throws an error if the patch is not a triangle patch.

◆ getVolume

double MLWEMPatchWrapper::getVolume ( ) const
slot

Returns the volume of this patch in cubic mm.

◆ hasEdges

bool MLWEMPatchWrapper::hasEdges ( ) const
slot

Returns whether this WEMPatch has edges.

◆ isFaceConcaveAt

int MLWEMPatchWrapper::isFaceConcaveAt ( int index) const
slot

Returns the number of concavities of the face with the given index.

If the face is convex, the return value is 0.

◆ isNodeBoundaryAt

bool MLWEMPatchWrapper::isNodeBoundaryAt ( int index) const
slot

Returns whether the node at the given index is a boundary node.

◆ isPointInside

bool MLWEMPatchWrapper::isPointInside ( const QList< double > & position) const
slot

Returns whether the given position is inside this WEMPatch.

◆ isQuadPatch

bool MLWEMPatchWrapper::isQuadPatch ( ) const
slot

Returns is the patch is a quad patch.

◆ isTrianglePatch

bool MLWEMPatchWrapper::isTrianglePatch ( ) const
slot

Returns is the patch is a triangle patch.

◆ removePrimitiveValueList

bool MLWEMPatchWrapper::removePrimitiveValueList ( const QString & name)
slot

Removes the primitive value list with the given name. Returns whether the operation was successful.

◆ setDescription

void MLWEMPatchWrapper::setDescription ( const QString & desc)
slot

Sets the 'description' attribute of this WEMPatch.

◆ setFaceNormalAt

void MLWEMPatchWrapper::setFaceNormalAt ( int index,
const QVariantList & normal )
slot

Sets the face normal of the face with the given index.

◆ setLabel

void MLWEMPatchWrapper::setLabel ( const QString & label)
slot

Sets the 'label' attribute of this WEMPatch.

◆ setNodeColorAt

void MLWEMPatchWrapper::setNodeColorAt ( int index,
const QVariantList & color )
slot

Sets the color of the node at the given index.

◆ setNodeNormalAt

void MLWEMPatchWrapper::setNodeNormalAt ( int index,
const QVariantList & normal )
slot

Sets the normal of the node at the given index.

◆ setNodePosition

void MLWEMPatchWrapper::setNodePosition ( int index,
const QVariantList & position )
slot

Sets the position of the node at the given index.

◆ translateNodeAt

void MLWEMPatchWrapper::translateNodeAt ( int index,
const QVariantList & offset )
slot

Translates the node at the given index.