MeshLib C++ Docs
Loading...
Searching...
No Matches
MRTeethMaskToDirectionVolume.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVoxelsFwd.h"
4
5#include "MRMesh/MRExpected.h"
6#include "MRVoxelsVolume.h"
8#include "MRMesh/MRphmap.h"
9
10#include <array>
11#include <optional>
12
13namespace MR
14{
17
18
20class DentalId
21{
22public:
24 template <int id>
25 static constexpr DentalId fromFDI()
26 {
27 const int t = id % 10;
28 const int q = id / 10;
29 static_assert( q >= 1 && q <= 4 && t >= 1 && t <= 8 );
30
31 return DentalId( id );
32 }
33
35 MRVOXELS_API static std::optional<DentalId> fromFDI( int id );
36
38 MRVOXELS_API int fdi() const;
39
40 auto operator <=> ( const DentalId& other ) const = default;
41
42private:
43 constexpr explicit DentalId( int fdi ):
44 fdi_( fdi )
45 {}
46
47 int fdi_;
48};
49
50}
51
52template <>
53struct std::hash<MR::DentalId>
54{
55 inline size_t operator() ( const MR::DentalId& id ) const noexcept
56 {
57 return hash<int>{}( id.fdi() );
58 }
59};
60
61namespace MR
62{
63
67class TeethMaskToDirectionVolumeConvertor
68{
69public:
73 MRVOXELS_API static Expected<TeethMaskToDirectionVolumeConvertor> create( const VdbVolume& volume, const std::vector<int>& additionalIds = {} );
74
77
79 using DirectionVolume = std::array<SimpleVolumeMinMax, 3>;
81 {
83 AffineXf3f xf;
84 };
85
88
91
92private:
93 MRVOXELS_API TeethMaskToDirectionVolumeConvertor();
94
95 HashMap<int, Box3i> presentObjects_;
96 SimpleVolume mask_;
97};
98
99
101MRVOXELS_API Expected<std::array<SimpleVolumeMinMax, 3>> teethMaskToDirectionVolume( const VdbVolume& volume, const std::vector<int>& additionalIds = {} );
102
103
104}
#define MRVOXELS_API
see explanation in MRMesh/MRMeshFwd.h
Definition MRVoxelsFwd.h:14
double volume(const MeshTopology &topology, const VertCoords &points, const FaceBitSet *region=nullptr)
auto operator<=>(const DentalId &other) const =default
std::array< SimpleVolumeMinMax, 3 > DirectionVolume
See meshToDirectionVolume for details.
Definition MRTeethMaskToDirectionVolume.h:79
Expected< ProcessResult > convertObject(int id) const
Converts single object into direction volume.
tl::expected< T, E > Expected
Definition MRExpected.h:31
static std::optional< DentalId > fromFDI(int id)
Creates id from FDI number known only at runtime.
Expected< ProcessResult > convertAll() const
Converts all the objects into direction volume.
static Expected< TeethMaskToDirectionVolumeConvertor > create(const VdbVolume &volume, const std::vector< int > &additionalIds={})
phmap::flat_hash_map< K, V, Hash, Eq, Allocator< std::pair< const K, V > > > HashMap
Definition MRMeshFwd.h:631
Expected< std::array< SimpleVolumeMinMax, 3 > > teethMaskToDirectionVolume(const VdbVolume &volume, const std::vector< int > &additionalIds={})
A shortcut for TeethMaskToDirectionVolumeConvertor::create and TeethMaskToDirectionVolumeConvertor::c...
DirectionVolume volume
Definition MRTeethMaskToDirectionVolume.h:82
const HashMap< int, Box3i > & getObjectBounds() const
Returns all the objects present in volume and corresponding bounding boxes.
static constexpr DentalId fromFDI()
Creates id from FDI number known at compile time.
Definition MRTeethMaskToDirectionVolume.h:25
int fdi() const
Returns FDI representation of the id.
AffineXf3f xf
Definition MRTeethMaskToDirectionVolume.h:83
@ other
Angle, normally float. Measure in radians.
Definition MRFeatureObject.h:27
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
Definition MRTeethMaskToDirectionVolume.h:81