ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkImageSpatialObject.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkImageSpatialObject_h
19 #define itkImageSpatialObject_h
20 
21 #include "itkImage.h"
22 #include "itkSpatialObject.h"
24 
25 namespace itk
26 {
37 template< unsigned int TDimension = 3,
38  typename TPixelType = unsigned char
39  >
40 class ITK_TEMPLATE_EXPORT ImageSpatialObject:
41  public SpatialObject< TDimension >
42 {
43 public:
44 
45  typedef double ScalarType;
50 
51  typedef TPixelType PixelType;
54  typedef typename ImageType::IndexType IndexType;
56  typedef typename Superclass::TransformType TransformType;
57  typedef typename Superclass::PointType PointType;
58  typedef typename Superclass::BoundingBoxType BoundingBoxType;
60 
63 
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(ImageSpatialObject, SpatialObject);
72 
74  void SetImage(const ImageType *image);
75 
77  const ImageType * GetImage() const;
78 
81  bool IsEvaluableAt(const PointType & point,
82  unsigned int depth = 0, char *name = ITK_NULLPTR) const ITK_OVERRIDE;
83 
87  bool ValueAt(const PointType & point, double & value,
88  unsigned int depth = 0, char *name = ITK_NULLPTR) const ITK_OVERRIDE;
89 
91  bool IsInside(const PointType & point,
92  unsigned int depth, char *name) const ITK_OVERRIDE;
93 
97  bool IsInside(const PointType & point) const;
98 
100  bool ComputeLocalBoundingBox() const ITK_OVERRIDE;
101 
103  ModifiedTimeType GetMTime(void) const ITK_OVERRIDE;
104 
106  void SetSlicePosition(unsigned int dimension, int position);
107 
109  int GetSlicePosition(unsigned int dimension)
110  { return m_SlicePosition[dimension]; }
111 
112  const char * GetPixelType()
113  {
114  return m_PixelType.c_str();
115  }
116 
118  void SetInterpolator(InterpolatorType *interpolator);
119  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
121 
122 protected:
123  ITK_DISALLOW_COPY_AND_ASSIGN(ImageSpatialObject);
124 
126 
128  virtual ~ImageSpatialObject() ITK_OVERRIDE;
129 
130  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
131 
132  int * m_SlicePosition;
133  std::string m_PixelType;
134 
135  typename InterpolatorType::Pointer m_Interpolator;
136  template <typename T>
137  void InternalSetPixelType(const T *)
138  {
139  itkWarningMacro("itk::ImageSpatialObject() : PixelType not recognized");
140  }
141  void InternalSetPixelType(const short *)
142  {
143  m_PixelType = "short";
144  }
145  void InternalSetPixelType(const unsigned char *)
146  {
147  m_PixelType = "unsigned char";
148  }
149  void InternalSetPixelType(const unsigned short *)
150  {
151  m_PixelType = "unsigned short";
152  }
153  void InternalSetPixelType(const float *)
154  {
155  m_PixelType = "float";
156  }
157  void InternalSetPixelType(const double *)
158  {
159  m_PixelType = "double";
160  }
161 };
162 } // end of namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 #include "itkImageSpatialObject.hxx"
166 #endif
167 
168 #endif //itkImageSpatialObject_h
Superclass::RegionType RegionType
Definition: itkImage.h:137
ImageType::IndexType IndexType
Image< PixelType, TDimension > ImageType
ImageSpatialObject< TDimension, TPixelType > Self
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
Nearest neighbor interpolation of a scalar image.
Superclass::BoundingBoxType BoundingBoxType
ImageType::ConstPointer ImagePointer
void InternalSetPixelType(const double *)
InterpolateImageFunction< ImageType > InterpolatorType
PointContainerType::Pointer PointContainerPointer
void InternalSetPixelType(const short *)
VectorContainer< IdentifierType, PointType > PointContainerType
Implementation of the composite pattern.
SpatialObject< TDimension > Superclass
Superclass::PointType PointType
ImageType::RegionType RegionType
void InternalSetPixelType(const float *)
Superclass::TransformType TransformType
Base class for all image interpolaters.
SmartPointer< const Self > ConstPointer
Implementation of an image as spatial object.
void InternalSetPixelType(const unsigned short *)
Define a front-end to the STL &quot;vector&quot; container that conforms to the IndexedContainerInterface.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
SmartPointer< Self > Pointer
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
NearestNeighborInterpolateImageFunction< ImageType > NNInterpolatorType
void InternalSetPixelType(const unsigned char *)