MeshLib C++ Docs
Loading...
Searching...
No Matches
MRFloatGrid.h
Go to the documentation of this file.
1#pragma once
2#include "MRVoxelsFwd.h"
3
5
7
8namespace MR
9{
10
16
18
21{
22public:
24 MRVOXELS_API FloatGrid( std::shared_ptr<OpenVdbFloatGrid> ptr );
25
26 MRVOXELS_API void reset() noexcept;
27 MRVOXELS_API void swap( FloatGrid& other ) noexcept;
28 MRVOXELS_API static FloatGrid deepCopy( const FloatGrid& other ) noexcept;
29
31 MRVOXELS_API OpenVdbFloatGrid& operator *() const noexcept;
32 MRVOXELS_API OpenVdbFloatGrid* operator ->() const noexcept;
33
34 MRVOXELS_API explicit operator bool() const noexcept;
35
36 MRVOXELS_API std::shared_ptr<OpenVdbFloatGrid> toVdb() const noexcept;
37
38private:
39 std::shared_ptr<OpenVdbFloatGrid> ptr_;
40};
41
43[[nodiscard]] MRVOXELS_API size_t heapBytes( const FloatGrid& grid );
44
46MRVOXELS_API FloatGrid resampled( const FloatGrid& grid, float voxelScale, ProgressCallback cb = {} );
47
49MRVOXELS_API FloatGrid resampled( const FloatGrid& grid, const Vector3f& voxelScale, ProgressCallback cb = {} );
50
52MRVOXELS_API FloatGrid cropped( const FloatGrid& grid, const Box3i& box, ProgressCallback cb = {} );
53
55[[nodiscard]] MRVOXELS_API size_t countVoxelsWithValuePred( const FloatGrid& grid, const std::function<bool( float )>& pred );
56
58[[nodiscard]] MRVOXELS_API size_t countVoxelsWithValueLess( const FloatGrid& grid, float value );
59
61[[nodiscard]] MRVOXELS_API size_t countVoxelsWithValueGreater( const FloatGrid& grid, float value );
62
64MRVOXELS_API void gaussianFilter( FloatGrid& grid, int width, int iters, ProgressCallback cb = {} );
66
68[[nodiscard]] MRVOXELS_API float getValue( const FloatGrid & grid, const Vector3i & p );
69
72MRVOXELS_API void setValue( FloatGrid& grid, const Vector3i& p, float value );
73
76MRVOXELS_API void setValue( FloatGrid & grid, const VoxelBitSet& region, float value );
77
81[[nodiscard]] MRVOXELS_API Box3i findActiveBounds( const FloatGrid& grid );
82
85MRVOXELS_API void setValues( FloatGrid& grid, const VoxelBitSet& region, const std::vector<float>& values );
86
89
93
97
101
105
109
113
115
116}
constexpr A & operator*=(A &a, B b)
Definition MRImGuiVectorOperators.h:114
constexpr A operator-(A a)
Definition MRImGuiVectorOperators.h:98
constexpr A operator+(A a)
Operators.
Definition MRImGuiVectorOperators.h:97
constexpr auto operator*(A a, B b)
Definition MRImGuiVectorOperators.h:107
constexpr A & operator-=(A &a, B b)
Definition MRImGuiVectorOperators.h:113
constexpr A & operator+=(A &a, B b)
Definition MRImGuiVectorOperators.h:112
#define MRVOXELS_API
see explanation in MRMesh/MRMeshFwd.h
Definition MRVoxelsFwd.h:14
#define MRVOXELS_CLASS
Definition MRVoxelsFwd.h:18
wrapper class that helps mrbind to avoid excess MRVDBFloatGrid.h includes
Definition MRFloatGrid.h:21
void swap(FloatGrid &other) noexcept
void reset() noexcept
OpenVdbFloatGrid * get() const noexcept
static FloatGrid deepCopy(const FloatGrid &other) noexcept
std::shared_ptr< OpenVdbFloatGrid > toVdb() const noexcept
FloatGrid(std::shared_ptr< OpenVdbFloatGrid > ptr)
size_t heapBytes(const BitSet &bs)
returns the amount of memory given BitSet occupies on heap
Definition MRBitSet.h:364
size_t countVoxelsWithValueLess(const FloatGrid &grid, float value)
returns number of voxels in the grid with value less than given
FloatGrid resampled(const FloatGrid &grid, float voxelScale, ProgressCallback cb={})
resample this grid to fit voxelScale
void setValues(FloatGrid &grid, const VoxelBitSet &region, const std::vector< float > &values)
FloatGrid gaussianFiltered(const FloatGrid &grid, int width, int iters, ProgressCallback cb={})
void setValue(FloatGrid &grid, const Vector3i &p, float value)
size_t countVoxelsWithValueGreater(const FloatGrid &grid, float value)
returns number of voxels in the grid with value greater than given
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:753
void gaussianFilter(FloatGrid &grid, int width, int iters, ProgressCallback cb={})
returns grid with gaussian filter applied
size_t countVoxelsWithValuePred(const FloatGrid &grid, const std::function< bool(float)> &pred)
returns number of velxes in the grid with pred(value) == true
void setLevelSetType(FloatGrid &grid)
sets type of this grid as LEVEL SET (for normal flipping)
float getValue(const FloatGrid &grid, const Vector3i &p)
returns the value at given voxel
Box3i findActiveBounds(const FloatGrid &grid)
FloatGrid cropped(const FloatGrid &grid, const Box3i &box, ProgressCallback cb={})
returns cropped grid
auto width(const Box< V > &box)
returns size along x axis
Definition MRBox.h:354
@ other
Angle, normally float. Measure in radians.
Definition MRFeatureObject.h:27
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
this class just hides very complex type of typedef openvdb::FloatGrid
Definition MRVDBFloatGrid.h:22