41#include <vxl_version.h>
42#include "vnl/vnl_matrix_fixed.hxx"
113template <
unsigned int VImageDimension = 2>
178 static constexpr unsigned int
181 return VImageDimension;
260 return this->Allocate(
true);
281 return m_LargestPossibleRegion;
296 return m_BufferedRegion;
326 return m_RequestedRegion;
335 this->SetLargestPossibleRegion(region);
336 this->SetBufferedRegion(region);
337 this->SetRequestedRegion(region);
347 this->Self::SetRegions(region);
363 return m_OffsetTable;
379 this->GetBufferedRegion().GetIndex(), ind, m_OffsetTable, offset);
463 template <
typename TCoordRep>
470 for (
unsigned int i = 0; i < VImageDimension; ++i)
473 for (
unsigned int j = 0; j < VImageDimension; ++j)
475 sum += this->m_PhysicalPointToIndex[i][j] * (
point[j] - this->m_Origin[j]);
477 index[i] = Math::RoundHalfIntegerUp<IndexValueType>(sum);
490 template <
typename TCoordRep>
491 ITK_NODISCARD(
"Call the overload which has the point as the only parameter and returns the index")
492 bool TransformPhysicalPointToIndex(const
Point<TCoordRep, VImageDimension> &
point,
IndexType & index)
const
494 index = TransformPhysicalPointToIndex(
point);
497 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
516 template <
typename TIndexRep,
typename TCoordRep>
523 for (
unsigned int k = 0; k < VImageDimension; ++k)
525 cvector[k] =
point[k] - this->m_Origin[k];
527 cvector = m_PhysicalPointToIndex * cvector;
528 for (
unsigned int i = 0; i < VImageDimension; ++i)
530 index[i] =
static_cast<TIndexRep
>(cvector[i]);
543 template <
typename TCoordRep,
typename TIndexRep>
544 ITK_NODISCARD(
"Call the overload which has the point as the only parameter and returns the index")
545 bool TransformPhysicalPointToContinuousIndex(const
Point<TCoordRep, VImageDimension> &
point,
548 index = TransformPhysicalPointToContinuousIndex<TIndexRep>(
point);
551 const bool isInside = this->GetLargestPossibleRegion().IsInside(index);
559 template <
typename TCoordRep,
typename TIndexRep>
564 for (
unsigned int r = 0; r < VImageDimension; ++r)
567 for (
unsigned int c = 0; c < VImageDimension; ++c)
569 sum += this->m_IndexToPhysicalPoint(r, c) * index[c];
571 point[r] = sum + this->m_Origin[r];
580 template <
typename TCoordRep,
typename TIndexRep>
585 TransformContinuousIndexToPhysicalPoint(index,
point);
595 template <
typename TCoordRep>
599 for (
unsigned int i = 0; i < VImageDimension; ++i)
601 point[i] = this->m_Origin[i];
602 for (
unsigned int j = 0; j < VImageDimension; ++j)
604 point[i] += m_IndexToPhysicalPoint[i][j] * index[j];
615 template <
typename TCoordRep>
620 TransformIndexToPhysicalPoint(index,
point);
639 template <
typename TCoordRep>
648 for (
unsigned int i = 0; i < VImageDimension; ++i)
652 for (
unsigned int j = 0; j < VImageDimension; ++j)
654 sum += direction[i][j] * inputGradient[j];
656 outputGradient[i] =
static_cast<TCoordRep
>(sum);
666 template <
typename TVector>
667 [[nodiscard]] TVector
670 TVector outputGradient;
671 TransformLocalVectorToPhysicalVector(inputGradient, outputGradient);
672 return outputGradient;
689 template <
typename TCoordRep>
694 const DirectionType & inverseDirection = this->GetInverseDirection();
698 for (
unsigned int i = 0; i < VImageDimension; ++i)
702 for (
unsigned int j = 0; j < VImageDimension; ++j)
704 sum += inverseDirection[i][j] * inputGradient[j];
706 outputGradient[i] =
static_cast<TCoordRep
>(sum);
716 template <
typename TVector>
717 [[nodiscard]] TVector
720 TVector outputGradient;
721 TransformPhysicalVectorToLocalVector(inputGradient, outputGradient);
722 return outputGradient;
901 Self::GetBufferedRegion().GetIndex(), ind, m_OffsetTable, offset);
939#ifndef ITK_MANUAL_INSTANTIATION
940# include "itkImageBase.hxx"
A templated class holding a point in n-Dimensional image space.
Base class for all data objects in ITK.
Simulate a standard C array with copy semantics.
ValueType * GetDataPointer()
Base class for templated image classes.
IndexType FastComputeIndex(OffsetValueType offset) const
virtual void SetRequestedRegion(const RegionType ®ion)
IndexType ComputeIndex(OffsetValueType offset) const
virtual void InitializeBufferedRegion()
void SetRequestedRegionToLargestPossibleRegion() override
bool VerifyRequestedRegion() override
SpacePrecisionType SpacingValueType
void TransformContinuousIndexToPhysicalPoint(const ContinuousIndex< TIndexRep, VImageDimension > &index, Point< TCoordRep, VImageDimension > &point) const
TVector TransformPhysicalVectorToLocalVector(const TVector &inputGradient) const
virtual void SetDirection(const DirectionType &direction)
bool IsSameImageGeometryAs(const ImageBase *otherImage, double coordinateTolerance=DefaultImageCoordinateTolerance, double directionTolerance=DefaultImageDirectionTolerance) const
void AllocateInitialized()
unsigned int ImageDimensionType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual const RegionType & GetBufferedRegion() const
bool RequestedRegionIsOutsideOfTheBufferedRegion() override
virtual void SetRegions(const SizeType &size)
virtual void SetBufferedRegion(const RegionType ®ion)
ContinuousIndex< TIndexRep, VImageDimension > TransformPhysicalPointToContinuousIndex(const Point< TCoordRep, VImageDimension > &point) const
Returns the continuous index from a physical point.
virtual void SetSpacing(const SpacingType &spacing)
void UpdateOutputData() override
virtual void SetNumberOfComponentsPerPixel(unsigned int)
OffsetValueType FastComputeOffset(const IndexType &ind) const
virtual void Allocate(bool initialize=false)
TVector TransformLocalVectorToPhysicalVector(const TVector &inputGradient) const
virtual void SetOrigin(const float origin[VImageDimension])
void TransformLocalVectorToPhysicalVector(const FixedArray< TCoordRep, VImageDimension > &inputGradient, FixedArray< TCoordRep, VImageDimension > &outputGradient) const
typename OffsetType::OffsetValueType OffsetValueType
typename IndexType::IndexValueType IndexValueType
void UpdateOutputInformation() override
virtual void Graft(const Self *image)
void TransformIndexToPhysicalPoint(const IndexType &index, Point< TCoordRep, VImageDimension > &point) const
virtual unsigned int GetNumberOfComponentsPerPixel() const
virtual void SetSpacing(const float spacing[VImageDimension])
void TransformPhysicalVectorToLocalVector(const FixedArray< TCoordRep, VImageDimension > &inputGradient, FixedArray< TCoordRep, VImageDimension > &outputGradient) const
const OffsetValueType * GetOffsetTable() const
virtual const RegionType & GetRequestedRegion() const
virtual void ComputeIndexToPhysicalPointMatrices()
Point< TCoordRep, VImageDimension > TransformContinuousIndexToPhysicalPoint(const ContinuousIndex< TIndexRep, VImageDimension > &index) const
void SetRequestedRegion(const DataObject *data) override
OffsetValueType ComputeOffset(const IndexType &ind) const
virtual void SetRegions(const RegionType ®ion)
SpacePrecisionType PointValueType
void CopyInformation(const DataObject *data) override
virtual void SetOrigin(const double origin[VImageDimension])
virtual void SetSpacing(const double spacing[VImageDimension])
virtual void SetLargestPossibleRegion(const RegionType ®ion)
virtual const RegionType & GetLargestPossibleRegion() const
Point< TCoordRep, VImageDimension > TransformIndexToPhysicalPoint(const IndexType &index) const
void ComputeOffsetTable()
~ImageBase() override=default
IndexType TransformPhysicalPointToIndex(const Point< TCoordRep, VImageDimension > &point) const
void Initialize() override
bool IsCongruentImageGeometry(const ImageBase *otherImage, double coordinateTolerance, double directionTolerance) const
typename SizeType::SizeValueType SizeValueType
void Graft(const DataObject *data) override
static constexpr unsigned int GetImageDimension()
static void ComputeIndex(const IndexType &bufferedRegionIndex, OffsetValueType offset, const OffsetValueType offsetTable[], IndexType &index)
static void ComputeOffset(const IndexType &bufferedRegionIndex, const IndexType &index, const OffsetValueType offsetTable[], OffsetValueType &offset)
An image region represents a structured region of data.
void SetSize(const SizeType &size)
Control indentation during Print() invocation.
Base class for most ITK classes.
ImageBaseType::IndexType IndexType
static constexpr double e
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
constexpr double DefaultImageDirectionTolerance
class ITK_FORWARD_EXPORT DataObject
constexpr double DefaultImageCoordinateTolerance
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
double SpacePrecisionType
class ITK_TEMPLATE_EXPORT ImageBase
unsigned long SizeValueType
const IndexValueType * GetIndex() const
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.