MeshLib C++ Docs
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"
9
10#include <filesystem>
11
12namespace MR
13{
14
15namespace VoxelsLoad
16{
17
21
22struct RawParameters
23{
24 Vector3i dimensions;
25 Vector3f voxelSize;
26 bool gridLevelSet{ false };
27 ScalarType scalarType{ ScalarType::Float32 };
28};
30MRVOXELS_API Expected<VdbVolume> fromRaw( const std::filesystem::path& file, const RawParameters& params,
31 const ProgressCallback& cb = {} );
34MRVOXELS_API Expected<VdbVolume> fromRaw( std::istream& in, const RawParameters& params,
35 const ProgressCallback& cb = {} );
36
38MRVOXELS_API Expected<FloatGrid> gridFromRaw( const std::filesystem::path& file, const RawParameters& params,
39 const ProgressCallback& cb = {} );
40
43MRVOXELS_API Expected<FloatGrid> gridFromRaw( std::istream& in, const RawParameters& params,
44 const ProgressCallback& cb = {} );
45
49MRVOXELS_API Expected<RawParameters> findRawParameters( std::filesystem::path& file );
50
52MRVOXELS_API Expected<VdbVolume> fromRaw( const std::filesystem::path& file,
53 const ProgressCallback& cb = {} );
54
56MRVOXELS_API Expected<FloatGrid> gridFromRaw( const std::filesystem::path& file,
57 const ProgressCallback& cb = {} );
58
60MRVOXELS_API Expected<std::vector<VdbVolume>> fromVdb( const std::filesystem::path& file,
61 const ProgressCallback& cb = {} );
62
63MRVOXELS_API Expected<std::vector<FloatGrid>> gridsFromVdb( const std::filesystem::path& file,
64 const ProgressCallback& cb = {} );
65MRVOXELS_API Expected<std::vector<FloatGrid>> gridsFromVdb( std::istream& in,
66 const ProgressCallback& cb = {} );
67
68
70MRVOXELS_API Expected<VdbVolume> fromGav( const std::filesystem::path& file, const ProgressCallback& cb = {} );
72MRVOXELS_API Expected<VdbVolume> fromGav( std::istream& in, const ProgressCallback& cb = {} );
73
74
76MRVOXELS_API Expected<std::vector<FloatGrid>> gridsFromAnySupportedFormat( const std::filesystem::path& file,
77 const ProgressCallback& cb = {} );
78
80MRVOXELS_API Expected<std::vector<VdbVolume>> fromAnySupportedFormat( const std::filesystem::path& file,
81 const ProgressCallback& cb = {} );
82
84
85// Determines iso-surface orientation
86enum class GridType
87{
88 // consider values less than iso as outer area
89 DenseGrid = 0,
90 // consider values less than iso as inner area
91 LevelSet = 1
92};
93
94#ifndef MRVOXELS_NO_TIFF
95struct LoadingTiffSettings
96{
97 std::filesystem::path dir;
98 Vector3f voxelSize = { 1.0f, 1.0f, 1.0f };
99 GridType gridType = GridType::DenseGrid;
100 ProgressCallback cb = {};
101};
103MRVOXELS_API Expected<VdbVolume> loadTiffDir( const LoadingTiffSettings& settings );
104#endif // MRVOXELS_NO_TIFF
105
106#ifndef MR_PARSING_FOR_ANY_BINDINGS
107using VoxelsLoader = Expected<std::vector<VdbVolume>>( * )( const std::filesystem::path&, const ProgressCallback& );
108
110#endif
111
112}
113
115MRVOXELS_API Expected<std::vector<std::shared_ptr<ObjectVoxels>>> makeObjectVoxelsFromFile( const std::filesystem::path& file, ProgressCallback callback = {} );
116
117MRVOXELS_API Expected<LoadedObjects> makeObjectFromVoxelsFile( const std::filesystem::path& file, const ProgressCallback& callback = {} );
118
119}
#define MR_FORMAT_REGISTRY_EXTERNAL_DECL(API_ATTR, ProcName)
Definition MRIOFormatsRegistry.h:18
#define MRVOXELS_API
Definition MRVoxelsFwd.h:14
Definition MRVoxelsLoad.h:96
Definition MRVoxelsLoad.h:23
new unsafe ref MR.Vector3f voxelSize
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< std::vector< FloatGrid > > gridsFromVdb(const std::filesystem::path &file, const ProgressCallback &cb={})
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< FloatGrid > gridFromRaw(const std::filesystem::path &file, const RawParameters &params, const ProgressCallback &cb={})
Load raw voxels from file with provided parameters.
MRVOXELS_API Expected< std::vector< FloatGrid > > gridsFromAnySupportedFormat(const std::filesystem::path &file, const ProgressCallback &cb={})
Detects the format from file extension and loads voxels from it.
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.
Definition MRCameraOrientationPlugin.h:8
MRVOXELS_API Expected< LoadedObjects > makeObjectFromVoxelsFile(const std::filesystem::path &file, const ProgressCallback &callback={})
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