Volume Cartographer 2.27.0
OBJWriter.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <cstdint>
6#include <fstream>
7#include <iostream>
8
9#include <opencv2/core.hpp>
10
14
15namespace volcart::io
16{
30{
31
32public:
35 OBJWriter() = default;
36
38 OBJWriter(filesystem::path outputPath, ITKMesh::Pointer mesh);
39
42 filesystem::path outputPath,
43 ITKMesh::Pointer mesh,
44 UVMap::Pointer uvMap,
45 cv::Mat uvImg);
54 void setPath(const filesystem::path& path);
55
57 void setMesh(ITKMesh::Pointer mesh);
58
61
63 void setTexture(cv::Mat uvImg);
64
71 void setTextureFormat(std::string fmt);
81 void write();
84private:
86 filesystem::path outputPath_;
88 std::string textureFmt_{"tif"};
90 std::ofstream outputMesh_;
92 std::ofstream outputMTL_;
93
104 std::map<std::uint32_t, cv::Vec3i> pointLinks_;
105
107 ITKMesh::Pointer mesh_;
111 cv::Mat texture_;
112
119
128};
129
130} // namespace volcart::io
std::shared_ptr< UVMap > Pointer
Definition: UVMap.hpp:55
Write an ITKMesh to an OBJ file.
Definition: OBJWriter.hpp:30
std::ofstream outputMTL_
Definition: OBJWriter.hpp:92
std::string textureFmt_
Definition: OBJWriter.hpp:88
void setUVMap(UVMap::Pointer uvMap)
Set the input UV Map.
OBJWriter(filesystem::path outputPath, ITKMesh::Pointer mesh, UVMap::Pointer uvMap, cv::Mat uvImg)
Constructor with output path and textured mesh information.
std::map< std::uint32_t, cv::Vec3i > pointLinks_
Definition: OBJWriter.hpp:104
void setTexture(cv::Mat uvImg)
Set the input texture image.
void setPath(const filesystem::path &path)
Set the output path.
filesystem::path outputPath_
Definition: OBJWriter.hpp:86
void write()
Write the OBJ to disk.
std::ofstream outputMesh_
Definition: OBJWriter.hpp:90
OBJWriter()=default
Default constructor.
void setMesh(ITKMesh::Pointer mesh)
Set the input mesh.
OBJWriter(filesystem::path outputPath, ITKMesh::Pointer mesh)
Constructor with output path and input mesh.
ITKMesh::Pointer mesh_
Definition: OBJWriter.hpp:107
void setTextureFormat(std::string fmt)
Set the texture image format.
UVMap::Pointer uvMap_
Definition: OBJWriter.hpp:109
IO classes.