28 #ifndef __itkImageBase_h
29 #define __itkImageBase_h
41 #include "vnl/vnl_matrix_fixed.txx"
47 template<
unsigned int NImageDimension,
unsigned int R,
unsigned int C >
48 class ImageTransformHelper;
60 template<
typename TImage >
123 template<
unsigned int VImageDimension = 2 >
143 itkStaticConstMacro(ImageDimension,
unsigned int, VImageDimension);
183 {
return VImageDimension; }
189 itkSetMacro(Origin, PointType);
190 virtual void SetOrigin(
const double origin[VImageDimension]);
191 virtual void SetOrigin(
const float origin[VImageDimension]);
219 virtual void SetDirection(
const DirectionType direction);
224 itkGetConstReferenceMacro(Direction, DirectionType);
229 itkGetConstReferenceMacro(InverseDirection, DirectionType);
235 itkGetConstReferenceMacro(Spacing, SpacingType);
241 itkGetConstReferenceMacro(Origin, PointType);
257 virtual void SetLargestPossibleRegion(
const RegionType & region);
266 {
return m_LargestPossibleRegion; }
271 virtual void SetBufferedRegion(
const RegionType & region);
277 {
return m_BufferedRegion; }
286 virtual void SetRequestedRegion(
const RegionType & region);
295 virtual void SetRequestedRegion(
const DataObject *data );
302 {
return m_RequestedRegion; }
309 this->SetLargestPossibleRegion(region);
310 this->SetBufferedRegion(region);
311 this->SetRequestedRegion(region);
319 this->SetLargestPossibleRegion(region);
320 this->SetBufferedRegion(region);
321 this->SetRequestedRegion(region);
414 virtual void SetSpacing(
const SpacingType & spacing);
415 virtual void SetSpacing(
const double spacing[VImageDimension]);
416 virtual void SetSpacing(
const float spacing[VImageDimension]);
423 template<
class TCoordRep >
424 bool TransformPhysicalPointToIndex(
429 this->m_PhysicalPointToIndex, this->m_Origin, point, index);
432 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
461 template<
class TCoordRep >
462 bool TransformPhysicalPointToContinuousIndex(
468 for (
unsigned int k = 0; k < VImageDimension; k++ )
470 cvector[k] = point[k] - this->m_Origin[k];
472 cvector = m_PhysicalPointToIndex * cvector;
473 for (
unsigned int i = 0; i < VImageDimension; i++ )
475 index[i] =
static_cast< TCoordRep
>( cvector[i] );
479 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
488 template<
class TCoordRep >
489 void TransformContinuousIndexToPhysicalPoint(
493 for (
unsigned int r = 0; r < VImageDimension; r++ )
496 for (
unsigned int c = 0; c < VImageDimension; c++ )
498 sum += this->m_IndexToPhysicalPoint(r, c) * index[c];
500 point[r] = sum + this->m_Origin[r];
510 template<
class TCoordRep >
511 void TransformIndexToPhysicalPoint(
516 this->m_IndexToPhysicalPoint, this->m_Origin, index, point);
548 template<
class TCoordRep >
549 void TransformLocalVectorToPhysicalVector(
559 for (
unsigned int i = 0; i < VImageDimension; i++ )
563 for (
unsigned int j = 0; j < VImageDimension; j++ )
565 sum += direction[i][j] * inputGradient[j];
567 outputGradient[i] =
static_cast< TCoordRep
>( sum );
579 template<
class TCoordRep >
580 void TransformPhysicalVectorToLocalVector(
588 const DirectionType & inverseDirection = this->GetInverseDirection();
590 for (
unsigned int i = 0; i < VImageDimension; i++ )
594 for (
unsigned int j = 0; j < VImageDimension; j++ )
596 sum += inverseDirection[i][j] * inputGradient[j];
598 outputGradient[i] =
static_cast< TCoordRep
>( sum );
611 virtual void CopyInformation(
const DataObject *data);
632 virtual void UpdateOutputInformation();
641 virtual void UpdateOutputData();
646 virtual void SetRequestedRegionToLargestPossibleRegion();
657 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
667 virtual bool VerifyRequestedRegion();
687 virtual unsigned int GetNumberOfComponentsPerPixel()
const;
688 virtual void SetNumberOfComponentsPerPixel(
unsigned int);
694 virtual void PrintSelf(std::ostream & os,
Indent indent)
const;
700 void ComputeOffsetTable();
707 virtual void ComputeIndexToPhysicalPointMatrices();
727 virtual void InitializeBufferedRegion(
void);
731 void operator=(
const Self &);
742 #define ITK_TEMPLATE_ImageBase(_, EXPORT, TypeX, TypeY) \
745 _( 1 ( class EXPORT ImageBase< ITK_TEMPLATE_1 TypeX > ) ) \
746 namespace Templates \
748 typedef ImageBase< ITK_TEMPLATE_1 TypeX > ImageBase##TypeY; \
752 #if ITK_TEMPLATE_EXPLICIT
755 #include "Templates/itkImageBase+-.h"
759 #include "itkImageBase.hxx"