28#ifndef itkImageRegion_h
29#define itkImageRegion_h
42#ifdef ITK_LEGACY_REMOVE
43# define itkRegionOverrideMacro
45# define itkRegionOverrideMacro override
52template <
unsigned int VImageDimension>
79template <
unsigned int VImageDimension>
81#ifndef ITK_LEGACY_REMOVE
90#ifndef ITK_LEGACY_REMOVE
102 static constexpr unsigned int ImageDimension = VImageDimension;
106 static constexpr unsigned int SliceDimension = ImageDimension - (ImageDimension > 1);
109 static constexpr unsigned int
112 return ImageDimension;
177 operator=(
const Self &)
noexcept =
default;
228 GetSize(
unsigned int i)
const
242 GetIndex(
unsigned int i)
const
250 GetUpperIndex()
const;
264 return (m_Index == region.m_Index) && (m_Size == region.m_Size);
267 ITK_UNEQUAL_OPERATOR_MEMBER_FUNCTION(
Self);
273 for (
unsigned int i = 0; i < ImageDimension; ++i)
275 if (index[i] < m_Index[i] || index[i] >= m_Index[i] +
static_cast<IndexValueType>(m_Size[i]))
288 template <
typename TCoordRepType>
292 constexpr TCoordRepType half = 0.5;
293 for (
unsigned int i = 0; i < ImageDimension; ++i)
296 if (!(index[i] >= m_Index[i] - half && index[i] <= (m_Index[i] +
static_cast<IndexValueType>(m_Size[i])) - half))
310 IsInside(
const Self & otherRegion)
const
312 const auto & otherIndex = otherRegion.
m_Index;
313 const auto & otherSize = otherRegion.
m_Size;
316 for (
unsigned int i = 0; i < ImageDimension; ++i)
318 if (otherIndex[i] < m_Index[i] || otherSize[i] == 0 ||
331 GetNumberOfPixels()
const;
343 PadByRadius(
const SizeType & radius);
356 ShrinkByRadius(
const SizeType & radius);
363 Crop(
const Self & region);
369 Slice(
const unsigned int dim)
const;
373 template <
size_t VTupleIndex>
377 if constexpr (VTupleIndex == 0)
383 static_assert(VTupleIndex == 1);
390 template <
size_t VTupleIndex>
391 [[nodiscard]]
const auto &
394 if constexpr (VTupleIndex == 0)
400 static_assert(VTupleIndex == 1);
424template <
unsigned int VImageDimension>
428template <
unsigned int VImageDimension>
436#if defined(__clang__) && defined(__apple_build_version__) && (__clang_major__ <= 10)
437# pragma clang diagnostic push
440# pragma clang diagnostic ignored "-Wmismatched-tags"
454template <
unsigned int VImageDimension>
455struct tuple_size<
itk::
ImageRegion<VImageDimension>> : integral_constant<size_t, 2>
459template <
size_t VTupleIndex,
unsigned int VImageDimension>
460struct tuple_element<VTupleIndex,
itk::
ImageRegion<VImageDimension>>
461 : conditional<VTupleIndex == 0, itk::Index<VImageDimension>, itk::Size<VImageDimension>>
463 static_assert(VTupleIndex < tuple_size_v<itk::ImageRegion<VImageDimension>>);
468#if defined(__clang__) && defined(__apple_build_version__) && (__clang_major__ <= 10)
469# pragma clang diagnostic pop
473#undef itkRegionOverrideMacro
475#ifndef ITK_MANUAL_INSTANTIATION
476# include "itkImageRegion.hxx"
A templated class holding a point in n-Dimensional image space.
An image region represents a structured region of data.
typename IndexType::OffsetType OffsetType
typename IndexType::IndexValueType IndexValueType
OffsetValueType[ImageDimension+1] OffsetTableType
IndexValueType[ImageDimension] IndexValueArrayType
typename OffsetType::OffsetValueType OffsetValueType
typename SizeType::SizeValueType SizeValueType
Control indentation during Print() invocation.
A region represents some portion or piece of data.
const char * GetNameOfClass() const override
BinaryGeneratorImageFilter< TInputImage1, TInputImage2, TOutputImage > Superclass
#define itkRegionOverrideMacro
ImageBaseType::SizeType SizeType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
ImageRegion(const Index< VImageDimension > &, const Size< VImageDimension > &) -> ImageRegion< VImageDimension >
bool operator==(const Index< VDimension > &one, const Index< VDimension > &two)
class ITK_TEMPLATE_EXPORT ImageBase
unsigned long SizeValueType