Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkSlicedData.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 mitkSlicedData_h
14 #define mitkSlicedData_h
15 
16 #include "itkImageRegion.h"
17 #include "itkIndex.h"
18 #include "itkOffset.h"
19 #include "itkSize.h"
20 #include "mitkBaseData.h"
21 #include "mitkSlicedGeometry3D.h"
22 #include <MitkCoreExports.h>
23 
24 namespace mitk
25 {
26  class SlicedGeometry3D;
27 
28  //##Documentation
29  //## @brief Super class of data objects consisting of slices
30  //##
31  //## Super class of data objects consisting of slices, e.g., images or a stack
32  //## of contours. (GetGeometry will return a BaseGeometry containing PlaneGeometry
33  //## objects).
34  //##
35  //## SlicedData-objects have geometries of type SlicedGeometry3D or sub-classes.
36  //## @ingroup Data
38  {
39  public:
41 
42  itkStaticConstMacro(RegionDimension, unsigned int, 5);
43 
45  typedef itk::ImageRegion<RegionDimension> RegionType;
46 
48  typedef itk::Index<RegionDimension> IndexType;
49  typedef IndexType::IndexValueType IndexValueType;
50 
53  typedef itk::Offset<RegionDimension> OffsetType;
54  typedef OffsetType::OffsetValueType OffsetValueType;
55 
57  typedef itk::Size<RegionDimension> SizeType;
58  typedef SizeType::SizeValueType SizeValueType;
59 
60  //##Documentation
61  //## Update the information for this DataObject so that it can be used as
62  //## an output of a ProcessObject. This method is used in the pipeline
63  //## mechanism to propagate information and initialize the meta data
64  //## associated with a itk::DataObject. Any implementation of this method
65  //## in a derived class of itk::DataObject is assumed to call its source's
66  //## ProcessObject::UpdateOutputInformation() which determines modified
67  //## times, LargestPossibleRegions, and any extra meta data like spacing,
68  //## origin, etc.
69  void UpdateOutputInformation() override;
70 
71  void PrepareForNewData() override;
72 
73  //##Documentation
74  //## Set the RequestedRegion to the LargestPossibleRegion. This forces a
75  //## filter to produce all of the output in one execution (i.e. not
76  //## streaming) on the next call to Update().
77  void SetRequestedRegionToLargestPossibleRegion() override;
78 
79  //##Documentation
80  //## Determine whether the RequestedRegion is outside of the
81  //## BufferedRegion. This method returns true if the RequestedRegion is
82  //## outside the BufferedRegion (true if at least one pixel is outside).
83  //## This is used by the pipeline mechanism to determine whether a filter
84  //## needs to re-execute in order to satisfy the current request. If the
85  //## current RequestedRegion is already inside the BufferedRegion from the
86  //## previous execution (and the current filter is up to date), then a
87  //## given filter does not need to re-execute
88  bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
89 
90  //##Documentation
91  //## @brief Verify that the RequestedRegion is within the
92  //## LargestPossibleRegion.
93  //##
94  //## Verify that the RequestedRegion is within the LargestPossibleRegion.
95  //## If the RequestedRegion is not within the LargestPossibleRegion,
96  //## then the filter cannot possibly satisfy the request. This method
97  //## returns true if the request can be satisfied (even if it will be
98  //## necessary to process the entire LargestPossibleRegion) and
99  //## returns false otherwise. This method is used by
100  //## PropagateRequestedRegion(). PropagateRequestedRegion() throws a
101  //## InvalidRequestedRegionError exception if the requested region is
102  //## not within the LargestPossibleRegion.
103  bool VerifyRequestedRegion() override;
104 
105  //##Documentation
106  //## Set the requested region from this data object to match the requested
107  //## region of the data object passed in as a parameter. This method is
108  //## implemented in the concrete subclasses of DataObject.
109  void SetRequestedRegion(const itk::DataObject *data) override;
110 
111  //##Documentation
112  //## Set the requested region from this data object to match the requested
113  //## region of the data object passed in as a parameter. This method is
114  //## implemented in the concrete subclasses of DataObject.
115  virtual void SetRequestedRegion(SlicedData::RegionType *region);
116 
122  void SetLargestPossibleRegion(SlicedData::RegionType *region);
123 
124  const RegionType &GetLargestPossibleRegion() const { return m_LargestPossibleRegion; }
125  //##Documentation
126  //## Get the region object that defines the size and starting index
127  //## for the region of the image requested (i.e., the region of the
128  //## image to be operated on by a filter).
129  virtual const RegionType &GetRequestedRegion() const { return m_RequestedRegion; }
130  virtual bool IsSliceSet(int s = 0, int t = 0, int n = 0) const = 0;
131  virtual bool IsVolumeSet(int t = 0, int n = 0) const = 0;
132  virtual bool IsChannelSet(int n = 0) const = 0;
133  void CopyInformation(const itk::DataObject *data) override;
134 
135  //##Documentation
136  //## @brief Get the number of channels
137  unsigned int GetNumberOfChannels() const { return m_LargestPossibleRegion.GetSize(4); }
148  // virtual const mitk::PlaneGeometry* GetPlaneGeometry(int s, int t=0) const;
149 
150  //##Documentation
151  //## @brief Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it).
152  //##
153  //## @em No update will be called. Normally used in GenerateOutputInformation of
154  //## subclasses of BaseProcess.
155  SlicedGeometry3D *GetSlicedGeometry(unsigned int t = 0) const;
156 
157  //##Documentation
158  //## @brief Convenience access method for the geometry, which is of type SlicedGeometry3D (or a sub-class of it).
159  //##
160  //## The method does not simply return the value of the m_Geometry3D member.
161  //## Before doing this, it makes sure that the BaseGeometry is up-to-date before
162  //## returning it (by setting the update extent appropriately and calling
163  //## UpdateOutputInformation).
164  //##
165  //## @warning GetGeometry not yet completely implemented.
166  //## @todo Appropriate setting of the update extent is missing.
167  const SlicedGeometry3D *GetUpdatedSlicedGeometry(unsigned int t = 0);
168 
169  //##Documentation
170  //## @brief Set the BaseGeometry of the data, which will be referenced (not copied!). It
171  //## has to be a sub-class of SlicedGeometry3D.
172  //##
173  //## @warning This method will normally be called internally by the sub-class of SlicedData
174  //## during initialization.
175  void SetGeometry(BaseGeometry *aGeometry3D) override;
176 
177  //##Documentation
178  //## @brief Convenience method for setting the origin of
179  //## the SlicedGeometry3D instances of all time steps
180  //##
181  //## In case the SlicedGeometry3D is evenly spaced,
182  //## the origin of the first slice is set to \a origin.
183  //## \sa mitk::BaseData::SetOrigin
184  void SetOrigin(const Point3D &origin) override;
185 
186  //##Documentation
187  //## @brief Convenience method for setting the spacing of
188  //## the SlicedGeometry3D instances of all time steps
189  virtual void SetSpacing(const ScalarType aSpacing[]);
190 
191  //##Documentation
192  //## @brief Convenience method for setting the spacing of
193  //## the SlicedGeometry3D instances of all time steps
194  virtual void SetSpacing(mitk::Vector3D aSpacing);
195 
196  protected:
197  SlicedData();
198  SlicedData(const SlicedData &other);
199  ~SlicedData() override;
201 
204 
207  };
208 
209 } // namespace mitk
210 
211 #endif
mitk::SlicedData::IndexValueType
IndexType::IndexValueType IndexValueType
Definition: mitkSlicedData.h:49
mitk::SlicedData
Super class of data objects consisting of slices.
Definition: mitkSlicedData.h:37
mitk::SlicedData::m_RequestedRegion
RegionType m_RequestedRegion
Definition: mitkSlicedData.h:202
mitk::SlicedData::SizeType
itk::Size< RegionDimension > SizeType
Definition: mitkSlicedData.h:57
mitk::SlicedData::RegionType
itk::ImageRegion< RegionDimension > RegionType
Definition: mitkSlicedData.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::SlicedData::GetNumberOfChannels
unsigned int GetNumberOfChannels() const
Get the number of channels.
Definition: mitkSlicedData.h:137
mitk::SlicedData::m_RequestedRegionInitialized
bool m_RequestedRegionInitialized
Definition: mitkSlicedData.h:203
mitk::Vector< ScalarType, 3 >
MitkCoreExports.h
mitk::BaseGeometry
BaseGeometry Describes the geometry of a data object.
Definition: mitkBaseGeometry.h:94
mitk::Point< ScalarType, 3 >
mitk::SlicedData::GetRequestedRegion
virtual const RegionType & GetRequestedRegion() const
Definition: mitkSlicedData.h:129
mitk::SlicedData::OffsetValueType
OffsetType::OffsetValueType OffsetValueType
Definition: mitkSlicedData.h:54
mitk::SlicedData::m_BufferedRegion
RegionType m_BufferedRegion
Definition: mitkSlicedData.h:205
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::SlicedData::m_UseLargestPossibleRegion
bool m_UseLargestPossibleRegion
Definition: mitkSlicedData.h:206
mitk::SlicedData::m_LargestPossibleRegion
RegionType m_LargestPossibleRegion
Definition: mitkSlicedData.h:200
mitkSlicedGeometry3D.h
mitk::SlicedGeometry3D
Describes the geometry of a data object consisting of slices.
Definition: mitkSlicedGeometry3D.h:62
mitk::SlicedData::IndexType
itk::Index< RegionDimension > IndexType
Definition: mitkSlicedData.h:48
mitkBaseData.h
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitk::SlicedData::GetLargestPossibleRegion
const RegionType & GetLargestPossibleRegion() const
Definition: mitkSlicedData.h:124
mitk::SlicedData::OffsetType
itk::Offset< RegionDimension > OffsetType
Definition: mitkSlicedData.h:53
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::ScalarType
double ScalarType
Definition: mitkNumericConstants.h:20
mitk::SlicedData::SizeValueType
SizeType::SizeValueType SizeValueType
Definition: mitkSlicedData.h:58