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);
175 static
unsigned int GetImageDimension()
176 {
return VImageDimension; }
182 itkSetMacro(Origin, PointType);
183 virtual void SetOrigin(
const double origin[VImageDimension]);
184 virtual void SetOrigin(
const float origin[VImageDimension]);
212 virtual void SetDirection(
const DirectionType & direction);
217 itkGetConstReferenceMacro(Direction, DirectionType);
222 itkGetConstReferenceMacro(InverseDirection, DirectionType);
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; }
296 {
return m_RequestedRegion; }
303 this->SetLargestPossibleRegion(region);
304 this->SetBufferedRegion(region);
313 this->SetLargestPossibleRegion(region);
314 this->SetBufferedRegion(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 >
542 template<
typename TCoordRep >
553 for (
unsigned int i = 0; i < VImageDimension; ++i )
557 for (
unsigned int j = 0; j < VImageDimension; ++j )
559 sum += direction[i][j] * inputGradient[j];
561 outputGradient[i] =
static_cast< TCoordRep
>( sum );
573 template<
typename TCoordRep >
582 const DirectionType & inverseDirection = this->GetInverseDirection();
584 for (
unsigned int i = 0; i < VImageDimension; ++i )
588 for (
unsigned int j = 0; j < VImageDimension; ++j )
590 sum += inverseDirection[i][j] * inputGradient[j];
592 outputGradient[i] =
static_cast< TCoordRep
>( sum );
617 virtual void Graft(
const Self *data);
681 virtual
unsigned int GetNumberOfComponentsPerPixel() const;
682 virtual
void SetNumberOfComponentsPerPixel(
unsigned int);
688 virtual
void PrintSelf(std::ostream & os,
Indent indent) const ITK_OVERRIDE;
694 void ComputeOffsetTable();
701 virtual
void ComputeIndexToPhysicalPointMatrices();
721 virtual
void InitializeBufferedRegion();
778 template <
typename TSpacingValue>
795 #ifndef ITK_MANUAL_INSTANTIATION
796 #include "itkImageBase.hxx"
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
virtual void CopyInformation(const DataObject *)
void SetSize(const SizeType &size)
const IndexValueType * GetIndex() const
virtual void SetRegions(const RegionType ®ion)
virtual void PrintSelf(std::ostream &os, Indent indent) const override
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
virtual void Initialize()
Represent the size (bounds) of a n-dimensional image.
RegionType m_BufferedRegion
signed long OffsetValueType
virtual const RegionType & GetLargestPossibleRegion() const
virtual void UpdateOutputInformation()
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
virtual void SetRequestedRegion(const DataObject *)
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
virtual bool VerifyRequestedRegion()
SmartPointer< const Self > ConstPointer
virtual void SetRequestedRegionToLargestPossibleRegion()
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
Base class for all data objects in ITK.
virtual void Graft(const DataObject *)
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
IndexType::IndexValueType IndexValueType
RegionType m_LargestPossibleRegion
bool TransformPhysicalPointToIndex(const Point< TCoordRep, VImageDimension > &point, IndexType &index) const
virtual void UpdateOutputData()