MeshLib Documentation
Loading...
Searching...
No Matches
MRVoxelsVolume.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVoxelsFwd.h"
4
5#include "MRMesh/MRVector3.h"
6#include "MRMesh/MRBox.h"
8#include "MRMesh/MRExpected.h"
9#include <limits>
10#include <vector>
11
12namespace MR
13{
14
15template <typename T>
17
18template <typename T>
19struct VoxelTraits<std::vector<T>>
20{
21 using ValueType = T;
22};
23
24template <typename T>
25struct VoxelTraits<VoxelValueGetter<T>>
26{
27 using ValueType = T;
28};
29
30template <>
32{
33 using ValueType = float;
34};
35
37template <typename T>
39{
41
43 Vector3i dims;
44 Vector3f voxelSize{ 1.f, 1.f, 1.f };
45
46 [[nodiscard]] size_t heapBytes() const { return MR::heapBytes( data ); }
47};
48
51template <typename T>
52struct VoxelsVolumeMinMax : VoxelsVolume<T>, MinMax<typename VoxelsVolume<T>::ValueType>
53{
54 using typename VoxelsVolume<T>::ValueType;
55 using VoxelsVolume<T>::data;
56 using VoxelsVolume<T>::dims;
59};
60
61
63MRVOXELS_API Expected<SimpleVolumeMinMax> functionVolumeToSimpleVolume( const FunctionVolume& volume, const ProgressCallback& callback = {} );
64
65} //namespace MR
#define MRVOXELS_API
Definition MRVoxelsFwd.h:13
size_t heapBytes(const std::vector< T > &vec)
returns the amount of memory given vector occupies on heap
Definition MRHeapBytes.h:15
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:576
Definition MRCameraOrientationPlugin.h:8
std::shared_ptr< OpenVdbFloatGrid > FloatGrid
Definition MRVoxelsFwd.h:25
MRVOXELS_API Expected< SimpleVolumeMinMax > functionVolumeToSimpleVolume(const FunctionVolume &volume, const ProgressCallback &callback={})
converts function volume into simple volume
tl::expected< T, E > Expected
Definition MRExpected.h:58
float ValueType
Definition MRVoxelsVolume.h:33
T ValueType
Definition MRVoxelsVolume.h:27
Definition MRVoxelsVolume.h:16
Definition MRVoxelsVolume.h:53
represents a box in 3D space subdivided on voxels stored in T
Definition MRVoxelsVolume.h:39
Vector3f voxelSize
Definition MRVoxelsVolume.h:44
size_t heapBytes() const
Definition MRVoxelsVolume.h:46
T data
Definition MRVoxelsVolume.h:42
Vector3i dims
Definition MRVoxelsVolume.h:43
typename VoxelTraits< T >::ValueType ValueType
Definition MRVoxelsVolume.h:40