MeshLib
 
Loading...
Searching...
No Matches
MRTeethMaskToDirectionVolume.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#ifndef MRMESH_NO_OPENVDB
5#include "MRExpected.h"
6#include "MRVoxelsVolume.h"
7#include "MRAffineXf3.h"
8#include "MRphmap.h"
9
10#include <array>
11#include <optional>
12
13namespace MR
14{
15
18{
19public:
21 template <int id>
22 static constexpr DentalId fromFDI()
23 {
24 const int t = id % 10;
25 const int q = id / 10;
26 static_assert( q >= 1 && q <= 4 && t >= 1 && t <= 8 );
27
28 return DentalId( id );
29 }
30
32 MRMESH_API static std::optional<DentalId> fromFDI( int id );
33
35 MRMESH_API int fdi() const;
36
37 auto operator <=> ( const DentalId& other ) const = default;
38
39private:
40 constexpr explicit DentalId( int fdi ):
41 fdi_( fdi )
42 {}
43
44 int fdi_;
45};
46
47}
48
49template <>
50struct std::hash<MR::DentalId>
51{
52 inline size_t operator() ( const MR::DentalId& id ) const noexcept
53 {
54 return hash<int>{}( id.fdi() );
55 }
56};
57
58namespace MR
59{
60
93
94}
95#endif
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
This class represents tooth id.
Definition MRTeethMaskToDirectionVolume.h:18
static MRMESH_API std::optional< DentalId > fromFDI(int id)
Creates id from FDI number known only at runtime.
auto operator<=>(const DentalId &other) const =default
MRMESH_API int fdi() const
Returns FDI representation of the id.
static constexpr DentalId fromFDI()
Creates id from FDI number known at compile time.
Definition MRTeethMaskToDirectionVolume.h:22
Definition MRTeethMaskToDirectionVolume.h:65
std::array< SimpleVolume, 3 > DirectionVolume
See meshToDirectionVolume for details.
Definition MRTeethMaskToDirectionVolume.h:74
MRMESH_API Expected< ProcessResult > convertAll() const
Converts all the teeth into direction volume.
MRMESH_API Expected< ProcessResult > convertTooth(DentalId id) const
Converts single tooth into direction volume.
MRMESH_API const HashMap< DentalId, Box3i > & getToothBounds() const
Returns all the teeth present in volume and corresponding bounding boxes.
static MRMESH_API Expected< TeethMaskToDirectionVolumeConvertor > create(const VdbVolume &volume)
Initialize class.
Definition MRCameraOrientationPlugin.h:7
tl::expected< T, E > Expected
Definition MRExpected.h:49
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:450
Definition MRTeethMaskToDirectionVolume.h:76
DirectionVolume volume
Definition MRTeethMaskToDirectionVolume.h:77
AffineXf3f xf
Definition MRTeethMaskToDirectionVolume.h:78