20 #include <unordered_map> 25 #pragma clang diagnostic push 26 #pragma clang diagnostic ignored "-Wpadded" 44 std::vector<float> data;
47 using DataStorage = std::unordered_map<Label, VOIData>;
54 std::optional<std::string>
name;
121 inline bool isEmpty() const noexcept {
return data_.empty(); }
126 for (
auto &&entry : data_) { labels.insert(entry.first); }
132 inline std::size_t
labelCount() const noexcept {
return data_.size(); }
136 if (
auto const voiIt = data_.find(label); voiIt != data_.end()) {
137 return voiIt->second.scale;
139 return std::numeric_limits<double>::quiet_NaN();
169 if (
auto const store = data_.find(label); store != data_.end()) {
170 return f(store->second.data.data());
173 throw std::invalid_argument(
"Label " + std::to_string(label) +
190 #pragma clang diagnostic pop Name namespace for CortidQCT library.
Definition: CortidQCT.h:23
auto labels() const
Returns all valid labels of the model.
Definition: MeasurementModel.h:124
DiscreteRange< float > densityRange
range for the density sampling
Definition: MeasurementModel.h:71
bool isEmpty() const noexcept
Returns true iff to model contains to data.
Definition: MeasurementModel.h:121
double densityScale(Label const &label) const
Returns the density scale parameter of the given VOI.
Definition: MeasurementModel.h:135
std::optional< std::string > author
Optional model author.
Definition: MeasurementModel.h:58
DiscreteRange< float > angleRange
range for the angle sampling
Definition: MeasurementModel.h:73
Type representing the measurement model.
Definition: MeasurementModel.h:33
MeasurementModel() noexcept(noexcept(DataStorage()))
Creates an empty measurement model.
Definition: MeasurementModel.h:89
std::optional< std::string > description
Optional model description.
Definition: MeasurementModel.h:56
This header contains the definition of the DiscreteRange template.
std::optional< std::string > name
Optional model name.
Definition: MeasurementModel.h:54
float kernelSigma
in-plane kernel width (sigma of gaussian kernel)
Definition: MeasurementModel.h:64
float sliceSpacing
slice thickness
Definition: MeasurementModel.h:66
static MeasurementModel fromFile(std::string const &filename)
Definition: MeasurementModel.h:99
std::optional< std::string > creationDate
Definition: MeasurementModel.h:61
DiscreteRange< float > samplingRange
sampling range for the line sampling
Definition: MeasurementModel.h:69
unsigned int Label
Label type.
Definition: MeasurementModel.h:36
MeasurementModel & loadFromFile(std::string const &filename)
Definition: MeasurementModel.cpp:47
auto withUnsafeDataPointer(Label label, F &&f) const
Calls the given functional with an unsafe pointer to the raw sample data storage. ...
Definition: MeasurementModel.h:168
std::size_t labelCount() const noexcept
Returns the number of valid labels of the model.
Definition: MeasurementModel.h:132
This header is a wrapper for including optional depending on the supported C++ standard version...