34 return "INTERP_Signal";
41 if (this->m_Values != _arg)
43 this->m_Values = _arg;
52 if (this->m_Values != _arg)
54 this->m_Values = std::move(_arg);
61 this->m_Values = rhs.m_Values;
62 this->SetTimeStamp(rhs.GetTimeStamp());
68 this->m_Values = std::move(rhs.m_Values);
69 this->SetTimeStamp(rhs.GetTimeStamp());
76 this->m_Values.clear();
88 auto iter = collection->find(key);
89 if (iter != collection->end())
91 return iter->second.GetPointer();
126 std::ostringstream nameStrm;
127 nameStrm.imbue(std::locale(
"C"));
128 nameStrm <<
"Pos " << mapValue.first << std::endl << std::setprecision(3) <<
"(" << mapValue.second.first[0] <<
"|" << mapValue.second.first[1] <<
"|" << mapValue.second.first[2] <<
")";
129 return nameStrm.str();
135 auto predicate = [point](
const PositionalCollectionMap::value_type& value) {
return value.second.first == point; };
137 auto iter = std::find_if(std::begin(this->positionalPlots), std::end(this->positionalPlots), predicate);
138 if (iter != positionalPlots.end())
140 return iter->second.second.GetPointer();
147 auto iter = this->positionalPlots.find(
id);
148 if (iter != positionalPlots.end())
150 return iter->second.second.GetPointer();
158 double max = itk::NumericTraits<double>::NonpositiveMin();
163 auto sample = this->GetSamplePlot(this->currentPositionPlots);
168 for (
const auto& posCollection : this->positionalPlots)
170 auto sample = this->GetSamplePlot(posCollection.second.second);
177 return std::make_pair(min, max);
182 double max = itk::NumericTraits<double>::NonpositiveMin();
185 for (
const auto& plot : *(this->currentPositionPlots.GetPointer()))
190 for (
const auto& posCollection : this->positionalPlots)
192 for (
const auto& plot : *(posCollection.second.second))
198 for (
const auto& plot : *(this->staticPlots))
203 return std::make_pair(min, max);
208 this->currentPositionPlots = PlotDataCurveCollection::New();
209 this->staticPlots = PlotDataCurveCollection::New();
214 for (
const auto & pos : data)
216 if (max < pos.second)
221 if (min > pos.second)
230 for (
const auto & pos : data)
245 mitk::PlotDataCurve::Pointer
250 mitkThrow() <<
"Cannot calc model curve from function for given fit. Passed ModelFitInfo instance is nullptr.";
254 assert(inputImage.IsNotNull());
258 values.reserve(timeGrid.size());
264 geometry->WorldToIndex(position, index);
270 for (
unsigned int t = 0; t < timeGrid.size(); ++t)
275 const auto& list = var.second;
277 if (list.size() == 1)
279 parameterMap[var.first] = list.front();
283 parameterMap[var.first] = list.at(t);
288 double x = timeGrid[t];
289 parameterMap[fitInfo->
x] = x;
292 values.emplace_back(std::make_pair(x, y));
295 result->SetValues(std::move(values));
300 mitk::PlotDataCurve::Pointer
311 assert(inputImage.IsNotNull());
317 geometry->WorldToIndex(position, index);
331 values.reserve(timeGrid.size());
333 for (
unsigned int t = 0; t < timeGrid.size(); ++t)
335 double x = timeGrid[t];
336 double y = curveDataY[t];
337 values.emplace_back(std::make_pair(x, y));
340 result->SetValues(std::move(values));
344 mitk::PlotDataCurve::Pointer
349 mitkThrow() <<
"Cannot calc model curve from function for given fit. Passed ModelFitInfo instance is nullptr.";
352 mitk::PlotDataCurve::Pointer result;
374 MITK_ERROR <<
"Error while parsing modelfit function: " << e.what();
381 mitk::PlotDataCurveCollection::Pointer
386 mitkThrow() <<
"Cannot calc model curve from function for given fit. Passed ModelFitInfo instance is nullptr.";
389 mitk::PlotDataCurveCollection::Pointer result = mitk::PlotDataCurveCollection::New();
393 if (additionalInput.second.size() != timeGrid.size())
396 "Error while refreshing input data for visualization. Size of data and input image time grid differ. Invalid data name: " 397 << additionalInput.first;
403 values.reserve(timeGrid.size());
405 for (
unsigned int t = 0; t < timeGrid.size(); ++t)
407 const double x = timeGrid[t];
408 const double y = additionalInput.second[t];
409 values.emplace_back(std::make_pair(x, y));
411 pointData->SetValues(std::move(values));
412 result->CastToSTLContainer().emplace(additionalInput.first, std::move(pointData));
419 mitk::PlotDataCurve::Pointer
424 mitkThrow() <<
"Cannot generate sample plot data. Passed image instance is nullptr.";
429 values.reserve(timeGrid.size());
431 for (
unsigned int t = 0; t < timeGrid.size(); ++t)
433 const double x = timeGrid[t];
434 const double y =
ReadVoxel(image, position, t);
435 values.emplace_back(std::make_pair(x, y));
438 result->SetValues(std::move(values));
mitk::PlotDataCurve::Pointer CalcSignalFromFunction(const mitk::Point3D &position, const mitk::modelFit::ModelFitInfo *fitInfo, const mitk::ModelBase::TimeGridType &timeGrid)
MITKMODELFIT_EXPORT const std::string MODEL_FIT_PLOT_SAMPLE_NAME()
MITKMODELFIT_EXPORT ModelTraitsInterface::ParameterValueType ReadVoxel(const mitk::Image *image, const mitk::Point3D &position, unsigned int timestep=0, bool noThrow=true)
ModelTraitsInterface::ParametersType ParametersType
MITKMODELFIT_EXPORT ModelTraitsInterface::ParametersType ConvertParameterMapToParameterVector(const ParameterValueMapType &valueMap, const ModelTraitsInterface *pTraitInterface)
virtual void SetDefaultTimeGrid(TimeGridType _arg)
PlotDataValues ValuesType
itk::Array< double > TimeGridType
mitk::Image::Pointer inputImage
static std::string GetPositionalCollectionName(const PositionalCollectionMap::value_type &mapValue)
StaticParameterMap staticParamMap
static ModelParameterizerBase::Pointer GenerateModelParameterizer(const modelFit::ModelFitInfo &fit)
DataType::PointIdentifier PointIdentifier
std::map< ModelTraitsInterface::ParameterNameType, double > ParameterValueMapType
const mitk::PlotDataCurve * GetPlotCurve(const mitk::PlotDataCurveCollection *collection, const std::string &key)
MITKMODELFIT_EXPORT PlotDataCurve::Pointer GenerateImageSamplePlotData(const mitk::Point3D &position, const mitk::Image *image, const mitk::ModelBase::TimeGridType &timeGrid)
MITKMODELFIT_EXPORT const std::string MODEL_FIT_PLOT_INTERPOLATED_SIGNAL_NAME()
MITKMODELFIT_EXPORT PlotDataCurveCollection::Pointer GenerateAdditionalModelFitPlotData(const mitk::Point3D &position, const mitk::modelFit::ModelFitInfo *fitInfo, const mitk::ModelBase::TimeGridType &timeGrid)
std::vector< std::pair< double, double > > PlotDataValues
MITKMODELFIT_EXPORT PlotDataCurve::Pointer GenerateModelSignalPlotData(const mitk::Point3D &position, const mitk::modelFit::ModelFitInfo *fitInfo, const mitk::ModelBase::TimeGridType &timeGrid, mitk::ModelParameterizerBase *parameterizer=nullptr)
Image class for storing images.
ModelTraitsInterface::ModelResultType ModelResultType
void CheckXMinMaxFromPlotDataValues(const PlotDataValues &data, double &min, double &max)
mitk::Image::Pointer image
Data class that stores all information about a modelfit that is relevant to the visualization and sto...
const LookupTableType & GetLookupTable() const
Returns the map of lists.
const PlotDataCurveCollection * GetPositionalPlot(const mitk::Point3D &point) const
void CheckYMinMaxFromPlotDataValues(const PlotDataValues &data, double &min, double &max)
itk::MapContainer< std::string, PlotDataCurve::Pointer > PlotDataCurveCollection
MITKMODELFIT_EXPORT const std::string MODEL_FIT_PLOT_SIGNAL_NAME()
PlotDataValues::value_type GetYMinMax() const
MITKMODELFIT_EXPORT ParameterValueMapType ExtractParameterValueMapFromModelFit(const mitk::modelFit::ModelFitInfo *fitInfo, const mitk::Point3D &position)
ScalarListLookupTable inputData
PlotDataValues::value_type GetXMinMax() const
static const PlotDataCurve * GetInterpolatedSignalPlot(const PlotDataCurveCollection *coll)
static const PlotDataCurve * GetSamplePlot(const PlotDataCurveCollection *coll)
PlotDataCurve & operator=(const PlotDataCurve &rhs)
mitk::PlotDataCurve::Pointer CalcSignalFromModel(const mitk::Point3D &position, const mitk::modelFit::ModelFitInfo *fitInfo, const mitk::ModelParameterizerBase *parameterizer=nullptr)
static const PlotDataCurve * GetSignalPlot(const PlotDataCurveCollection *coll)
virtual void SetValues(const ValuesType &_arg)