28 #ifndef itkImageRegion_h
29 #define itkImageRegion_h
41 template<
unsigned int VImageDimension >
68 template<
unsigned int VImageDimension >
80 itkStaticConstMacro(ImageDimension,
unsigned int, VImageDimension);
84 itkStaticConstMacro( SliceDimension,
unsigned int,
85 ( ImageDimension - ( ImageDimension > 1 ) ) );
89 {
return ImageDimension; }
108 {
return Superclass::ITK_STRUCTURED_REGION; }
125 { m_Index = index; m_Size = size; }
131 { m_Size = size; m_Index.
Fill(0); }
136 { m_Index = region.m_Index;m_Size = region.m_Size; }
162 {
return m_Size[i]; }
168 { m_Index[i] = sze; }
170 {
return m_Index[i]; }
177 void SetUpperIndex(
const IndexType & idx );
180 void ComputeOffsetTable(OffsetTableType offsetTable)
const;
186 bool same = ( m_Index == region.m_Index );
187 same = same && ( m_Size == region.m_Size );
196 bool same = ( m_Index == region.m_Index );
197 same = same && ( m_Size == region.m_Size );
206 for (
unsigned int i = 0; i < ImageDimension; i++ )
208 if ( index[i] < m_Index[i] )
212 if ( index[i] >= ( m_Index[i] + static_cast< IndexValueType >( m_Size[i] ) ) )
225 template<
typename TCoordRepType >
229 for (
unsigned int i = 0; i < ImageDimension; i++ )
231 if ( Math::RoundHalfIntegerUp< IndexValueType >(index[i]) < static_cast< IndexValueType >( m_Index[i] ) )
236 const TCoordRepType bound =
static_cast< TCoordRepType
>(
237 m_Index[i] + m_Size[i] - 0.5 );
246 if ( ! (index[i] <= bound) )
261 IndexType beginCorner = region.GetIndex();
263 if ( !this->IsInside(beginCorner) )
268 const SizeType & size = region.GetSize();
269 for (
unsigned int i = 0; i < ImageDimension; i++ )
271 endCorner[i] = beginCorner[i] +
static_cast< OffsetValueType >( size[i] ) - 1;
273 if ( !this->IsInside(endCorner) )
289 void PadByRadius(
const IndexValueArrayType radius);
291 void PadByRadius(
const SizeType & radius);
299 bool ShrinkByRadius(
const IndexValueArrayType radius);
301 bool ShrinkByRadius(
const SizeType & radius);
307 bool Crop(
const Self & region);
312 SliceRegion Slice(
const unsigned int dim)
const;
319 virtual void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
329 template<
unsigned int VImageDimension >
330 std::ostream & operator<<(std::ostream & os, const ImageRegion< VImageDimension > & region);
333 #ifndef ITK_MANUAL_INSTANTIATION
334 #include "itkImageRegion.hxx"
void SetSize(const SizeType &size)
IndexValueType GetIndex(unsigned int i) const
const IndexType & GetIndex() const
Represent the offset between two n-dimensional indexes in a n-dimensional image.
Size< itkGetStaticConstMacro(ImageDimension) > SizeType
itk::SizeValueType SizeValueType
signed long OffsetValueType
bool IsInside(const IndexType &index) const
Index< itkGetStaticConstMacro(ImageDimension) > IndexType
An image region represents a structured region of data.
bool operator==(const Self ®ion) const
static unsigned int GetImageDimension()
OffsetType::OffsetValueType OffsetValueType
unsigned long SizeValueType
SizeValueType GetSize(unsigned int i) const
virtual Superclass::RegionType GetRegionType() const override
ImageRegion< itkGetStaticConstMacro(SliceDimension) > SliceRegion
ImageRegion(const SizeType &size)
::itk::IndexValueType IndexValueType
IndexType & GetModifiableIndex()
SizeType & GetModifiableSize()
IndexType::IndexValueType IndexValueType
void SetSize(unsigned int i, SizeValueType sze)
const SizeType & GetSize() const
A region represents some portion or piece of data.
SizeType::SizeValueType SizeValueType
class ITK_TEMPLATE_EXPORT ImageBase
IndexType::OffsetType OffsetType
void operator=(const Self ®ion)
bool operator!=(const Self ®ion) const
bool IsInside(const Self ®ion) const
Base class for templated image classes.
A templated class holding a point in n-Dimensional image space.
Control indentation during Print() invocation.
ImageBaseType::SizeType SizeType
void SetIndex(unsigned int i, IndexValueType sze)
itk::OffsetValueType OffsetValueType
void SetIndex(const IndexType &index)
void Fill(SizeValueType value)
ImageRegion(const IndexType &index, const SizeType &size)
bool IsInside(const ContinuousIndex< TCoordRepType, VImageDimension > &index) const
ImageBaseType::IndexType IndexType