MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / create

Method create

source/MRVoxels/MRTeethMaskToDirectionVolume.cpp:63–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63Expected<TeethMaskToDirectionVolumeConvertor>
64 TeethMaskToDirectionVolumeConvertor::create( const MR::VdbVolume& volume,
65 const std::vector<int>& additionalIds )
66{
67 auto maybeSimpleVolume = vdbVolumeToSimpleVolume( volume );
68 if ( !maybeSimpleVolume )
69 return unexpected( std::move( maybeSimpleVolume.error() ) );
70
71 TeethMaskToDirectionVolumeConvertor res;
72 res.mask_ = std::move( *maybeSimpleVolume );
73
74 HashSet<int> ids;
75 for ( int i = 0; i < 49; ++i )
76 if ( DentalId::fromFDI( i ) )
77 ids.insert( i );
78 for ( int i : additionalIds )
79 ids.insert( i );
80
81 HashSet<int> present;
82 HashMap<int, Box3i> bounds;
83 forEachInSimpleVolume( res.mask_, [&ids, &present, &bounds] ( const Vector3i& pos, float val )
84 {
85 const int vali = static_cast<int>( val );
86 if ( ids.contains( vali ) )
87 {
88 present.insert( vali );
89 bounds[vali].include( pos );
90 }
91 } );
92
93 for ( int i : ids )
94 {
95 if ( present.contains( i ) )
96 {
97 res.presentObjects_[i] = bounds[i];
98 }
99 }
100
101 return res;
102}
103
104Expected<TeethMaskToDirectionVolumeConvertor::ProcessResult> TeethMaskToDirectionVolumeConvertor::convertObject( int id ) const
105{

Callers

nothing calls this directly

Calls 7

vdbVolumeToSimpleVolumeFunction · 0.85
forEachInSimpleVolumeFunction · 0.85
errorMethod · 0.80
insertMethod · 0.80
unexpectedFunction · 0.50
containsMethod · 0.45
includeMethod · 0.45

Tested by

no test coverage detected