ImFusion SDK 4.3
KeypointSet Class Reference

#include <ImFusion/ML/KeypointSet.h>

Class for managing sets of keypoints within a KeypointsElement The class is meant to be used in parallel with SharedImageSet. More...

+ Inheritance diagram for KeypointSet:

Detailed Description

Class for managing sets of keypoints within a KeypointsElement The class is meant to be used in parallel with SharedImageSet.

For each frame in the set, and for each type of keypoint (i.e. body, pedicles, etc..), there is a list of points indicating an instance of that type in the reference image. In terms of tensor dimensions, this would be represented as [N, C, K], where N is the batch size, C is the number of channels (i.e. types of keypoints), and K is the number of keypoints for the same instance type. Each Keypoint is a vec3 having a futher dimension [3].

Note
This class API is experimental and might change soon.

Public Member Functions

 KeypointSet (std::vector< std::vector< std::vector< vec3 > > > data={})
 Constructor from a list of points, the 3 levels of nestedness represent respectively the frame index, the type index and the multiple instances to annotate.
 
 KeypointSet (std::vector< PointCloud > pcls)
 Constructor from PointCloud Each PointCloud in the vector is mapped to the batch index (outermost) of the resulting ML::KeypointSet object.
 
 KeypointSet (PointCloud pcl)
 Constructor from PointCloud The resulting KeypointSet has a single frame, or batch size = 1.
 
 KeypointSet (const KeypointSet &other)=default
 
KeypointSetoperator= (const KeypointSet &other)=default
 
 KeypointSet (KeypointSet &&other) noexcept
 
KeypointSetoperator= (KeypointSet &&other) noexcept
 
ML::Status save (const std::string &path) const
 
Kind kind () const override
 Data interface.
 
Pose::TransformationConvention matrixConvention () const override
 Defines whether the internally stored matrices in derived classes map from or to the world coordinate system.
 
Geometry::AlignedBox bounds () const override
 Returns the axis-aligned bounding box of this data in world space.
 
std::string describe () const override
 Human readable description of the data for showing in the info bar.
 
int size () const override
 
bool empty () const
 Expose some interface of std::vector for convenience.
 
bool operator== (const KeypointSet &other) const
 
bool operator!= (const KeypointSet &other) const
 
auto & at (size_t n)
 
const auto & at (size_t n) const
 
auto & operator[] (size_t n)
 
const auto & operator[] (size_t n) const
 
bool isEqual (const KeypointSet &other) const
 Strict check that two sets are bit-exact identical.
 
bool isApprox (const KeypointSet &other) const
 Eigen-style check that each point in a set is approximately equal to each corresponding point in the other set.
 
std::pair< bool, bool > canBeShownIn2D3D () const
 Returns whether the KeypointSet is probably 2D and/or probably 3D Since some cases might be ambiguous, we return a pair of separate flags for 2D and 3D Note: This function relies on heuristics.
 
- Public Member Functions inherited from Data
 Data (const std::string &name="")
 
 Data (const Data &other)
 
Dataoperator= (const Data &other)
 
virtual ~Data ()
 Mandatory virtual destructor.
 
virtual Modality modality () const
 Return the modality of this data.
 
const std::stringname () const
 Return the name of this data.
 
void setName (const std::string &name)
 Sets the name of this data.
 
virtual bool isAnnotationType () const
 Return whether this data type is visualized through an annotation (e.g. mesh)
 
const DataComponentListcomponents () const
 Returns the list of DataComponents for this data.
 
DataComponentListcomponents ()
 
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.
 
virtual void setMatrix (const mat4 &m)
 Set the transformation matrix.
 
- Public Member Functions inherited from Selectable
 Selectable (const Selectable &)
 
 Selectable (Selectable &&)
 
Selectableoperator= (const Selectable &)
 
Selectableoperator= (Selectable &&)
 
virtual Selection selection () const
 
virtual int focus () const
 
virtual void setSelection (const Selection &sel)
 Set the underlying selection.
 
virtual void setFocus (int index)
 Set focus of the selection.
 

Static Public Member Functions

static std::vector< PointCloudkeypointsToPointClouds (KeypointSet points)
 Converts KeypointSet to a vector of PointCloud A point cloud has a labels member that we use to map the annotation type, but we have no way of mapping the batch index.
 
static KeypointSet pointCloudsToKeypoints (const std::vector< const PointCloud * > &pointClouds)
 Converts a (vector of) PointCloud(s) to a ML::KeypointSet structure Each PointCloud in the vector is mapped to the batch index of the resulting ML::KeypointSet object.
 
static KeypointSet pointCloudsToKeypoints (std::vector< PointCloud > pointClouds)
 
static ML::Status save (const KeypointSet &set, const std::string &path)
 Convenience function wrapping ImFusionFileIoAlgorithm for saving a KeypointSet.
 
static std::optional< KeypointSetload (const std::string &path)
 Convenience function wrapping ImFusionFileIoAlgorithm for loading a KeypointSet.
 
- 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.
 

Public Attributes

std::vector< std::vector< std::vector< vec3 > > > data
 
- 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::stringsignalNameChanged
 Signal emitted when the name changed.
 
- Public Attributes inherited from Selectable
ProtectedSignal signalSelectionChanged
 Signals that the selection or size might have changed.
 

Protected Member Functions

void swapWith (KeypointSet &other)
 
- Protected Member Functions inherited from Data
void swapWith (Data &other)
 Swaps the data and emits a matrix and name changed signal for both.
 

Additional Inherited Members

- 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...
 
- Protected Attributes inherited from Data
mat4 m_matrix
 Transformation matrix.
 
std::recursive_mutexm_matrixMutex
 Used to internally synchronize access to the matrix of data.
 
DataComponentList m_dataComponentList
 The list of DataComponents for this data.
 
- Protected Attributes inherited from Selectable
std::mutex m_selectionMutex
 Mutex protecting the selection.
 
Selection m_sel
 

Member Function Documentation

◆ keypointsToPointClouds()

static std::vector< PointCloud > keypointsToPointClouds ( KeypointSet points)
static

Converts KeypointSet to a vector of PointCloud A point cloud has a labels member that we use to map the annotation type, but we have no way of mapping the batch index.

Thus we put each frame annotation in a separate pointCloud and push it to a vector.

Note
Since points in PointCloud with label values = 0 are rendered in gray in the UI, we use label values starting from 1 (Thus channel = 0 is mapped to label = 1 and so on.)

◆ kind()

Kind kind ( ) const
inlineoverridevirtual

Data interface.

Implements Data.

◆ matrixConvention()

Pose::TransformationConvention matrixConvention ( ) const
inlineoverridevirtual

Defines whether the internally stored matrices in derived classes map from or to the world coordinate system.

Changes the behavior of the default implementations of matrixToWorld and matrixFromWorld.

Implements Data.

◆ bounds()

Geometry::AlignedBox bounds ( ) const
overridevirtual

Returns the axis-aligned bounding box of this data in world space.

Warning
Depending on the underlying data type this calling function may be computationally expensive! Do not call this method more often than needed, unless it is known that the caching behavior is implemented.

Implements Data.

◆ describe()

std::string describe ( ) const
inlineoverridevirtual

Human readable description of the data for showing in the info bar.

Reimplemented from Data.

◆ size()

int size ( ) const
inlineoverridevirtual
Returns
Total number of elements.

Implements Selectable.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close