ImFusion C++ SDK 4.5.0
ImFusion::AnatomyPlugin::SelectorElem Struct Reference

Public Member Functions

 SelectorElem (std::optional< AnatomicalStructure::ContentType > ct={}, std::optional< std::string > identifier={}, std::optional< std::string > key={}, std::optional< std::pair< std::string, std::string > > attributeStructure=std::nullopt, std::optional< std::pair< std::string, std::string > > attributeObject=std::nullopt, std::set< std::string > pseudoClasses={})
 Base constructor allowing specification of all member variables.
bool match (const std::string &identifier, const Properties &attributesStructure, std::optional< AnatomicalStructure::ContentType > ct, const std::string &key, const Properties &attributesObject, const std::set< std::string > &pseudoClasses) const
 Returns true if the given object matches the selector.
std::string str () const
 Returns a string representation of the selector. This is the inverse of the parse function.

Static Public Member Functions

static std::optional< SelectorElemparse (const std::string &str)
 Parse a string into a SelectorElem.
static SelectorElem contentTypeSelector (AnatomicalStructure::ContentType ct)
 Utility function to create a Selector to only match by content type.
static SelectorElem attributesStructureSelector (std::pair< std::string, std::string > attr)
 Utility function to create a Selector to only match by AnatomicalStructure::attributes().
static SelectorElem attributesObjectSelector (std::pair< std::string, std::string > attr)
 Utility function to create a Selector to only match by KeyValueStore::Entry::attributes().
static SelectorElem pseudoClassesSelector (std::set< std::string > classes)
 Utility function to create a Selector to match with a set of pseudo-classes.
static SelectorElem wildcardSelector ()
 Utility function to create a Selector to match with everything.

Public Attributes

std::optional< AnatomicalStructure::ContentTypem_ct
 Content type to match.
std::optional< std::stringm_identifier
 AnatomicalStructure::identifier() to match.
bool m_exactIdentifier = false
 If true, m_identifier must match exactly (no child prefix rule). Serialized as "#=".
std::optional< std::stringm_key
 AnatomicalStructure::KeyValueStore<ContentType>::key to match.
bool m_exactKey = false
 If true, m_key must match exactly (no child prefix rule).
std::map< std::string, SelectorAnnotationm_annotations {}
 Post-selection metadata annotations.
std::optional< std::pair< std::string, std::string > > m_attributesStructure
 AnatomicalStructure::attributes() to match.
std::optional< std::pair< std::string, std::string > > m_attributesObject
 AnatomicalStructure::KeyValueStore<ContentType>::Entry::attributes() to match.
std::set< std::stringm_pseudoClasses
 Set of pseudo-classes to match, e.g. "focus" for the ":focus" pseudo-class.

Constructor & Destructor Documentation

◆ SelectorElem()

ImFusion::AnatomyPlugin::SelectorElem::SelectorElem ( std::optional< AnatomicalStructure::ContentType > ct = {},
std::optional< std::string > identifier = {},
std::optional< std::string > key = {},
std::optional< std::pair< std::string, std::string > > attributeStructure = std::nullopt,
std::optional< std::pair< std::string, std::string > > attributeObject = std::nullopt,
std::set< std::string > pseudoClasses = {} )
explicit

Base constructor allowing specification of all member variables.

Members that are std::nullopt are ignored during matching, other members must all match (logical AND).

Member Function Documentation

◆ parse()

std::optional< SelectorElem > ImFusion::AnatomyPlugin::SelectorElem::parse ( const std::string & str)
static

Parse a string into a SelectorElem.

Returns
std::nullopt if the string is not a valid selector, otherwise returns the parsed SelectorElem.

◆ match()

bool ImFusion::AnatomyPlugin::SelectorElem::match ( const std::string & identifier,
const Properties & attributesStructure,
std::optional< AnatomicalStructure::ContentType > ct,
const std::string & key,
const Properties & attributesObject,
const std::set< std::string > & pseudoClasses ) const

Returns true if the given object matches the selector.

Only the matching layer (ct, identifier, key, attributes, pseudo-classes) is considered. m_annotations are never consulted and do not influence the result.

Member Data Documentation

◆ m_exactKey

bool ImFusion::AnatomyPlugin::SelectorElem::m_exactKey = false

If true, m_key must match exactly (no child prefix rule).

Serialized as "/=".

◆ m_annotations

std::map<std::string, SelectorAnnotation> ImFusion::AnatomyPlugin::SelectorElem::m_annotations {}

Post-selection metadata annotations.

Does not affect match(); consumed by application code after matching. Serialized as "@name(arg1, arg2, ...)" suffix, e.g. "Images/Seg@labelValues(42, 55)". Keyed by annotation name; names must be unique within one SelectorElem (parse error otherwise). Iteration order is alphabetical by name, so str() normalizes annotation order.


The documentation for this struct was generated from the following file:
  • AnatomyPlugin/include/ImFusion/AnatomyPlugin/Selector.h
Search Tab / S to search, Esc to close