TTK
Loading...
Searching...
No Matches
Functions
ttkPersistenceDiagramUtils.cpp File Reference
#include <ttkMacros.h>
#include <ttkPersistenceDiagramUtils.h>
#include <ttkUtils.h>
#include <vtkCellData.h>
#include <vtkDoubleArray.h>
#include <vtkFloatArray.h>
#include <vtkPointData.h>
#include <vtkThreshold.h>
#include <vtkTransform.h>
#include <vtkTransformFilter.h>
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkVersionMacros.h>

Go to the source code of this file.

Functions

int VTUToDiagram (ttk::DiagramType &diagram, vtkUnstructuredGrid *vtu, const ttk::Debug &dbg)
 Converts a Persistence Diagram in the VTK Unstructured Grid format (as generated by the ttkPersistenceDiagram module) to the ttk::DiagramType format.
 
int DiagramToVTU (vtkUnstructuredGrid *vtu, const ttk::DiagramType &diagram, vtkDataArray *const inputScalars, const ttk::Debug &dbg, const int dim, const bool embedInDomain)
 Converts a Persistence Diagram in the ttk::DiagramType format to the VTK Unstructured Grid format (as generated by the ttkPersistenceDiagram module).
 
int ProjectDiagramInsideDomain (vtkUnstructuredGrid *const inputDiagram, vtkUnstructuredGrid *const outputDiagram, const ttk::Debug &dbg)
 Generate the spatial embedding of a given Persistence Diagram.
 
template<typename dataType >
void getCoords (vtkPoints *points, const dataType *const births, const dataType *const perss, vtkIdType nPoints, const int nThreads)
 
int ProjectDiagramIn2D (vtkUnstructuredGrid *const inputDiagram, vtkUnstructuredGrid *const outputDiagram, const ttk::Debug &dbg)
 Generate the 2D embedding of a given Persistence Diagram.
 
int TranslateDiagram (vtkUnstructuredGrid *const diagram, const std::array< double, 3 > &trans)
 Translate a diagram to a new position.
 
int ResetDiagramPosition (vtkUnstructuredGrid *const diagram, const ttk::Debug &dbg)
 Translate back a canonical diagram into its original position.
 

Function Documentation

◆ DiagramToVTU()

int DiagramToVTU ( vtkUnstructuredGrid *  vtu,
const ttk::DiagramType diagram,
vtkDataArray *const  inputScalars,
const ttk::Debug dbg,
const int  dim,
const bool  embedInDomain 
)

Converts a Persistence Diagram in the ttk::DiagramType format to the VTK Unstructured Grid format (as generated by the ttkPersistenceDiagram module).

Parameters
[out]vtuOutput VTK Unstructured Grid
[in]diagramVector of persistence pairs
[in]inputScalarsvtkDataArray pointer to input scalar field
[in]dbgReference to a ttk::Debug instance (for error messages)
[in]dimData-set dimensionality (to convert pair dimension to pair type)
[in]embedInDomainSwitch between the canonical and the embedded representation
Returns
0 in case of success, negative number otherwise

Definition at line 156 of file ttkPersistenceDiagramUtils.cpp.

◆ getCoords()

template<typename dataType >
void getCoords ( vtkPoints *  points,
const dataType *const  births,
const dataType *const  perss,
vtkIdType  nPoints,
const int  nThreads 
)

Definition at line 348 of file ttkPersistenceDiagramUtils.cpp.

◆ ProjectDiagramIn2D()

int ProjectDiagramIn2D ( vtkUnstructuredGrid *const  inputDiagram,
vtkUnstructuredGrid *const  outputDiagram,
const ttk::Debug dbg 
)

Generate the 2D embedding of a given Persistence Diagram.

Use the cellData arrays Birth and Death to project the Diagram

Parameters
[in]inputDiagramInput diagram in its spatial embedding form
[out]outputDiagramProjected diagram in its canonical form
[in]dbgDebug instance (for logging and access to threadNumber_)
Returns
0 in case of success

Definition at line 375 of file ttkPersistenceDiagramUtils.cpp.

◆ ProjectDiagramInsideDomain()

int ProjectDiagramInsideDomain ( vtkUnstructuredGrid *const  inputDiagram,
vtkUnstructuredGrid *const  outputDiagram,
const ttk::Debug dbg 
)

Generate the spatial embedding of a given Persistence Diagram.

Use the pointData array Coordinates to project the Diagram

Parameters
[in]inputDiagramInput diagram in its canonical form
[out]outputDiagramProjected diagram inside the input domain
[in]dbgDebug instance (for logging and access to threadNumber_)
Returns
0 in case of success

Definition at line 302 of file ttkPersistenceDiagramUtils.cpp.

◆ ResetDiagramPosition()

int ResetDiagramPosition ( vtkUnstructuredGrid *const  diagram,
const ttk::Debug dbg 
)

Translate back a canonical diagram into its original position.

Use the cellData array Birth as original coordinates

Parameters
[in,out]diagramInput diagram in its spatial embedding form
[in]dbgDebug instance (for logging and access to threadNumber_)
Returns
0 in case of success

Definition at line 467 of file ttkPersistenceDiagramUtils.cpp.

◆ TranslateDiagram()

int TranslateDiagram ( vtkUnstructuredGrid *const  diagram,
const std::array< double, 3 > &  trans 
)

Translate a diagram to a new position.

Parameters
[in,out]diagramInput diagram in its spatial embedding form
[in]transTranslation vector
Returns
0 in case of success

Definition at line 448 of file ttkPersistenceDiagramUtils.cpp.

◆ VTUToDiagram()

int VTUToDiagram ( ttk::DiagramType diagram,
vtkUnstructuredGrid *  vtu,
const ttk::Debug dbg 
)

Converts a Persistence Diagram in the VTK Unstructured Grid format (as generated by the ttkPersistenceDiagram module) to the ttk::DiagramType format.

Parameters
[out]diagramVector to be filled with persistence pairs
[in]vtuInput VTK Unstructured Grid
[in]dbgReference to a ttk::Debug instance (for error messages)
Returns
0 in case of success, negative number otherwise

Definition at line 16 of file ttkPersistenceDiagramUtils.cpp.