MeshLib Documentation
Loading...
Searching...
No Matches
MRVoxelsLoad.h
Go to the documentation of this file.
1#pragma once
2#include "MRVoxelsFwd.h"
3#include "MRScalarConvert.h"
4#include "MRVoxelsVolume.h"
5
7#include "MRMesh/MRObject.h"
8
9#include <filesystem>
10
11namespace MR
12{
13
14namespace VoxelsLoad
15{
16
20
29MRVOXELS_API Expected<VdbVolume> fromRaw( const std::filesystem::path& file, const RawParameters& params,
30 const ProgressCallback& cb = {} );
33MRVOXELS_API Expected<VdbVolume> fromRaw( std::istream& in, const RawParameters& params,
34 const ProgressCallback& cb = {} );
35
40
42MRVOXELS_API Expected<VdbVolume> fromRaw( const std::filesystem::path& file,
43 const ProgressCallback& cb = {} );
44
46MRVOXELS_API Expected<std::vector<VdbVolume>> fromVdb( const std::filesystem::path& file,
47 const ProgressCallback& cb = {} );
48
50MRVOXELS_API Expected<VdbVolume> fromGav( const std::filesystem::path& file, const ProgressCallback& cb = {} );
52MRVOXELS_API Expected<VdbVolume> fromGav( std::istream& in, const ProgressCallback& cb = {} );
53
54
57 const ProgressCallback& cb = {} );
58
60
61// Determines iso-surface orientation
62enum class GridType
63{
64 // consider values less than iso as outer area
65 DenseGrid = 0,
66 // consider values less than iso as inner area
67 LevelSet = 1
68};
69
70#ifndef MRVOXELS_NO_TIFF
72{
73 std::filesystem::path dir;
74 Vector3f voxelSize = { 1.0f, 1.0f, 1.0f };
77};
80#endif // MRVOXELS_NO_TIFF
81
82#ifndef MR_PARSING_FOR_PB11_BINDINGS
83using VoxelsLoader = Expected<std::vector<VdbVolume>>( * )( const std::filesystem::path&, const ProgressCallback& );
84
86#endif
87
88}
89
92
93MRVOXELS_API Expected<std::vector<std::shared_ptr<Object>>> makeObjectFromVoxelsFile( const std::filesystem::path& file, std::string* warnings = nullptr, ProgressCallback callback = {} );
94
95}
#define MR_FORMAT_REGISTRY_EXTERNAL_DECL(API_ATTR, ProcName)
Definition MRIOFormatsRegistry.h:14
#define MRVOXELS_API
Definition MRVoxelsFwd.h:13
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
MRVOXELS_API Expected< std::vector< VdbVolume > > fromAnySupportedFormat(const std::filesystem::path &file, const ProgressCallback &cb={})
Detects the format from file extension and loads voxels from it.
MRVOXELS_API Expected< RawParameters > findRawParameters(std::filesystem::path &file)
MRVOXELS_API Expected< VdbVolume > fromGav(const std::filesystem::path &file, const ProgressCallback &cb={})
Load voxel from Gav-file with micro CT reconstruction.
MRVOXELS_API Expected< VdbVolume > fromRaw(const std::filesystem::path &file, const RawParameters &params, const ProgressCallback &cb={})
Load raw voxels from file with provided parameters.
MRVOXELS_API Expected< std::vector< VdbVolume > > fromVdb(const std::filesystem::path &file, const ProgressCallback &cb={})
Load all voxel volumes from OpenVDB file.
MRVOXELS_API Expected< VdbVolume > loadTiffDir(const LoadingTiffSettings &settings)
Load voxels from a set of TIFF files.
GridType
Definition MRVoxelsLoad.h:63
Expected< std::vector< VdbVolume > >(*)(const std::filesystem::path &, const ProgressCallback &) VoxelsLoader
Definition MRVoxelsLoad.h:83
Definition MRCameraOrientationPlugin.h:8
MRVOXELS_API Expected< std::vector< std::shared_ptr< Object > > > makeObjectFromVoxelsFile(const std::filesystem::path &file, std::string *warnings=nullptr, ProgressCallback callback={})
ScalarType
scalar value's binary format type
Definition MRScalarConvert.h:10
tl::expected< T, E > Expected
Definition MRExpected.h:58
MRVOXELS_API Expected< std::vector< std::shared_ptr< ObjectVoxels > > > makeObjectVoxelsFromFile(const std::filesystem::path &file, ProgressCallback callback={})
loads voxels from given file in new object
Definition MRVoxelsLoad.h:72
GridType gridType
Definition MRVoxelsLoad.h:75
Vector3f voxelSize
Definition MRVoxelsLoad.h:74
std::filesystem::path dir
Definition MRVoxelsLoad.h:73
ProgressCallback cb
Definition MRVoxelsLoad.h:76
Definition MRVoxelsLoad.h:22
bool gridLevelSet
OpenVDB GridClass set as GRID_LEVEL_SET (need to set right surface normals direction)
Definition MRVoxelsLoad.h:25
ScalarType scalarType
Definition MRVoxelsLoad.h:26
Vector3i dimensions
Definition MRVoxelsLoad.h:23
Vector3f voxelSize
Definition MRVoxelsLoad.h:24