MeshLib
 
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"
7#include "MRMesh/MRExpected.h"
8#include <limits>
9#include <vector>
10
11namespace MR
12{
13
14template <typename T>
16
17template <typename T>
18struct VoxelTraits<std::vector<T>>
19{
20 using ValueType = T;
21};
22
23template <typename T>
24struct VoxelTraits<VoxelValueGetter<T>>
25{
26 using ValueType = T;
27};
28
29template <>
31{
32 using ValueType = float;
33};
34
36template <typename T>
38{
40
43 Vector3f voxelSize{ 1.f, 1.f, 1.f };
44
45 [[nodiscard]] size_t heapBytes() const { return MR::heapBytes( data ); }
46};
47
50template <typename T>
52{
53 using typename VoxelsVolume<T>::ValueType;
54 using VoxelsVolume<T>::data;
55 using VoxelsVolume<T>::dims;
58
59 ValueType min = std::numeric_limits<ValueType>::max();
60 ValueType max = std::numeric_limits<ValueType>::lowest();
61};
62
63
65MRVOXELS_API Expected<SimpleVolumeMinMax> functionVolumeToSimpleVolume( const FunctionVolume& volume, const ProgressCallback& callback = {} );
66
67} //namespace MR
#define MRVOXELS_API
Definition MRVoxelsFwd.h:13
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
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:571
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:32
T ValueType
Definition MRVoxelsVolume.h:26
Definition MRVoxelsVolume.h:15
Definition MRVoxelsVolume.h:52
ValueType max
Definition MRVoxelsVolume.h:60
ValueType min
Definition MRVoxelsVolume.h:59
represents a box in 3D space subdivided on voxels stored in T
Definition MRVoxelsVolume.h:38
Vector3f voxelSize
Definition MRVoxelsVolume.h:43
size_t heapBytes() const
Definition MRVoxelsVolume.h:45
T data
Definition MRVoxelsVolume.h:41
Vector3i dims
Definition MRVoxelsVolume.h:42
typename VoxelTraits< T >::ValueType ValueType
Definition MRVoxelsVolume.h:39