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
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{
65
66
71{
72public:
76 MRVOXELS_API static Expected<TeethMaskToDirectionVolumeConvertor> create( const VdbVolume& volume, const std::vector<int>& additionalIds = {} );
77
79 MRVOXELS_API const HashMap<int, Box3i>& getObjectBounds() const;
80
82 using DirectionVolume = std::array<SimpleVolumeMinMax, 3>;
84 {
86 AffineXf3f xf;
87 };
88
90 MRVOXELS_API Expected<ProcessResult> convertObject( int id ) const;
91
93 MRVOXELS_API Expected<ProcessResult> convertAll() const;
94
95private:
97
98 HashMap<int, Box3i> presentObjects_;
99 SimpleVolume mask_;
100};
101
102
104MRVOXELS_API Expected<std::array<SimpleVolumeMinMax, 3>> teethMaskToDirectionVolume( const VdbVolume& volume, const std::vector<int>& additionalIds = {} );
105
106
107}
This class represents tooth id.
Definition MRTeethMaskToDirectionVolume.h:21
Definition MRTeethMaskToDirectionVolume.h:71
static MRVOXELS_API std::optional< DentalId > fromFDI(int id)
Creates id from FDI number known only at runtime.
auto operator<=>(const DentalId &other) const =default
std::array< SimpleVolumeMinMax, 3 > DirectionVolume
See meshToDirectionVolume for details.
Definition MRTeethMaskToDirectionVolume.h:82
MRVOXELS_API Expected< std::array< SimpleVolumeMinMax, 3 > > teethMaskToDirectionVolume(const VdbVolume &volume, const std::vector< int > &additionalIds={})
A shortcut for TeethMaskToDirectionVolumeConvertor::create and TeethMaskToDirectionVolumeConvertor::c...
tl::expected< T, E > Expected
Definition MRExpected.h:31
MRVOXELS_API Expected< ProcessResult > convertObject(int id) const
Converts single object into direction volume.
MRVOXELS_API Expected< ProcessResult > convertAll() const
Converts all the objects into direction volume.
MRMESH_API double volume(const MeshTopology &topology, const VertCoords &points, const FaceBitSet *region=nullptr)
static MRVOXELS_API Expected< TeethMaskToDirectionVolumeConvertor > create(const VdbVolume &volume, const std::vector< int > &additionalIds={})
DirectionVolume volume
Definition MRTeethMaskToDirectionVolume.h:85
MRVOXELS_API int fdi() const
Returns FDI representation of the id.
MRVOXELS_API 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
AffineXf3f xf
Definition MRTeethMaskToDirectionVolume.h:86
@ other
Angle, normally float. Measure in radians.
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRTeethMaskToDirectionVolume.h:84