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"
54 template<
unsigned int NImageDimension,
unsigned int R,
unsigned int C,
typename TPo
intValue,
typename TMatrixValue >
114 template<
unsigned int VImageDimension = 2 >
137 itkStaticConstMacro(ImageDimension, ImageDimensionType, VImageDimension);
173 virtual void Initialize() ITK_OVERRIDE;
176 static
unsigned int GetImageDimension()
177 {
return VImageDimension; }
183 itkSetMacro(Origin, PointType);
184 virtual void SetOrigin(
const double origin[VImageDimension]);
185 virtual void SetOrigin(
const float origin[VImageDimension]);
213 virtual void SetDirection(
const DirectionType & direction);
218 itkGetConstReferenceMacro(Direction, DirectionType);
223 itkGetConstReferenceMacro(InverseDirection, DirectionType);
229 itkGetConstReferenceMacro(Spacing, SpacingType);
235 itkGetConstReferenceMacro(Origin, PointType);
244 virtual void Allocate(
bool initialize=
false);
252 virtual void SetLargestPossibleRegion(
const RegionType & region);
261 {
return m_LargestPossibleRegion; }
266 virtual void SetBufferedRegion(
const RegionType & region);
272 {
return m_BufferedRegion; }
281 virtual void SetRequestedRegion(
const RegionType & region);
290 virtual void SetRequestedRegion(
const DataObject *data ) ITK_OVERRIDE;
297 {
return m_RequestedRegion; }
304 this->SetLargestPossibleRegion(region);
305 this->SetBufferedRegion(region);
306 this->SetRequestedRegion(region);
314 this->SetLargestPossibleRegion(region);
315 this->SetBufferedRegion(region);
316 this->SetRequestedRegion(region);
409 virtual void SetSpacing(
const SpacingType & spacing);
410 virtual void SetSpacing(
const double spacing[VImageDimension]);
411 virtual void SetSpacing(
const float spacing[VImageDimension]);
418 template<
typename TCoordRep >
427 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
456 template<
typename TCoordRep,
typename TIndexRep >
463 for (
unsigned int k = 0; k < VImageDimension; ++k )
465 cvector[k] = point[k] - this->m_Origin[k];
467 cvector = m_PhysicalPointToIndex * cvector;
468 for (
unsigned int i = 0; i < VImageDimension; ++i )
470 index[i] =
static_cast< TIndexRep
>( cvector[i] );
474 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
483 template<
typename TCoordRep,
typename TIndexRep >
488 for (
unsigned int r = 0; r < VImageDimension; ++r )
491 for (
unsigned int c = 0; c < VImageDimension; ++c )
493 sum += this->m_IndexToPhysicalPoint(r, c) * index[c];
495 point[r] = sum + this->m_Origin[r];
505 template<
typename TCoordRep >
543 template<
typename TCoordRep >
554 for (
unsigned int i = 0; i < VImageDimension; ++i )
558 for (
unsigned int j = 0; j < VImageDimension; ++j )
560 sum += direction[i][j] * inputGradient[j];
562 outputGradient[i] =
static_cast< TCoordRep
>( sum );
574 template<
typename TCoordRep >
583 const DirectionType & inverseDirection = this->GetInverseDirection();
585 for (
unsigned int i = 0; i < VImageDimension; ++i )
589 for (
unsigned int j = 0; j < VImageDimension; ++j )
591 sum += inverseDirection[i][j] * inputGradient[j];
593 outputGradient[i] =
static_cast< TCoordRep
>( sum );
606 virtual void CopyInformation(
const DataObject *data) ITK_OVERRIDE;
618 virtual void Graft(
const Self *data);
627 virtual void UpdateOutputInformation() ITK_OVERRIDE;
636 virtual
void UpdateOutputData() ITK_OVERRIDE;
641 virtual
void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE;
652 virtual
bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE;
662 virtual
bool VerifyRequestedRegion() ITK_OVERRIDE;
682 virtual
unsigned int GetNumberOfComponentsPerPixel() const;
683 virtual
void SetNumberOfComponentsPerPixel(
unsigned int);
689 virtual
void PrintSelf(std::ostream & os,
Indent indent) const ITK_OVERRIDE;
695 void ComputeOffsetTable();
702 virtual
void ComputeIndexToPhysicalPointMatrices();
722 virtual
void InitializeBufferedRegion();
768 virtual void Graft(
const DataObject *data) ITK_OVERRIDE;
779 template <
typename TSpacingValue>
796 #ifndef ITK_MANUAL_INSTANTIATION
797 #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.
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
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
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