ITK  4.6.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  >
41  public SpatialObject< TDimension >
42 {
43 public:
44 
45  typedef double ScalarType;
50 
51  typedef TPixelType PixelType;
54  typedef typename ImageType::IndexType IndexType;
57  typedef typename Superclass::PointType PointType;
60 
63 
66 
68  itkNewMacro(Self);
69 
71  itkTypeMacro(ImageSpatialObject, SpatialObject);
72 
74  void SetImage(const ImageType *image);
75 
77  const ImageType * GetImage(void) const;
78 
81  bool IsEvaluableAt(const PointType & point,
82  unsigned int depth = 0, char *name = ITK_NULLPTR) const;
83 
87  bool ValueAt(const PointType & point, double & value,
88  unsigned int depth = 0, char *name = ITK_NULLPTR) const;
89 
91  bool IsInside(const PointType & point,
92  unsigned int depth, char *name) const;
93 
97  bool IsInside(const PointType & point) const;
98 
100  bool ComputeLocalBoundingBox() const;
101 
103  ModifiedTimeType GetMTime(void) const;
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  ImageSpatialObject(const Self &); //purposely not implemented
124  void operator=(const Self &); //purposely not implemented
125 
127 
129  virtual ~ImageSpatialObject();
130 
131  void PrintSelf(std::ostream & os, Indent indent) const;
132 
134  std::string m_PixelType;
135 
137  template <typename T>
138  void InternalSetPixelType(const T *)
139  {
140  itkWarningMacro("itk::ImageSpatialObject() : PixelType not recognized");
141  }
142  void InternalSetPixelType(const short *)
143  {
144  m_PixelType = "short";
145  }
146  void InternalSetPixelType(const unsigned char *)
147  {
148  m_PixelType = "unsigned char";
149  }
150  void InternalSetPixelType(const unsigned short *)
151  {
152  m_PixelType = "unsigned short";
153  }
154  void InternalSetPixelType(const float *)
155  {
156  m_PixelType = "float";
157  }
158  void InternalSetPixelType(const double *)
159  {
160  m_PixelType = "double";
161  }
162 };
163 } // end of namespace itk
164 
165 #ifndef ITK_MANUAL_INSTANTIATION
166 #include "itkImageSpatialObject.hxx"
167 #endif
168 
169 #endif //__itkImageSpatialObject_h
void PrintSelf(std::ostream &os, Indent indent) const
Point< ScalarType, VDimension > PointType
Superclass::RegionType RegionType
Definition: itkImage.h:140
bool ValueAt(const PointType &point, double &value, unsigned int depth=0, char *name=ITK_NULLPTR) const
ImageType::IndexType IndexType
Image< PixelType, TDimension > ImageType
bool IsInside(const PointType &point, unsigned int depth, char *name) const
BoundingBox< IdentifierType, VDimension, ScalarType, VectorContainerType > BoundingBoxType
void operator=(const Self &)
void SetImage(const ImageType *image)
ImageSpatialObject< TDimension, TPixelType > Self
unsigned long ModifiedTimeType
Definition: itkIntTypes.h:164
int GetSlicePosition(unsigned int dimension)
Nearest neighbor interpolation of a scalar image.
const ImageType * GetImage(void) const
void SetSlicePosition(unsigned int dimension, int position)
Superclass::BoundingBoxType BoundingBoxType
ImageType::ConstPointer ImagePointer
bool IsEvaluableAt(const PointType &point, unsigned int depth=0, char *name=ITK_NULLPTR) const
void InternalSetPixelType(const double *)
void SetInterpolator(InterpolatorType *interpolator)
InterpolateImageFunction< ImageType > InterpolatorType
PointContainerType::Pointer PointContainerPointer
void InternalSetPixelType(const short *)
VectorContainer< IdentifierType, PointType > PointContainerType
Superclass::IndexType IndexType
Definition: itkImage.h:122
Implementation of the composite pattern.
SpatialObject< TDimension > Superclass
ModifiedTimeType GetMTime(void) const
Superclass::PointType PointType
ImageType::RegionType RegionType
void InternalSetPixelType(const T *)
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
ScalableAffineTransform< double, VDimension > TransformType
bool ComputeLocalBoundingBox() const
SmartPointer< Self > Pointer
Base class for all data objects in ITK.
Templated n-dimensional image class.
Definition: itkImage.h:75
NearestNeighborInterpolateImageFunction< ImageType > NNInterpolatorType
InterpolatorType::Pointer m_Interpolator
void InternalSetPixelType(const unsigned char *)