MeshLib
 
Loading...
Searching...
No Matches
MRVoxelsSave.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRIOFilters.h"
4#include "MRExpected.h"
6#include "MRVoxelPath.h"
7#include "MRVoxelsVolume.h"
8#include <filesystem>
9
11{
12
15
16MRMESH_API extern const IOFilters Filters;
17
18#ifndef MRMESH_NO_OPENVDB
19
21MRMESH_API VoidOrErrStr toRawAutoname( const VdbVolume& vdbVolume, const std::filesystem::path& file,
22 ProgressCallback callback = {} );
23
25MRMESH_API VoidOrErrStr toRawFloat( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
26
28MRMESH_API VoidOrErrStr toGav( const VdbVolume& vdbVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
30MRMESH_API VoidOrErrStr toGav( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
31
33MRMESH_API VoidOrErrStr toVdb( const VdbVolume& vdbVolume, const std::filesystem::path& file,
34 ProgressCallback callback = {} );
35
37MRMESH_API VoidOrErrStr toAnySupportedFormat( const VdbVolume& vdbVolume, const std::filesystem::path& file,
38 ProgressCallback callback = {} );
39
41MRMESH_API VoidOrErrStr saveSliceToImage( const std::filesystem::path& path, const VdbVolume& vdbVolume, const SlicePlane& slicePlain, int sliceNumber, ProgressCallback callback = {} );
42
43// stores together all data for save voxel object as a group of images
45{
46 // path to directory where you want to save images
47 std::filesystem::path path;
48 // format for file names, you should specify a placeholder for number and extension, eg "slice_{0:0{1}}.tif"
49 std::string format = "slice_{0:0{1}}.tif";
50 // Plane which the object is sliced by. XY, XZ, or YZ
52 // Callback reporting progress
54};
55
57MRMESH_API VoidOrErrStr saveAllSlicesToImage( const VdbVolume& vdbVolume, const SavingSettings& settings );
58
59#endif
60
62
63}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:589
std::vector< IOFilter > IOFilters
Definition MRIOFilters.h:23
MRMESH_API VoidOrErrStr toRawFloat(const VdbVolume &vdbVolume, std::ostream &out, ProgressCallback callback={})
Save voxels in raw format with each value as 32-bit float in given binary stream.
MRMESH_API VoidOrErrStr saveSliceToImage(const std::filesystem::path &path, const VdbVolume &vdbVolume, const SlicePlane &slicePlain, int sliceNumber, ProgressCallback callback={})
save the slice by the active plane through the sliceNumber to an image file
MRMESH_API VoidOrErrStr toVdb(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels file in OpenVDB format.
MRMESH_API VoidOrErrStr saveAllSlicesToImage(const VdbVolume &vdbVolume, const SavingSettings &settings)
save all slices by the active plane through all voxel planes along the active axis to an image file
MRMESH_API VoidOrErrStr toAnySupportedFormat(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Saves voxels in a file, detecting the format from file extension.
MRMESH_API VoidOrErrStr toGav(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels in Gav-format in given file.
MRMESH_API const IOFilters Filters
MRMESH_API VoidOrErrStr toRawAutoname(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save raw voxels file, writing parameters in file name.
SlicePlane
Plane of slice in which to find path.
Definition MRVoxelPath.h:29
Definition MRVoxelsSave.h:11
Expected< void > VoidOrErrStr
return type for a void function that can produce an error string
Definition MRExpected.h:60
Definition MRVoxelsSave.h:45
ProgressCallback cb
Definition MRVoxelsSave.h:53
SlicePlane slicePlane
Definition MRVoxelsSave.h:51
std::filesystem::path path
Definition MRVoxelsSave.h:47
std::string format
Definition MRVoxelsSave.h:49