Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkImageStatisticsDataGenerator.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 QmitkImageStatisticsDataGenerator_h
14 #define QmitkImageStatisticsDataGenerator_h
15 
17 
19 
36 {
37 public:
43  QmitkImageStatisticsDataGenerator(mitk::DataStorage::Pointer storage, QObject* parent = nullptr) : QmitkImageAndRoiDataGeneratorBase(storage, parent) {};
44 
50 
57  bool IsValidResultAvailable(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
58 
70  mitk::DataNode::Pointer GetLatestResult(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode, bool onlyIfUpToDate = false, bool noWIP = true) const;
71 
79  std::string GenerateStatisticsNodeName(const mitk::Image* image, const mitk::BaseData* roi) const;
80 
88  void SetIgnoreZeroValueVoxel(bool _arg);
89 
95 
103  void SetHistogramNBins(unsigned int nbins);
104 
109  unsigned int GetHistogramNBins() const;
110 
111 protected:
112  bool ChangedNodeIsRelevant(const mitk::DataNode* changedNode) const;
113  void IndicateFutureResults(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
114  std::pair<QmitkDataGenerationJobBase*, mitk::DataNode::Pointer> GetNextMissingGenerationJob(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
115  void RemoveObsoleteDataNodes(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
116  mitk::DataNode::Pointer PrepareResultForStorage(const std::string& label, mitk::BaseData* result, const QmitkDataGenerationJobBase* job) const;
117 
120 
121  bool m_IgnoreZeroValueVoxel = false;
122  unsigned int m_HistogramNBins = 100;
123 };
124 
125 #endif
#define MITKIMAGESTATISTICSUI_EXPORT
Base class for background data generation jobs used by QmitkDataGeneratorBase and derived classes.
Base class for data generators that accept image and ROI nodes as vectors.
QmitkImageAndRoiDataGeneratorBase & operator=(const QmitkImageAndRoiDataGeneratorBase &)=delete
Generates and manages ImageStatisticsContainer results for image/ROI pairs.
QmitkImageStatisticsDataGenerator(QObject *parent=nullptr)
Constructs the generator without an initial data storage.
mitk::DataNode::Pointer GetLatestResult(const mitk::DataNode *imageNode, const mitk::DataNode *roiNode, bool onlyIfUpToDate=false, bool noWIP=true) const
Returns the latest statistics result node for a given image/ROI pair and current settings.
bool ChangedNodeIsRelevant(const mitk::DataNode *changedNode) const
Determines whether a changed data node is relevant and should trigger a regeneration.
mitk::DataNode::Pointer PrepareResultForStorage(const std::string &label, mitk::BaseData *result, const QmitkDataGenerationJobBase *job) const
Wraps a generation result in a data node suitable for storage.
bool GetIgnoreZeroValueVoxel() const
Returns whether zero-valued voxels are currently being ignored.
void RemoveObsoleteDataNodes(const mitk::DataNode *imageNode, const mitk::DataNode *roiNode) const
Removes obsolete result nodes for the given image/ROI pair from the data storage.
void IndicateFutureResults(const mitk::DataNode *imageNode, const mitk::DataNode *roiNode) const
Adds placeholder nodes and WIP dummy data to the data storage for missing or outdated results.
bool IsValidResultAvailable(const mitk::DataNode *imageNode, const mitk::DataNode *roiNode) const
Checks whether a valid, up-to-date statistics result exists for the given image/ROI pair.
std::string GenerateStatisticsNodeName(const mitk::Image *image, const mitk::BaseData *roi) const
Generates a unique node name for a statistics result based on image, ROI, and current settings.
void SetIgnoreZeroValueVoxel(bool _arg)
Sets whether zero-valued voxels should be ignored in statistics computation.
unsigned int GetHistogramNBins() const
Returns the current number of histogram bins.
QmitkImageStatisticsDataGenerator(mitk::DataStorage::Pointer storage, QObject *parent=nullptr)
Constructs the generator with a data storage.
QmitkImageStatisticsDataGenerator(const QmitkImageStatisticsDataGenerator &)=delete
std::pair< QmitkDataGenerationJobBase *, mitk::DataNode::Pointer > GetNextMissingGenerationJob(const mitk::DataNode *imageNode, const mitk::DataNode *roiNode) const
Returns the next generation job and its associated placeholder node.
void SetHistogramNBins(unsigned int nbins)
Sets the number of bins for histogram computation.
Base class of all data objects.
Definition: mitkBaseData.h:60
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76