Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkMultiLabelSegmentationVtkMapper3D.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 mitkMultiLabelSegmentationVtkMapper3D_h
14 #define mitkMultiLabelSegmentationVtkMapper3D_h
15 
16 // MITK
17 #include "MitkMultilabelExports.h"
18 #include "mitkCommon.h"
19 
20 // MITK Rendering
21 #include "mitkBaseRenderer.h"
22 #include "mitkExtractSliceFilter.h"
23 #include "mitkLabelSetImage.h"
24 #include "mitkVtkMapper.h"
25 
26 // VTK
27 #include <vtkSmartPointer.h>
28 
29 class vtkPolyDataMapper;
30 class vtkImageData;
31 class vtkLookupTable;
32 class vtkVolumeProperty;
33 class vtkVolume;
34 class vtkSmartVolumeMapper;
35 class vtkColorTransferFunction;
36 class vtkPiecewiseFunction;
37 
38 namespace mitk
39 {
40  class MultiLabelSegmentationGroupMapping;
41  class IPreferences;
42 
58  {
59  public:
62 
64  itkNewMacro(Self);
65 
68  void Update(mitk::BaseRenderer *renderer) override;
69 
70  //### methods of MITK-VTK rendering pipeline
71  vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
72  //### end of methods of MITK-VTK rendering pipeline
73 
82  {
83  public:
85 
86  std::map<const Image*, std::unique_ptr<MultiLabelSegmentationGroupMapping>> m_GroupPipelines;
87 
91 
95 
97  itk::TimeStamp m_LastDataUpdateTime;
99  itk::TimeStamp m_LastPropertyUpdateTime;
100 
102 
105 
109  std::optional<bool> m_GPUCheckSuccessfull;
111 
113 
117  ~LocalStorage() override;
118  };
119 
122 
123  static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = nullptr, bool overwrite = false);
124 
125  protected:
130 
143  void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
144 
147  void UpdateLookupTable(LocalStorage* localStorage);
148 
149  using OutdatedGroupVectorType = std::vector<std::pair<mitk::MultiLabelSegmentation::GroupIndexType, const mitk::Image*>>;
153  mitk::MultiLabelSegmentation* seg, bool fadedPipelineChanged);
154 
155  void UpdateVolumeMapping(LocalStorage* localStorage, const OutdatedGroupVectorType& outdatedData);
156 
159  };
160 
161 } // namespace mitk
162 
163 #endif
#define MITKMULTILABEL_EXPORT
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64
Interface to application preferences.
Base class for mapper specific rendering resources.
Definition: mitkMapper.h:191
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:47
Internal class holding the mapper, actor, etc. for each of the 3 2D render windows.
itk::TimeStamp m_LastPropertyUpdateTime
Timestamp of last update of a property.
std::map< const Image *, std::unique_ptr< MultiLabelSegmentationGroupMapping > > m_GroupPipelines
LocalStorage()
Default constructor of the local storage.
~LocalStorage() override
Default destructor of the local storage.
itk::TimeStamp m_LastDataUpdateTime
Timestamp of last update of stored data.
Mapper to resample and display 2D slices of a 3D labelset image.
void Update(mitk::BaseRenderer *renderer) override
Checks whether this mapper needs to update itself and generate data.
void UpdateLookupTable(LocalStorage *localStorage)
Generates the look up table that should be used.
void UpdateVolumeMapping(LocalStorage *localStorage, const OutdatedGroupVectorType &outdatedData)
mitkClassMacro(MultiLabelSegmentationVtkMapper3D, VtkMapper)
vtkProp * GetVtkProp(mitk::BaseRenderer *renderer) override
OutdatedGroupVectorType CheckForOutdatedGroups(mitk::MultiLabelSegmentationVtkMapper3D::LocalStorage *ls, mitk::MultiLabelSegmentation *seg, bool fadedPipelineChanged)
LocalStorage * GetLocalStorage(mitk::BaseRenderer *renderer)
Get the LocalStorage corresponding to the current renderer.
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer=nullptr, bool overwrite=false)
mitk::LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows.
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override
Does the actual resampling, without rendering the image yet. All the data is generated inside this me...
std::vector< std::pair< mitk::MultiLabelSegmentation::GroupIndexType, const mitk::Image * > > OutdatedGroupVectorType
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
Base class of all Vtk Mappers in order to display primitives by exploiting Vtk functionality.
Definition: mitkVtkMapper.h:48
Find image slices visible on a given plane.
std::size_t TimeStepType