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{
15
17class DentalId
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 MRVOXELS_API static std::optional<DentalId> fromFDI( int id );
33
35 MRVOXELS_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
64class TeethMaskToDirectionVolumeConvertor
65{
66public:
70 MRVOXELS_API static Expected<TeethMaskToDirectionVolumeConvertor> create( const VdbVolume& volume, const std::vector<int>& additionalIds = {} );
71
73 MRVOXELS_API const HashMap<int, Box3i>& getObjectBounds() const;
74
76 using DirectionVolume = std::array<SimpleVolumeMinMax, 3>;
78 {
79 DirectionVolume volume;
81 };
82
84 MRVOXELS_API Expected<ProcessResult> convertObject( int id ) const;
85
87 MRVOXELS_API Expected<ProcessResult> convertAll() const;
88
89private:
91
92 HashMap<int, Box3i> presentObjects_;
93 SimpleVolume mask_;
94};
95
96
98MRVOXELS_API Expected<std::array<SimpleVolumeMinMax, 3>> teethMaskToDirectionVolume( const VdbVolume& volume, const std::vector<int>& additionalIds = {} );
99
100
101}
#define MRVOXELS_API
Definition MRVoxelsFwd.h:14
Definition MRTeethMaskToDirectionVolume.h:18
unsafe DentalId(MR.Const_DentalId _other)
Definition MRTeethMaskToDirectionVolume.h:65
Definition MRCameraOrientationPlugin.h:8
MRVOXELS_API Expected< std::array< SimpleVolumeMinMax, 3 > > teethMaskToDirectionVolume(const VdbVolume &volume, const std::vector< int > &additionalIds={})
A shortcut for TeethMaskToDirectionVolumeConvertor::create and TeethMaskToDirectionVolumeConvertor::c...
MRMESH_API double volume(const MeshTopology &topology, const VertCoords &points, const FaceBitSet *region=nullptr)
Definition MRTeethMaskToDirectionVolume.h:78
DirectionVolume volume
Definition MRTeethMaskToDirectionVolume.h:79
AffineXf3f xf
Definition MRTeethMaskToDirectionVolume.h:80