MeshLib
 
Loading...
Searching...
No Matches
MRVoxelsLoad.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
4#include "MRObject.h"
5#include "MRVoxelsVolume.h"
6#include "MRIOFilters.h"
7#include <filesystem>
8#include "MRExpected.h"
9
10namespace MR
11{
12
13namespace VoxelsLoad
14{
15
19
20MRMESH_API extern const IOFilters Filters;
21
22#ifndef MRMESH_NO_OPENVDB
25MRMESH_API void sortFilesByName( std::vector<std::filesystem::path>& scans );
26
27#if !defined(MRMESH_NO_DICOM)
29{
30 SimpleVolume vol;
31 std::string name;
33};
34
36{
37 VdbVolume vdbVolume;
38 std::string name;
40};
41
43MRMESH_API std::vector<Expected<LoadDCMResult>> loadDCMsFolder( const std::filesystem::path& path,
44 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
46MRMESH_API Expected<LoadDCMResult> loadDCMFolder( const std::filesystem::path& path,
47 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
48
50MRMESH_API std::vector<Expected<DicomVolume>> loadDicomsFolder( const std::filesystem::path& path,
51 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
53MRMESH_API Expected<DicomVolume> loadDicomFolder( const std::filesystem::path& path,
54 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
55
57MRMESH_API std::vector<Expected<LoadDCMResult>> loadDCMFolderTree( const std::filesystem::path& path,
58 unsigned maxNumThreads = 4, const ProgressCallback& cb = {} );
59
61MRMESH_API Expected<DicomVolume> loadDicomFile( const std::filesystem::path& path, const ProgressCallback& cb = {} );
62#endif // MRMESH_NO_DICOM
63
65{
68 bool gridLevelSet{ false };
69 enum class ScalarType
70 {
71 UInt8,
72 Int8,
73 UInt16,
74 Int16,
75 UInt32,
76 Int32,
77 UInt64,
78 Int64,
79 Float32,
80 Float64,
81 Float32_4,
82 Unknown,
83 Count
84 } scalarType{ ScalarType::Float32 };
85};
87MRMESH_API Expected<VdbVolume> fromRaw( const std::filesystem::path& file, const RawParameters& params,
88 const ProgressCallback& cb = {} );
91MRMESH_API Expected<VdbVolume> fromRaw( std::istream& in, const RawParameters& params,
92 const ProgressCallback& cb = {} );
93
98
100MRMESH_API Expected<VdbVolume> fromRaw( const std::filesystem::path& file,
101 const ProgressCallback& cb = {} );
102
104MRMESH_API Expected<std::vector<VdbVolume>> fromVdb( const std::filesystem::path& file,
105 const ProgressCallback& cb = {} );
106
108MRMESH_API Expected<VdbVolume> fromGav( const std::filesystem::path& file, const ProgressCallback& cb = {} );
110MRMESH_API Expected<VdbVolume> fromGav( std::istream& in, const ProgressCallback& cb = {} );
111
112
115 const ProgressCallback& cb = {} );
116
118
119// Determines iso-surface orientation
120enum class GridType
121{
122 // consider values less than iso as outer area
123 DenseGrid = 0,
124 // consider values less than iso as inner area
125 LevelSet = 1
126};
127
128#ifndef MRMESH_NO_TIFF
130{
131 std::filesystem::path dir;
132 Vector3f voxelSize = { 1.0f, 1.0f, 1.0f };
135};
138#endif // MRMESH_NO_TIFF
139
140#endif // MRMESH_NO_OPENVDB
141}
142
143}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:589
std::vector< IOFilter > IOFilters
Definition MRIOFilters.h:23
MRMESH_API std::vector< Expected< DicomVolume > > loadDicomsFolder(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
Loads 3D all volumetric data from DICOM files in a folder.
MRMESH_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.
MRMESH_API Expected< std::vector< VdbVolume > > fromVdb(const std::filesystem::path &file, const ProgressCallback &cb={})
Load all voxel volumes from OpenVDB file.
MRMESH_API Expected< VdbVolume > fromRaw(const std::filesystem::path &file, const RawParameters &params, const ProgressCallback &cb={})
Load raw voxels from file with provided parameters.
MRMESH_API std::vector< Expected< LoadDCMResult > > loadDCMsFolder(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
Loads 3D all volumetric data from DICOM files in a folder.
MRMESH_API Expected< VdbVolume > fromGav(const std::filesystem::path &file, const ProgressCallback &cb={})
Load voxel from Gav-file with micro CT reconstruction.
MRMESH_API Expected< DicomVolume > loadDicomFolder(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
Loads 3D first volumetric data from DICOM files in a folder.
MRMESH_API Expected< DicomVolume > loadDicomFile(const std::filesystem::path &path, const ProgressCallback &cb={})
Loads 3D volumetric data from a single DICOM file.
MRMESH_API Expected< LoadDCMResult > loadDCMFolder(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
Loads 3D first volumetric data from DICOM files in a folder.
MRMESH_API std::vector< Expected< LoadDCMResult > > loadDCMFolderTree(const std::filesystem::path &path, unsigned maxNumThreads=4, const ProgressCallback &cb={})
Loads every subfolder with DICOM volume as new object.
MRMESH_API void sortFilesByName(std::vector< std::filesystem::path > &scans)
MRMESH_API Expected< RawParameters > findRawParameters(std::filesystem::path &file)
MRMESH_API const IOFilters Filters
GridType
Definition MRVoxelsLoad.h:121
MRMESH_API Expected< VdbVolume > loadTiffDir(const LoadingTiffSettings &settings)
Load voxels from a set of TIFF files.
Definition MRCameraOrientationPlugin.h:7
tl::expected< T, E > Expected
Definition MRExpected.h:49
Definition MRVoxelsLoad.h:29
std::string name
Definition MRVoxelsLoad.h:31
AffineXf3f xf
Definition MRVoxelsLoad.h:32
SimpleVolume vol
Definition MRVoxelsLoad.h:30
Definition MRVoxelsLoad.h:36
std::string name
Definition MRVoxelsLoad.h:38
AffineXf3f xf
Definition MRVoxelsLoad.h:39
VdbVolume vdbVolume
Definition MRVoxelsLoad.h:37
Definition MRVoxelsLoad.h:130
GridType gridType
Definition MRVoxelsLoad.h:133
Vector3f voxelSize
Definition MRVoxelsLoad.h:132
std::filesystem::path dir
Definition MRVoxelsLoad.h:131
ProgressCallback cb
Definition MRVoxelsLoad.h:134
Definition MRVoxelsLoad.h:65
bool gridLevelSet
OpenVDB GridClass set as GRID_LEVEL_SET (need to set right surface normals direction)
Definition MRVoxelsLoad.h:68
enum MR::VoxelsLoad::RawParameters::ScalarType Float32
Vector3i dimensions
Definition MRVoxelsLoad.h:66
Vector3f voxelSize
Definition MRVoxelsLoad.h:67
ScalarType
Definition MRVoxelsLoad.h:70
@ Float32_4
the last value from float[4]