MeshLib C++ Docs
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
16
17namespace VoxelsSave
18{
19
21MRVOXELS_API Expected<void> toRawAutoname( const VdbVolume& vdbVolume, const std::filesystem::path& file,
22 ProgressCallback callback = {} );
23MRVOXELS_API Expected<void> toRawAutoname( const SimpleVolume& simpleVolume, const std::filesystem::path& file,
24 ProgressCallback callback = {} );
25MRVOXELS_API Expected<void> gridToRawAutoname( const FloatGrid& grid, const Vector3i& dims, const std::filesystem::path& file,
26 ProgressCallback callback = {} );
27
29MRVOXELS_API Expected<void> gridToRawFloat( const FloatGrid& grid, const Vector3i& dims, std::ostream& out, ProgressCallback callback = {} );
30MRVOXELS_API Expected<void> toRawFloat( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
31MRVOXELS_API Expected<void> toRawFloat( const SimpleVolume& simpleVolume, std::ostream & out, ProgressCallback callback = {} );
32
34MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
35MRVOXELS_API Expected<void> toGav( const VdbVolume& vdbVolume, std::ostream & out, ProgressCallback callback = {} );
36MRVOXELS_API Expected<void> toGav( const SimpleVolumeMinMax& simpleVolumeMinMax, const std::filesystem::path& file, ProgressCallback callback = {} );
37MRVOXELS_API Expected<void> toGav( const SimpleVolumeMinMax& simpleVolumeMinMax, std::ostream & out, ProgressCallback callback = {} );
38MRVOXELS_API Expected<void> toGav( const SimpleVolume& simpleVolume, const std::filesystem::path& file, ProgressCallback callback = {} );
39MRVOXELS_API Expected<void> toGav( const SimpleVolume& simpleVolume, std::ostream & out, ProgressCallback callback = {} );
40
42MRVOXELS_API Expected<void> gridToVdb( const FloatGrid& grid, const std::filesystem::path& file,
43 ProgressCallback callback = {} );
44MRVOXELS_API Expected<void> gridToVdb( const FloatGrid& grid, std::ostream& out,
45 ProgressCallback callback = {} );
46MRVOXELS_API Expected<void> toVdb( const VdbVolume& vdbVolume, const std::filesystem::path& file,
47 ProgressCallback callback = {} );
48
50MRVOXELS_API Expected<void> gridToAnySupportedFormat( const FloatGrid& grid, const Vector3i& dims, const std::filesystem::path& file,
51 ProgressCallback callback = {} );
52MRVOXELS_API Expected<void> toAnySupportedFormat( const VdbVolume& vdbVolume, const std::filesystem::path& file,
53 ProgressCallback callback = {} );
54
56MRVOXELS_API Expected<void> saveSliceToImage( const std::filesystem::path& path, const VdbVolume& vdbVolume, const SlicePlane& slicePlain, int sliceNumber, ProgressCallback callback = {} );
57
60{
62 std::filesystem::path path;
64 std::string format = "slice_{0:0{1}}.tif";
69};
70
72MRVOXELS_API Expected<void> saveAllSlicesToImage( const VdbVolume& vdbVolume, const SavingSettings& settings );
73
75
76#ifndef MR_PARSING_FOR_ANY_BINDINGS
77using VoxelsSaver = Expected<void>( * )( const VdbVolume&, const std::filesystem::path&, ProgressCallback );
78
80#endif
81
82}
83
84MRVOXELS_API Expected<void> saveObjectVoxelsToFile( const Object& object, const std::filesystem::path& path,
85 const ObjectSave::Settings& settings );
86
88
89}
#define MR_FORMAT_REGISTRY_EXTERNAL_DECL(API_ATTR, ProcName)
Definition MRIOFormatsRegistry.h:18
#define MRVOXELS_API
see explanation in MRMesh/MRMeshFwd.h
Definition MRVoxelsFwd.h:14
wrapper class that helps mrbind to avoid excess MRVDBFloatGrid.h includes
Definition MRFloatGrid.h:21
named object in the data model
Definition MRObject.h:62
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
MRVOXELS_CLASS SimpleVolumeMinMax
Definition MRVoxelsFwd.h:35
tl::expected< T, E > Expected
Definition MRExpected.h:31
SlicePlane
Plane of slice in which to find path.
Definition MRVoxelPath.h:29
Expected< void > saveObjectVoxelsToFile(const Object &object, const std::filesystem::path &path, const ObjectSave::Settings &settings)
Definition MRDicom.h:99
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.
Expected< void > toRawAutoname(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save raw voxels file, writing parameters in file name.
Expected< void > toAnySupportedFormat(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Expected< void > toVdb(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Expected< void >(*)(const VdbVolume &, const std::filesystem::path &, ProgressCallback) VoxelsSaver
Definition MRVoxelsSave.h:77
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
Expected< void > gridToVdb(const FloatGrid &grid, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels file in OpenVDB format.
Expected< void > toRawFloat(const VdbVolume &vdbVolume, std::ostream &out, ProgressCallback callback={})
Expected< void > toGav(const VdbVolume &vdbVolume, const std::filesystem::path &file, ProgressCallback callback={})
Save voxels in Gav-format in given destination.
Expected< void > gridToRawAutoname(const FloatGrid &grid, const Vector3i &dims, const std::filesystem::path &file, ProgressCallback callback={})
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
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.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRObjectSaveSettings.h:27
stores together all data for save voxel object as a group of images
Definition MRVoxelsSave.h:60
ProgressCallback cb
Callback reporting progress.
Definition MRVoxelsSave.h:68
SlicePlane slicePlane
Plane which the object is sliced by. XY, XZ, or YZ.
Definition MRVoxelsSave.h:66
std::filesystem::path path
path to directory where you want to save images
Definition MRVoxelsSave.h:62
std::string format
format for file names, you should specify a placeholder for number and extension, eg "slice_{0:0{1}...
Definition MRVoxelsSave.h:64