CGAL 6.2 - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
CGAL::Homological_discrete_vector_field::Cub_object_io< Traits > Class Template Reference

#include <CGAL/HDVF/Cub_object_io.h>

Definition

template<typename Traits>
class CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >

The class Cub_object_io is an intermediate IO class, used to load binary volumes and produce cubical complexes.

Public Member Functions

 Cub_object_io ()
 Default constructor.
 
 Cub_object_io (int d, const std::vector< IOCubCellType > &vcubs, bool khal=false)
 Constructor from a vector of cells.
 
 Cub_object_io (const Cub_object_io &m)
 
void clear_cubs ()
 Removes all cells of the list.
 
void add_cub (const IOCubCellType &c)
 Adds a cell to the list.
 
void frame ()
 Adds one empty cell of higher dimension all around the complex.
 
bool read_pgm (const std::string &filename, bool khal=false)
 Imports a PGM file (PGM version 2).
 
bool read_cub (const std::string &filename, bool khalimsky=false)
 Imports a CUB file.
 
void print_infos (size_t level=0) const
 Prints synthetic informations related to the object.
 

Public Attributes

int dim = 0
 Dimension of the complex.
 
std::vector< size_t > ncubs
 Number of cubs in each dimension.
 
std::vector< size_t > N
 Size of the bounding box along each dimension.
 
std::vector< IOCubCellTypecubs
 List of cubs in each dimension.
 
bool khalimsky
 Khalimsky or coordinates mode.
 

Constructor & Destructor Documentation

◆ Cub_object_io() [1/2]

template<typename Traits >
CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >::Cub_object_io ( )

Default constructor.

Create an empty Cub_object_io of dimension 3.

◆ Cub_object_io() [2/2]

template<typename Traits >
CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >::Cub_object_io ( int  d,
const std::vector< IOCubCellType > &  vcubs,
bool  khal = false 
)

Constructor from a vector of cells.

Cells coordinates are given in Khalimsky coordinates if the boolean khal is true, or as integer coordinates of voxels of dimension dim otherwise.

Member Function Documentation

◆ frame()

template<typename Traits >
void CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >::frame ( )

Adds one empty cell of higher dimension all around the complex.

The function enlarges the bounding box with 1 cell of higher dimension on each of its sides. Cubs coordinates are shifted accordingly.

◆ read_cub()

template<typename Traits >
bool CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >::read_cub ( const std::string &  filename,
bool  khalimsky = false 
)

Imports a CUB file.

Parameters
filenameName of the CUB file (cells are described in Khalimsky coordinates).
khalimskyIf true, Khalimsky coordinates are loaded in cubs (for PRIMAL construction of a cubical complex), otherwise, checks that all cells provided are of maximal dimension and load the integer coordinates of voxels in cubs(for DUAL construction).
Exceptions
File_not_foundIf `filename` does not exist, raise a `std::runtime_error` exception.
Incoherent_dimensionRaises a `std::runtime_error` if dimensions of the `Traits` and of the CUB file do not match.
Incoherent_cellA `std::runtime_error` is raised if `khalimsky` is false but a cell of non-maximal dimension is encoutered.

◆ read_pgm()

template<typename Traits >
bool CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >::read_pgm ( const std::string &  filename,
bool  khal = false 
)

Imports a PGM file (PGM version 2).

Parameters
filenameName of the PGM file.
khalIf true, Khalimsky coordinates of voxels are stored in cubs (for PRIMAL construction of a cubical complex), otherwise, integer coordinates of voxels are stored in cubs(for DUAL construction).
Exceptions
File_not_foundIf `filename` does not exist, raise a `std::runtime_error` exception.
Incoherent_dimensionRaises a `std::runtime_error` if dimensions of the `Traits` of the PGM file do not match.

Member Data Documentation

◆ khalimsky

template<typename Traits >
bool CGAL::Homological_discrete_vector_field::Cub_object_io< Traits >::khalimsky

Khalimsky or coordinates mode.

If true, cubs contains cubical cells encoded with Khalismky coordinates, if false, cubs contains voxel coordinates (i.e. cells of dimension dim).