MeshLib C++ Docs
Loading...
Searching...
No Matches
MRVoxels/MRVoxelsSave.h
Go to the documentation of this file.
1#pragma once
2#include "MRVoxelsFwd.h"
3#include "MRVoxelPath.h"
4#include "MRVoxelsVolume.h"
5
7
8#include <filesystem>
9
10namespace MR
11{
12
13namespace VoxelsSave
14{
15
18
20MRVOXELS_API Expected<void> toRawAutoname( const VdbVolume& vdbVolume, const std::filesystem::path& file,
21 ProgressCallback callback = {} );
22MRVOXELS_API Expected<void> toRawAutoname( const SimpleVolume& simpleVolume, const std::filesystem::path& file,
23 ProgressCallback callback = {} );
24MRVOXELS_API Expected<void> gridToRawAutoname( const FloatGrid& grid, const Vector3i& dims, const std::filesystem::path& file,
25 ProgressCallback callback = {} );
26
28MRVOXELS_API Expected<void> gridToRawFloat( const FloatGrid& grid, const Vector3i& dims, std::ostream& out, ProgressCallback callback = {} );
29MRVOXELS_API Expected<void> toRawFloat( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
30MRVOXELS_API Expected<void> toRawFloat( const SimpleVolume& simpleVolume, std::ostream & out, ProgressCallback callback = {} );
31
33MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
34MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
35MRVOXELS_API Expected<void> toGav( const SimpleVolumeMinMax& simpleVolumeMinMax, const std::filesystem::path& file, ProgressCallback callback = {} );
36MRVOXELS_API Expected<void> toGav( const SimpleVolumeMinMax& simpleVolumeMinMax, std::ostream & out, ProgressCallback callback = {} );
37MRVOXELS_API Expected<void> toGav( const SimpleVolume& simpleVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
38MRVOXELS_API Expected<void> toGav( const SimpleVolume& simpleVolume, std::ostream & out, ProgressCallback callback = {} );
39
41MRVOXELS_API Expected<void> gridToVdb( const FloatGrid& grid, const std::filesystem::path& file,
42 ProgressCallback callback = {} );
43MRVOXELS_API Expected<void> gridToVdb( const FloatGrid& grid, std::ostream& out,
44 ProgressCallback callback = {} );
45MRVOXELS_API Expected<void> toVdb( const VdbVolume& vdbVolume, const std::filesystem::path& file,
46 ProgressCallback callback = {} );
47
49MRVOXELS_API Expected<void> gridToAnySupportedFormat( const FloatGrid& grid, const Vector3i& dims, const std::filesystem::path& file,
50 ProgressCallback callback = {} );
51MRVOXELS_API Expected<void> toAnySupportedFormat( const VdbVolume& vdbVolume, const std::filesystem::path& file,
52 ProgressCallback callback = {} );
53
55MRVOXELS_API Expected<void> saveSliceToImage( const std::filesystem::path& path, const VdbVolume& vdbVolume, const SlicePlane& slicePlain, int sliceNumber, ProgressCallback callback = {} );
56
57// stores together all data for save voxel object as a group of images
59{
60 // path to directory where you want to save images
61 std::filesystem::path path;
62 // format for file names, you should specify a placeholder for number and extension, eg "slice_{0:0{1}}.tif"
63 std::string format = "slice_{0:0{1}}.tif";
64 // Plane which the object is sliced by. XY, XZ, or YZ
66 // Callback reporting progress
68};
69
71MRVOXELS_API Expected<void> saveAllSlicesToImage( const VdbVolume& vdbVolume, const SavingSettings& settings );
72
74
75#ifndef MR_PARSING_FOR_PB11_BINDINGS
76using VoxelsSaver = Expected<void>( * )( const VdbVolume&, const std::filesystem::path&, ProgressCallback );
77
79#endif
80
81} // namespace VoxelsSave
82
83MRVOXELS_API Expected<void> saveObjectVoxelsToFile( const Object& object, const std::filesystem::path& path,
84 const ProgressCallback& callback = {} );
85
86} // namespace MR
#define MR_FORMAT_REGISTRY_EXTERNAL_DECL(API_ATTR, ProcName)
Definition MRIOFormatsRegistry.h:16
#define MRVOXELS_API
Definition MRVoxels/MRVoxelsFwd.h:13
named object in the data model
Definition MRObject.h:60
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:663
MRVOXELS_API Expected< void > toGav(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels in Gav-format in given destination.
MRVOXELS_API Expected< void > toRawFloat(const VdbVolume &vdbVolume, std::ostream &out, ProgressCallback callback={})
MRVOXELS_API Expected< void > 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
MRVOXELS_API Expected< void > toAnySupportedFormat(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
MRVOXELS_API Expected< void > gridToRawFloat(const FloatGrid &grid, const Vector3i &dims, std::ostream &out, ProgressCallback callback={})
Save voxels in raw format with each value as 32-bit float in given binary stream.
MRVOXELS_API Expected< void > 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
MRVOXELS_API Expected< void > gridToAnySupportedFormat(const FloatGrid &grid, const Vector3i &dims, const std::filesystem::path &file, ProgressCallback callback={})
Saves voxels in a file, detecting the format from file extension.
MRVOXELS_API Expected< void > toRawAutoname(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save raw voxels file, writing parameters in file name.
MRVOXELS_API Expected< void > toVdb(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
MRVOXELS_API Expected< void > gridToVdb(const FloatGrid &grid, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels file in OpenVDB format.
MRVOXELS_API Expected< void > gridToRawAutoname(const FloatGrid &grid, const Vector3i &dims, const std::filesystem::path &file, ProgressCallback callback={})
SlicePlane
Plane of slice in which to find path.
Definition MRVoxelPath.h:29
Expected< void >(*)(const VdbVolume &, const std::filesystem::path &, ProgressCallback) VoxelsSaver
Definition MRVoxels/MRVoxelsSave.h:76
Definition MRCameraOrientationPlugin.h:8
std::shared_ptr< OpenVdbFloatGrid > FloatGrid
Definition MRVoxels/MRVoxelsFwd.h:25
tl::expected< T, E > Expected
Definition MRExpected.h:25
MRVOXELS_API Expected< void > saveObjectVoxelsToFile(const Object &object, const std::filesystem::path &path, const ProgressCallback &callback={})
Definition MRVoxels/MRVoxelsSave.h:59
ProgressCallback cb
Definition MRVoxels/MRVoxelsSave.h:67
SlicePlane slicePlane
Definition MRVoxels/MRVoxelsSave.h:65
std::filesystem::path path
Definition MRVoxels/MRVoxelsSave.h:61
std::string format
Definition MRVoxels/MRVoxelsSave.h:63