Friction Ridge Image and Features
API for participating in NIST's Friction Ridge Image and Features Technology Evaluations.
Loading...
Searching...
No Matches
libfrif_efs.cpp
Go to the documentation of this file.
1/*
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 */
10
11#include <frif/efs.h>
12
15 const std::string &probeIdentifier_,
16 const uint8_t probeInputIdentifier_,
17 const Minutia &probeMinutia_,
18 const std::string &referenceIdentifier_,
19 const uint8_t referenceInputIdentifier_,
20 const Minutia &referenceMinutia_) :
21 type{type_},
22 probeIdentifier{probeIdentifier_},
23 probeInputIdentifier{probeInputIdentifier_},
24 probeMinutia{probeMinutia_},
25 referenceIdentifier{referenceIdentifier_},
26 referenceInputIdentifier{referenceInputIdentifier_},
27 referenceMinutia{referenceMinutia_}
28{
29
30}
31
33 const Coordinate &coordinate_,
34 const uint16_t theta_,
35 const MinutiaType type_,
36 const std::optional<uint16_t> coordinateUncertainty_,
37 const std::optional<uint8_t> thetaUncertainty_) :
38 coordinate{coordinate_},
39 coordinateUncertainty{coordinateUncertainty_},
40 theta{theta_},
41 thetaUncertainty{thetaUncertainty_},
42 type{type_}
43{
44
45}
46
48 const Coordinate &coordinate_,
49 const std::optional<uint16_t> &direction_,
50 const std::optional<uint16_t> coordinateUncertainty_,
51 const std::optional<uint8_t> directionUncertainty_) :
52 coordinate{coordinate_},
53 coordinateUncertainty{coordinateUncertainty_},
54 direction{direction_},
55 directionUncertainty{directionUncertainty_}
56{
57
58}
59
61 const Coordinate &coordinate_,
62 const std::optional<std::tuple<std::optional<uint16_t>,
63 std::optional<uint16_t>, std::optional<uint16_t>>> &direction_,
64 const std::optional<uint16_t> coordinateUncertainty_,
65 const std::optional<std::tuple<std::optional<uint8_t>,
66 std::optional<uint8_t>, std::optional<uint8_t>>>
67 &directionUncertainty_) :
68 coordinate{coordinate_},
69 coordinateUncertainty{coordinateUncertainty_},
70 direction{direction_},
71 directionUncertainty{directionUncertainty_}
72{
73
74}
75
78 const CreaseClassification cld_,
79 const std::vector<Segment> &segments_) :
80 fgp{fgp_},
81 segments{segments_}
82{
83 this->setCreaseClassification(cld_);
84}
85
88 const
89{
90 return (this->fgp);
91}
92
93void
99
102 const
103{
104 return (this->cld);
105}
106
107void
110{
111 if (std::get_if<PalmCrease>(&cld_) != nullptr) {
112 switch (this->fgp) {
114 [[ fallthrough ]];
116 [[ fallthrough ]];
118 [[ fallthrough ]];
120 [[ fallthrough ]];
122 [[ fallthrough ]];
124 [[ fallthrough ]];
126 [[ fallthrough ]];
128 [[ fallthrough ]];
130 [[ fallthrough ]];
132 [[ fallthrough ]];
134 [[ fallthrough ]];
136 [[ fallthrough ]];
138 [[ fallthrough ]];
139
141 [[ fallthrough ]];
143 [[ fallthrough ]];
145 [[ fallthrough ]];
146
148 [[ fallthrough ]];
150 throw std::logic_error{"CreaseClassification = "
151 "PalmCrease, but FrictionRidgeGeneralizedPosition "
152 "is not from a palm"};
153
155 [[ fallthrough ]];
157 [[ fallthrough ]];
159 [[ fallthrough ]];
161 [[ fallthrough ]];
163 [[ fallthrough ]];
165 [[ fallthrough ]];
167 [[ fallthrough ]];
169 [[ fallthrough ]];
171 [[ fallthrough ]];
173 [[ fallthrough ]];
175 [[ fallthrough ]];
177 [[ fallthrough ]];
179 [[ fallthrough ]];
181 [[ fallthrough ]];
183 [[ fallthrough ]];
185 [[ fallthrough ]];
187 [[ fallthrough ]];
189 [[ fallthrough ]];
191 [[ fallthrough ]];
193 [[ fallthrough ]];
195 [[ fallthrough ]];
198 [[ fallthrough ]];
201 [[ fallthrough ]];
203 [[ fallthrough ]];
205 break;
206 }
207 }
208
209 this->cld = cld_;
210}
211
212std::vector<FRIF::Segment>
214 const
215{
216 return (this->segments);
217}
218
219void
221 const FRIF::Segment &segment)
222{
223 this->segments.push_back(segment);
224}
225
226void
228 const std::vector<FRIF::Segment> &segments_)
229{
230 this->segments = segments_;
231}
232
235 const std::optional<PatternSubclassification> sub_,
236 const std::optional<WhorlDeltaRelationship> wdr_)
237{
238 this->setPatternGeneralClassification(gcf_);
239
240 if (sub_.has_value())
241 this->setPatternSubclassification(sub_.value());
242
243 if (wdr_.has_value())
244 this->setWhorlDeltaRelationship(wdr_.value());
245
246}
247
248void
251{
252 this->gcf = gcf_;
253
254 this->sub = std::nullopt;
255 this->wdr = std::nullopt;
256}
257
258void
260 const PatternSubclassification sub_)
261{
262 switch (this->gcf) {
264 if (std::get_if<ArchPatternSubclassification>(&sub_) == nullptr)
265 throw std::logic_error{"PatternGeneralClassification = "
266 "Arch, but PatternSubclassification is not an "
267 "ArchPatternSubclassification"};
268
269 break;
271 if (std::get_if<WhorlPatternSubclassification>(&sub_) ==
272 nullptr)
273 throw std::logic_error{"PatternGeneralClassification = "
274 "Whorl, but PatternSubclassification is not a "
275 "WhorlPatternSubclassification"};
276 break;
277 default:
278 throw std::logic_error{"PatternGeneralClassification is not "
279 "Arch or Whorl"};
280 }
281
282 this->sub = sub_;
283}
284
285void
287 const WhorlDeltaRelationship wdr_)
288{
290 throw std::logic_error{"PatternGeneralClassification is not "
291 "Whorl"};
292 if (!this->sub.has_value())
293 throw std::logic_error{"PatternSubClassification is not set"};
294 if (std::get_if<WhorlPatternSubclassification>(&this->sub.value()) ==
295 nullptr)
296 throw std::logic_error{"PatternGeneralClassification = Whorl, "
297 "but PatternSubclassification is not a "
298 "WhorlPatternSubclassification"};
299
300 this->wdr = wdr_;
301}
302
305 const
306{
307 return (this->gcf);
308}
309
310std::optional<FRIF::EFS::PatternSubclassification>
312 const
313{
314 return (this->sub);
315}
316
317std::optional<FRIF::EFS::WhorlDeltaRelationship>
319 const
320{
321 return (this->wdr);
322}
std::vector< Segment > getSegments() const
void setFrictionRidgeGeneralizedPosition(const FrictionRidgeGeneralizedPosition fgp)
Crease(const FrictionRidgeGeneralizedPosition fgp, const CreaseClassification cld, const std::vector< Segment > &segments)
Crease constructor.
void addSegment(const Segment &segment)
void setCreaseClassification(const CreaseClassification cld)
void setSegments(const std::vector< Segment > &segments)
CreaseClassification getCreaseClassification() const
FrictionRidgeGeneralizedPosition getFrictionRidgeGeneralizedPosition() const
std::optional< PatternSubclassification > getPatternSubclassification() const
void setPatternGeneralClassification(const PatternGeneralClassification)
void setWhorlDeltaRelationship(const WhorlDeltaRelationship)
PatternClassification(const PatternGeneralClassification, const std::optional< PatternSubclassification >={}, const std::optional< WhorlDeltaRelationship >={})
std::optional< WhorlDeltaRelationship > getWhorlDeltaRelationship() const
void setPatternSubclassification(const PatternSubclassification)
PatternGeneralClassification getPatternGeneralClassification() const
std::variant< FingerCrease, PalmCrease, LinearDiscontinuity > CreaseClassification
Collection of crease types.
Definition efs.h:687
PatternGeneralClassification
General classification of friction ridge structure.
Definition efs.h:139
std::variant< ArchPatternSubclassification, WhorlPatternSubclassification > PatternSubclassification
Subclassification of PatternClassification.
Definition efs.h:191
FrictionRidgeGeneralizedPosition
Friction positions codes from ANSI/NIST-ITL 1-2011 (2015).
Definition efs.h:58
MinutiaType
Types of minutiae.
Definition efs.h:335
CorrespondenceType
Types of correspondence.
Definition efs.h:480
WhorlDeltaRelationship
Whorl-Delta relationship.
Definition efs.h:208
std::tuple< Coordinate, Coordinate > Segment
Line segment.
Definition common.h:216
Pixel location in an image.
Definition common.h:192
Core(const Coordinate &coordinate={}, const std::optional< uint16_t > &direction={}, const std::optional< uint16_t > coordinateUncertainty={}, const std::optional< uint8_t > directionUncertainty={})
Core constructor.
CorrespondenceRelationship(const CorrespondenceType type={}, const std::string &probeIdentifier={}, const uint8_t probeInputIdentifier={}, const Minutia &probeMinutia={}, const std::string &referenceIdentifier={}, const uint8_t referenceInputIdentifier={}, const Minutia &referenceMinutia={})
CorrespondenceRelationship constructor.
Delta(const Coordinate &coordinate={}, const std::optional< std::tuple< std::optional< uint16_t >, std::optional< uint16_t >, std::optional< uint16_t > > > &direction={}, std::optional< uint16_t > coordinateUncertainty={}, const std::optional< std::tuple< std::optional< uint8_t >, std::optional< uint8_t >, std::optional< uint8_t > > > &directionUncertainty={})
Delta constructor.
Friction ridge feature details.
Definition efs.h:344
Minutia(const Coordinate &coordinate={}, const uint16_t theta={}, const MinutiaType type=MinutiaType::Unknown, const std::optional< uint16_t > coordinateUncertainty={}, const std::optional< uint8_t > thetaUncertainty={})
Minutia constructor.