MeshLib
 
Loading...
Searching...
No Matches
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 = {} );
22
24MRVOXELS_API Expected<void> toRawFloat( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
25
27MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
29MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
30
32MRVOXELS_API Expected<void> toVdb( const VdbVolume& vdbVolume, const std::filesystem::path& file,
33 ProgressCallback callback = {} );
34
36MRVOXELS_API Expected<void> toAnySupportedFormat( const VdbVolume& vdbVolume, const std::filesystem::path& file,
37 ProgressCallback callback = {} );
38
40MRVOXELS_API Expected<void> saveSliceToImage( const std::filesystem::path& path, const VdbVolume& vdbVolume, const SlicePlane& slicePlain, int sliceNumber, ProgressCallback callback = {} );
41
42// stores together all data for save voxel object as a group of images
44{
45 // path to directory where you want to save images
46 std::filesystem::path path;
47 // format for file names, you should specify a placeholder for number and extension, eg "slice_{0:0{1}}.tif"
48 std::string format = "slice_{0:0{1}}.tif";
49 // Plane which the object is sliced by. XY, XZ, or YZ
51 // Callback reporting progress
53};
54
56MRVOXELS_API Expected<void> saveAllSlicesToImage( const VdbVolume& vdbVolume, const SavingSettings& settings );
57
59
60#ifndef MR_PARSING_FOR_PB11_BINDINGS
61using VoxelsSaver = Expected<void>( * )( const VdbVolume&, const std::filesystem::path&, ProgressCallback );
62
64#endif
65
66} // namespace VoxelsSave
67
68MRVOXELS_API Expected<void> saveObjectVoxelsToFile( const Object& object, const std::filesystem::path& path,
69 const ProgressCallback& callback = {} );
70
71} // namespace MR
#define MR_FORMAT_REGISTRY_EXTERNAL_DECL(API_ATTR, ProcName)
Definition MRIOFormatsRegistry.h:14
#define MRVOXELS_API
Definition MRVoxelsFwd.h:13
named object in the data model
Definition MRObject.h:60
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:571
MRVOXELS_API Expected< void > toGav(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels in Gav-format in given file.
MRVOXELS_API Expected< void > 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.
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={})
Saves voxels in a file, detecting the format from file extension.
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 > 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={})
Save voxels file in OpenVDB format.
SlicePlane
Plane of slice in which to find path.
Definition MRVoxelPath.h:29
Expected< void >(*)(const VdbVolume &, const std::filesystem::path &, ProgressCallback) VoxelsSaver
Definition MRVoxelsSave.h:61
Definition MRCameraOrientationPlugin.h:8
tl::expected< T, E > Expected
Definition MRExpected.h:58
MRVOXELS_API Expected< void > saveObjectVoxelsToFile(const Object &object, const std::filesystem::path &path, const ProgressCallback &callback={})
Definition MRVoxelsSave.h:44
ProgressCallback cb
Definition MRVoxelsSave.h:52
SlicePlane slicePlane
Definition MRVoxelsSave.h:50
std::filesystem::path path
Definition MRVoxelsSave.h:46
std::string format
Definition MRVoxelsSave.h:48