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 >
110 template<
unsigned int VImageDimension = 2 >
130 itkStaticConstMacro(ImageDimension,
unsigned int, VImageDimension);
169 static unsigned int GetImageDimension()
170 {
return VImageDimension; }
176 itkSetMacro(Origin, PointType);
177 virtual void SetOrigin(
const double origin[VImageDimension]);
178 virtual void SetOrigin(
const float origin[VImageDimension]);
206 virtual void SetDirection(
const DirectionType direction);
211 itkGetConstReferenceMacro(Direction, DirectionType);
216 itkGetConstReferenceMacro(InverseDirection, DirectionType);
222 itkGetConstReferenceMacro(Spacing, SpacingType);
228 itkGetConstReferenceMacro(Origin, PointType);
244 virtual void SetLargestPossibleRegion(
const RegionType & region);
253 {
return m_LargestPossibleRegion; }
258 virtual void SetBufferedRegion(
const RegionType & region);
264 {
return m_BufferedRegion; }
273 virtual void SetRequestedRegion(
const RegionType & region);
282 virtual void SetRequestedRegion(
const DataObject *data );
289 {
return m_RequestedRegion; }
296 this->SetLargestPossibleRegion(region);
297 this->SetBufferedRegion(region);
298 this->SetRequestedRegion(region);
306 this->SetLargestPossibleRegion(region);
307 this->SetBufferedRegion(region);
308 this->SetRequestedRegion(region);
401 virtual void SetSpacing(
const SpacingType & spacing);
402 virtual void SetSpacing(
const double spacing[VImageDimension]);
403 virtual void SetSpacing(
const float spacing[VImageDimension]);
410 template<
class TCoordRep >
411 bool TransformPhysicalPointToIndex(
416 this->m_PhysicalPointToIndex, this->m_Origin, point, index);
419 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
448 template<
class TCoordRep >
449 bool TransformPhysicalPointToContinuousIndex(
455 for (
unsigned int k = 0; k < VImageDimension; k++ )
457 cvector[k] = point[k] - this->m_Origin[k];
459 cvector = m_PhysicalPointToIndex * cvector;
460 for (
unsigned int i = 0; i < VImageDimension; i++ )
462 index[i] =
static_cast< TCoordRep
>( cvector[i] );
466 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
475 template<
class TCoordRep >
476 void TransformContinuousIndexToPhysicalPoint(
480 for (
unsigned int r = 0; r < VImageDimension; r++ )
483 for (
unsigned int c = 0; c < VImageDimension; c++ )
485 sum += this->m_IndexToPhysicalPoint(r, c) * index[c];
487 point[r] = sum + this->m_Origin[r];
497 template<
class TCoordRep >
498 void TransformIndexToPhysicalPoint(
503 this->m_IndexToPhysicalPoint, this->m_Origin, index, point);
535 template<
class TCoordRep >
536 void TransformLocalVectorToPhysicalVector(
546 for (
unsigned int i = 0; i < VImageDimension; i++ )
550 for (
unsigned int j = 0; j < VImageDimension; j++ )
552 sum += direction[i][j] * inputGradient[j];
554 outputGradient[i] =
static_cast< TCoordRep
>( sum );
566 template<
class TCoordRep >
567 void TransformPhysicalVectorToLocalVector(
575 const DirectionType & inverseDirection = this->GetInverseDirection();
577 for (
unsigned int i = 0; i < VImageDimension; i++ )
581 for (
unsigned int j = 0; j < VImageDimension; j++ )
583 sum += inverseDirection[i][j] * inputGradient[j];
585 outputGradient[i] =
static_cast< TCoordRep
>( sum );
598 virtual void CopyInformation(
const DataObject *data);
619 virtual void UpdateOutputInformation();
628 virtual void UpdateOutputData();
633 virtual void SetRequestedRegionToLargestPossibleRegion();
644 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
654 virtual bool VerifyRequestedRegion();
674 virtual unsigned int GetNumberOfComponentsPerPixel()
const;
675 virtual void SetNumberOfComponentsPerPixel(
unsigned int);
681 virtual void PrintSelf(std::ostream & os,
Indent indent)
const;
687 void ComputeOffsetTable();
694 virtual void ComputeIndexToPhysicalPointMatrices();
714 virtual void InitializeBufferedRegion(
void);
718 void operator=(
const Self &);
728 #ifndef ITK_MANUAL_INSTANTIATION
729 #include "itkImageBase.hxx"