MeshLib Documentation
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 = {} );
22MRVOXELS_API Expected<void> toRawAutoname( const SimpleVolume& simpleVolume, const std::filesystem::path& file,
23 ProgressCallback callback = {} );
24
26MRVOXELS_API Expected<void> toRawFloat( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
27MRVOXELS_API Expected<void> toRawFloat( const SimpleVolume& simpleVolume, std::ostream & out, ProgressCallback callback = {} );
28
30MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
31MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
32MRVOXELS_API Expected<void> toGav( const SimpleVolumeMinMax& simpleVolumeMinMax, const std::filesystem::path& file, ProgressCallback callback = {} );
33MRVOXELS_API Expected<void> toGav( const SimpleVolumeMinMax& simpleVolumeMinMax, std::ostream & out, ProgressCallback callback = {} );
34MRVOXELS_API Expected<void> toGav( const SimpleVolume& simpleVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
35MRVOXELS_API Expected<void> toGav( const SimpleVolume& simpleVolume, std::ostream & out, ProgressCallback callback = {} );
36
38MRVOXELS_API Expected<void> toVdb( const VdbVolume& vdbVolume, const std::filesystem::path& file,
39 ProgressCallback callback = {} );
40
42MRVOXELS_API Expected<void> toAnySupportedFormat( const VdbVolume& vdbVolume, const std::filesystem::path& file,
43 ProgressCallback callback = {} );
44
46MRVOXELS_API Expected<void> saveSliceToImage( const std::filesystem::path& path, const VdbVolume& vdbVolume, const SlicePlane& slicePlain, int sliceNumber, ProgressCallback callback = {} );
47
48// stores together all data for save voxel object as a group of images
50{
51 // path to directory where you want to save images
52 std::filesystem::path path;
53 // format for file names, you should specify a placeholder for number and extension, eg "slice_{0:0{1}}.tif"
54 std::string format = "slice_{0:0{1}}.tif";
55 // Plane which the object is sliced by. XY, XZ, or YZ
57 // Callback reporting progress
59};
60
62MRVOXELS_API Expected<void> saveAllSlicesToImage( const VdbVolume& vdbVolume, const SavingSettings& settings );
63
65
66#ifndef MR_PARSING_FOR_PB11_BINDINGS
67using VoxelsSaver = Expected<void>( * )( const VdbVolume&, const std::filesystem::path&, ProgressCallback );
68
70#endif
71
72} // namespace VoxelsSave
73
74MRVOXELS_API Expected<void> saveObjectVoxelsToFile( const Object& object, const std::filesystem::path& path,
75 const ProgressCallback& callback = {} );
76
77} // 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:576
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={})
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:67
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:50
ProgressCallback cb
Definition MRVoxelsSave.h:58
SlicePlane slicePlane
Definition MRVoxelsSave.h:56
std::filesystem::path path
Definition MRVoxelsSave.h:52
std::string format
Definition MRVoxelsSave.h:54