Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkSceneReaderHelpers.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkSceneReaderHelpers_h
14 #define mitkSceneReaderHelpers_h
15 
16 #include <mitkBaseData.h>
17 #include <mitkCoreServices.h>
20 #include <mitkPropertyList.h>
21 
22 #include <limits>
23 #include <string>
24 #include <vector>
25 
27 {
41  inline void StripTransientProperties(PropertyList &propertyList, const BaseData *data)
42  {
44  if (!transience)
45  return;
46 
47  std::vector<std::string> transientKeys;
48  for (const auto &property : *propertyList.GetMap())
49  {
50  if (transience->IsTransient(data, property.first))
51  transientKeys.push_back(property.first);
52  }
53 
54  for (const auto &key : transientKeys)
55  propertyList.DeleteProperty(key);
56  }
57 
72  {
73  auto *geometry = dynamic_cast<ProportionalTimeGeometry *>(data->GetTimeGeometry());
74  if (geometry == nullptr)
75  return;
76 
77  PropertyList::ConstPointer properties = data->GetPropertyList();
78  if (properties == nullptr)
79  return;
80 
81  float value = 0.0f;
82  if (properties->GetFloatProperty("ProportionalTimeGeometry.FirstTimePoint", value))
83  {
84  if (value == -std::numeric_limits<float>::infinity())
85  value = std::numeric_limits<float>::lowest();
86  geometry->SetFirstTimePoint(value);
87  }
88  if (properties->GetFloatProperty("ProportionalTimeGeometry.StepDuration", value))
89  geometry->SetStepDuration(value);
90  }
91 }
92 
93 #endif
Base class of all data objects.
Definition: mitkBaseData.h:60
mitk::PropertyList::Pointer GetPropertyList() const
Get the data's property list.
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
Definition: mitkBaseData.h:152
RAII wrapper for core service objects.
static IPropertyTransience * GetPropertyTransience(us::ModuleContext *context=us::GetModuleContext())
Get an IPropertyTransience instance.
Key-value list holding instances of BaseProperty.
bool DeleteProperty(const std::string &propertyKey)
Remove a property from the list/map by key.
const PropertyMap * GetMap() const
Get a read-only pointer to the internal property map.
void ApplyProportionalTimeGeometryProperties(BaseData *data)
Reconstruct a proportional time geometry from properties on a BaseData's property list.
void StripTransientProperties(PropertyList &propertyList, const BaseData *data)
Remove transient properties (e.g. the "selected" UI flag) from a freshly read property list.