Volume Cartographer 2.27.0
Private Member Functions | Private Attributes | List of all members
volcart::io::PLYWriter Class Reference
Core » IO

Write an ITKMesh to a PLY file. More...

#include <vc/core/io/PLYWriter.hpp>

Public Member Functions

 PLYWriter ()=default
 Default constructor.
 
 PLYWriter (filesystem::path outputPath, ITKMesh::Pointer mesh)
 Constructor with output path and input mesh.
 
 PLYWriter (filesystem::path outputPath, ITKMesh::Pointer mesh, cv::Mat texture)
 Constructor with output path and textured mesh information.
 
void setPath (const filesystem::path &path)
 Set the output path. More...
 
void setMesh (ITKMesh::Pointer mesh)
 Set the input mesh.
 
void setUVMap (UVMap::Pointer uvMap)
 Set the input UV Map.
 
void setTexture (cv::Mat texture)
 Set texture image.
 
void setVertexColors (const std::vector< std::uint16_t > &c)
 Set per-vertex color information.
 
void write ()
 Write the PLY to disk. More...
 

Private Member Functions

void write_header_ ()
 Write the PLY header.
 
void write_vertices_ ()
 Write the PLY vertices. More...
 
void write_faces_ ()
 Write the PLY faces. More...
 

Private Attributes

filesystem::path outputPath_
 
std::ofstream outputMesh_
 
ITKMesh::Pointer mesh_
 
UVMap::Pointer uvMap_
 
cv::Mat texture_
 
std::vector< std::uint16_t > vcolors_
 

Detailed Description

Write an ITKMesh to a PLY file.

Author
Seth Parker
Date
10/30/15

Writes both textured and untextured meshes in ASCII PLY format. Texture information is automatically written if the volcart::Texture has images and if the UV map is set and is not empty.

Assumes that vertices have vertex normal information.

Definition at line 31 of file PLYWriter.hpp.

Member Function Documentation

◆ setPath()

void volcart::io::PLYWriter::setPath ( const filesystem::path &  path)

Set the output path.

write() and validate() will fail if path does not have an expected file extension (.ply/.PLY).

◆ write()

void volcart::io::PLYWriter::write ( )

Write the PLY to disk.

If UV Map is not empty, automatically writes per-vertex texture information.

Exceptions
volcart::IOException

◆ write_faces_()

void volcart::io::PLYWriter::write_faces_ ( )
private

Write the PLY faces.

Lines are formatted:

[n vertices in face] v1 v2 ... vn

◆ write_vertices_()

void volcart::io::PLYWriter::write_vertices_ ( )
private

Write the PLY vertices.

Lines are formatted:

x y z nx ny nz

Member Data Documentation

◆ mesh_

ITKMesh::Pointer volcart::io::PLYWriter::mesh_
private

Input mesh

Definition at line 85 of file PLYWriter.hpp.

◆ outputMesh_

std::ofstream volcart::io::PLYWriter::outputMesh_
private

Output file stream

Definition at line 83 of file PLYWriter.hpp.

◆ outputPath_

filesystem::path volcart::io::PLYWriter::outputPath_
private

Output file path

Definition at line 81 of file PLYWriter.hpp.

◆ texture_

cv::Mat volcart::io::PLYWriter::texture_
private

Input texture image

Definition at line 89 of file PLYWriter.hpp.

◆ uvMap_

UVMap::Pointer volcart::io::PLYWriter::uvMap_
private

Input UV map

Definition at line 87 of file PLYWriter.hpp.

◆ vcolors_

std::vector<std::uint16_t> volcart::io::PLYWriter::vcolors_
private

Vertex colors

Definition at line 91 of file PLYWriter.hpp.


The documentation for this class was generated from the following file: