18 #ifndef __itkPSMImageDomain_h 19 #define __itkPSMImageDomain_h 22 #include "itkPSMRegionDomain.h" 23 #include "itkLinearInterpolateImageFunction.h" 37 template <
class T,
unsigned int VDimension>
44 typedef SmartPointer<Self> Pointer;
45 typedef SmartPointer<const Self> ConstPointer;
46 typedef WeakPointer<const Self> ConstWeakPointer;
60 typedef LinearInterpolateImageFunction<ImageType, typename PointType::CoordRepType>
61 ScalarInterpolatorType;
66 itkStaticConstMacro(Dimension,
unsigned int, VDimension);
76 m_ScalarInterpolator->SetInputImage(m_Image);
80 typename ImageType::RegionType::IndexType idx
81 = m_Image->GetRequestedRegion().GetIndex();
82 typename ImageType::RegionType::SizeType sz
83 = m_Image->GetRequestedRegion().GetSize();
85 typename ImageType::PointType l0;
86 m_Image->TransformIndexToPhysicalPoint(idx, l0);
87 typename ImageType::PointType u0;
88 m_Image->TransformIndexToPhysicalPoint(idx + sz, u0);
93 typename Superclass::PointType l;
94 typename Superclass::PointType u;
96 for (
unsigned int i = 0; i < VDimension; i++)
98 l[i] =
static_cast<double>(l0[i]);
99 u[i] =
static_cast<double>(u0[i]);
102 this->SetLowerBound(l);
103 this->SetUpperBound(u);
105 itkGetObjectMacro(Image, ImageType);
106 itkGetConstObjectMacro(Image, ImageType);
110 inline T
Sample(
const PointType &p)
const 111 {
return m_ScalarInterpolator->Evaluate(p); }
115 {
return m_ScalarInterpolator->IsInsideBuffer(p); }
118 itkGetObjectMacro(ScalarInterpolator, ScalarInterpolatorType);
123 m_ScalarInterpolator = ScalarInterpolatorType::New();
126 void PrintSelf(std::ostream& os, Indent indent)
const 128 Superclass::PrintSelf(os, indent);
130 os << indent <<
"m_Image = " << m_Image << std::endl;
131 os << indent <<
"m_ScalarInterpolator = " << m_ScalarInterpolator << std::endl;
137 void operator=(
const Self&);
139 typename ImageType::Pointer m_Image;
140 typename ScalarInterpolatorType::Pointer m_ScalarInterpolator;
Image< T, VDimension > ImageType
bool IsInsideBuffer(const PointType &p) const
T Sample(const PointType &p) const
void SetImage(ImageType *I)
Superclass::PointType PointType