28 #ifndef itkImageBase_h
29 #define itkImageBase_h
41 #include <vxl_version.h>
42 #if VXL_VERSION_DATE_FULL < 20160229
43 #include "vnl/vnl_matrix_fixed.txx"
45 #include "vnl/vnl_matrix_fixed.hxx"
53 template<
unsigned int NImageDimension,
unsigned int R,
unsigned int C,
typename TPo
intValue,
typename TMatrixValue >
113 template<
unsigned int VImageDimension = 2 >
136 itkStaticConstMacro(ImageDimension, ImageDimensionType, VImageDimension);
172 virtual void Initialize() ITK_OVERRIDE;
175 static
unsigned int GetImageDimension()
176 {
return VImageDimension; }
183 virtual void SetOrigin(
const double origin[VImageDimension]);
184 virtual void SetOrigin(
const float origin[VImageDimension]);
228 itkGetConstReferenceMacro(Spacing, SpacingType);
234 itkGetConstReferenceMacro(Origin,
PointType);
243 virtual void Allocate(
bool initialize=
false);
251 virtual void SetLargestPossibleRegion(
const RegionType & region);
260 {
return m_LargestPossibleRegion; }
265 virtual void SetBufferedRegion(
const RegionType & region);
271 {
return m_BufferedRegion; }
280 virtual void SetRequestedRegion(
const RegionType & region);
289 virtual void SetRequestedRegion(
const DataObject *data ) ITK_OVERRIDE;
296 {
return m_RequestedRegion; }
303 this->SetLargestPossibleRegion(region);
304 this->SetBufferedRegion(region);
305 this->SetRequestedRegion(region);
313 this->SetLargestPossibleRegion(region);
314 this->SetBufferedRegion(region);
315 this->SetRequestedRegion(region);
408 virtual void SetSpacing(
const SpacingType & spacing);
409 virtual void SetSpacing(
const double spacing[VImageDimension]);
410 virtual void SetSpacing(
const float spacing[VImageDimension]);
417 template<
typename TCoordRep >
426 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
455 template<
typename TCoordRep,
typename TIndexRep >
462 for (
unsigned int k = 0; k < VImageDimension; ++k )
464 cvector[k] = point[k] - this->m_Origin[k];
466 cvector = m_PhysicalPointToIndex * cvector;
467 for (
unsigned int i = 0; i < VImageDimension; ++i )
469 index[i] =
static_cast< TIndexRep
>( cvector[i] );
473 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
482 template<
typename TCoordRep,
typename TIndexRep >
487 for (
unsigned int r = 0; r < VImageDimension; ++r )
490 for (
unsigned int c = 0; c < VImageDimension; ++c )
492 sum += this->m_IndexToPhysicalPoint(r, c) * index[c];
494 point[r] = sum + this->m_Origin[r];
504 template<
typename TCoordRep >
545 template<
typename TCoordRep >
558 for (
unsigned int i = 0; i < VImageDimension; ++i )
562 for (
unsigned int j = 0; j < VImageDimension; ++j )
564 sum += direction[i][j] * inputGradient[j];
566 outputGradient[i] =
static_cast< TCoordRep
>( sum );
582 template<
typename TCoordRep >
591 const DirectionType & inverseDirection = this->GetInverseDirection();
595 for (
unsigned int i = 0; i < VImageDimension; ++i )
599 for (
unsigned int j = 0; j < VImageDimension; ++j )
601 sum += inverseDirection[i][j] * inputGradient[j];
603 outputGradient[i] =
static_cast< TCoordRep
>( sum );
616 virtual void CopyInformation(
const DataObject *data) ITK_OVERRIDE;
628 virtual void Graft(
const Self *data);
637 virtual void UpdateOutputInformation() ITK_OVERRIDE;
646 virtual
void UpdateOutputData() ITK_OVERRIDE;
651 virtual
void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE;
662 virtual
bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE;
672 virtual
bool VerifyRequestedRegion() ITK_OVERRIDE;
692 virtual
unsigned int GetNumberOfComponentsPerPixel() const;
693 virtual
void SetNumberOfComponentsPerPixel(
unsigned int);
698 ~ImageBase() ITK_OVERRIDE;
699 virtual
void PrintSelf(std::ostream & os,
Indent indent) const ITK_OVERRIDE;
705 void ComputeOffsetTable();
712 virtual
void ComputeIndexToPhysicalPointMatrices();
732 virtual
void InitializeBufferedRegion();
778 virtual void Graft(
const DataObject *data) ITK_OVERRIDE;
789 template <
typename TSpacingValue>
806 #ifndef ITK_MANUAL_INSTANTIATION
807 #include "itkImageBase.hxx"
void SetSize(const SizeType &size)
const IndexValueType * GetIndex() const
virtual void SetRegions(const RegionType ®ion)
const OffsetValueType * GetOffsetTable() const
Index< VImageDimension > IndexType
Represent the offset between two n-dimensional indexes in a n-dimensional image.
static void ComputeOffset(const IndexType &bufferedRegionIndex, const IndexType &index, const OffsetValueType offsetTable[], OffsetValueType &offset)
itk::SizeValueType SizeValueType
Represent the size (bounds) of a n-dimensional image.
RegionType m_BufferedRegion
signed long OffsetValueType
virtual const RegionType & GetLargestPossibleRegion() const
IndexType FastComputeIndex(OffsetValueType offset) const
An image region represents a structured region of data.
RegionType m_RequestedRegion
SpacePrecisionType SpacingValueType
void TransformIndexToPhysicalPoint(const IndexType &index, Point< TCoordRep, VImageDimension > &point) const
static void ComputeIndex(const IndexType &bufferedRegionIndex, OffsetValueType offset, const OffsetValueType offsetTable[], IndexType &index)
Size< VImageDimension > SizeType
Point< PointValueType, VImageDimension > PointType
Matrix< SpacePrecisionType, VImageDimension, VImageDimension > DirectionType
Simulate a standard C array with copy semnatics.
ImageBaseType::DirectionType DirectionType
virtual void SetRegions(const SizeType &size)
unsigned int ImageDimensionType
IndexType ComputeIndex(OffsetValueType offset) const
::itk::IndexValueType IndexValueType
bool TransformPhysicalPointToContinuousIndex(const Point< TCoordRep, VImageDimension > &point, ContinuousIndex< TIndexRep, VImageDimension > &index) const
Get the continuous index from a physical point.
virtual const RegionType & GetBufferedRegion() const
Offset< VImageDimension > OffsetType
ImageBaseType::PointType PointType
SmartPointer< const Self > ConstPointer
Vector< SpacingValueType, VImageDimension > SpacingType
void TransformLocalVectorToPhysicalVector(const FixedArray< TCoordRep, VImageDimension > &inputGradient, FixedArray< TCoordRep, VImageDimension > &outputGradient) const
void CastFrom(const Vector< TCoordRepB, NVectorDimension > &pa)
void TransformPhysicalVectorToLocalVector(const FixedArray< TCoordRep, VImageDimension > &inputGradient, FixedArray< TCoordRep, VImageDimension > &outputGradient) const
SmartPointer< Self > Pointer
SizeType::SizeValueType SizeValueType
OffsetType::OffsetValueType OffsetValueType
void InternalSetSpacing(const TSpacingValue spacing[VImageDimension])
Base class for templated image classes.
A templated class holding a point in n-Dimensional image space.
void TransformContinuousIndexToPhysicalPoint(const ContinuousIndex< TIndexRep, VImageDimension > &index, Point< TCoordRep, VImageDimension > &point) const
virtual const RegionType & GetRequestedRegion() const
Control indentation during Print() invocation.
void InternalSetSpacing(const SpacingValueType spacing[VImageDimension])
OffsetValueType ComputeOffset(const IndexType &ind) const
double SpacePrecisionType
ImageRegion< VImageDimension > RegionType
ValueType * GetDataPointer()
SpacePrecisionType PointValueType
Base class for all data objects in ITK.
IndexType::IndexValueType IndexValueType
RegionType m_LargestPossibleRegion
bool TransformPhysicalPointToIndex(const Point< TCoordRep, VImageDimension > &point, IndexType &index) const