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