#include <itkImageIORegion.h>


Public Types | |
| typedef ImageIORegion | Self |
| typedef Region | Superclass |
| typedef vcl_size_t | SizeValueType |
| typedef ptrdiff_t | IndexValueType |
| typedef ptrdiff_t | OffsetValueType |
| typedef std::vector < IndexValueType > | IndexType |
| typedef std::vector < SizeValueType > | SizeType |
| typedef Superclass::RegionType | RegionType |
Public Member Functions | |
| virtual const char * | GetNameOfClass () const |
| unsigned int | GetImageDimension () const |
| unsigned int | GetRegionDimension () const |
| virtual RegionType | GetRegionType () const |
| ImageIORegion (unsigned int dimension) | |
| ImageIORegion () | |
| virtual | ~ImageIORegion () |
| ImageIORegion (const Self ®ion) | |
| void | operator= (const Self ®ion) |
| void | SetIndex (const IndexType &index) |
| const IndexType & | GetIndex () const |
| void | SetSize (const SizeType &size) |
| const SizeType & | GetSize () const |
| SizeValueType | GetSize (unsigned long i) const |
| IndexValueType | GetIndex (unsigned long i) const |
| void | SetSize (const unsigned long i, SizeValueType size) |
| void | SetIndex (const unsigned long i, IndexValueType idx) |
| bool | operator== (const Self ®ion) const |
| bool | operator!= (const Self ®ion) const |
| bool | IsInside (const IndexType &index) const |
| bool | IsInside (const Self ®ion) const |
| SizeValueType | GetNumberOfPixels (void) const |
| virtual void | Print (std::ostream &os, Indent indent=0) const |
Protected Member Functions | |
| virtual void | PrintSelf (std::ostream &os, Indent indent) const |
| virtual void | PrintHeader (std::ostream &os, Indent indent) const |
| virtual void | PrintTrailer (std::ostream &os, Indent indent) const |
Private Attributes | |
| unsigned int | m_ImageDimension |
| IndexType | m_Index |
| SizeType | m_Size |
ImageIORegion is an class that represents some structured portion or piece of an Image. The ImageIORegion is represented with an index and a size in each of the n-dimensions of the image. (The index is the corner of the image, the size is the lengths of the image in each of the topological directions.) ImageIORegion is not templated over dimension, but uses dynamic arrays instead.
The first pixel of an image always have a Zero index. Therefore the index values of ImageIORegion may not directly correspond to those of ImageRegion. When translation between the two is performed one much consider the largest possible region who has a non-zero starting index for the image.
Definition at line 53 of file itkImageIORegion.h.
Standard class typedefs.
Reimplemented from itk::Region.
Definition at line 57 of file itkImageIORegion.h.
| typedef vcl_size_t itk::ImageIORegion::SizeValueType |
these types correspond to those of itk::Size, itk::Offset and itk::Index
Definition at line 61 of file itkImageIORegion.h.
| typedef std::vector<IndexValueType> itk::ImageIORegion::IndexType |
Index typedef support. An index is used to access pixel values.
Definition at line 67 of file itkImageIORegion.h.
| typedef std::vector<SizeValueType> itk::ImageIORegion::SizeType |
Size typedef support. A size is used to define region bounds.
Definition at line 70 of file itkImageIORegion.h.
Region type taken from the superclass
Reimplemented from itk::Region.
Definition at line 73 of file itkImageIORegion.h.
| itk::ImageIORegion::ImageIORegion | ( | unsigned int | dimension | ) |
Constructor. ImageIORegion is a lightweight object that is not reference counted, so the constructor is public.
Definition at line 44 of file itkImageIORegion.cxx.
00045 { 00046 m_ImageDimension = dimension; 00047 m_Index.resize(m_ImageDimension); 00048 m_Size.resize(m_ImageDimension); 00049 std::fill(m_Index.begin(), m_Index.end(), 0); 00050 std::fill(m_Size.begin(), m_Size.end(), 0); 00051 }
| itk::ImageIORegion::ImageIORegion | ( | ) |
Constructor. ImageIORegion is a lightweight object that is not reference counted, so the constructor is public. Default dimension is 2.
Definition at line 27 of file itkImageIORegion.cxx.
00028 { 00029 m_ImageDimension = 2; 00030 m_Index.resize(2); 00031 m_Size.resize(2); 00032 std::fill(m_Index.begin(), m_Index.end(), 0); 00033 std::fill(m_Size.begin(), m_Size.end(), 0); 00034 }
| itk::ImageIORegion::~ImageIORegion | ( | ) | [virtual] |
Destructor. ImageIORegion is a lightweight object that is not reference counted, so the destructor is public.
Definition at line 38 of file itkImageIORegion.cxx.
| itk::ImageIORegion::ImageIORegion | ( | const Self & | region | ) |
Copy constructor. ImageIORegion is a lightweight object that is not reference counted, so the copy constructor is public.
Definition at line 55 of file itkImageIORegion.cxx.
00055 : Region() 00056 { 00057 m_Index =region.m_Index; 00058 m_Size = region.m_Size; 00059 m_ImageDimension = region.m_ImageDimension; 00060 }
| virtual const char* itk::ImageIORegion::GetNameOfClass | ( | ) | const [virtual] |
Standard part of all itk objects.
Reimplemented from itk::Region.
| unsigned int itk::ImageIORegion::GetImageDimension | ( | ) | const |
Dimension of the image available at run time.
Definition at line 118 of file itkImageIORegion.cxx.
Referenced by itk::ImageIOBase::GenerateStreamableReadRegionFromRequestedRegion(), itk::ImageIOBase::GetActualNumberOfSplitsForWritingCanStreamWrite(), itk::ImageIOBase::GetSplitRegionForWritingCanStreamWrite(), and itk::MetaImageIO::Read().
| unsigned int itk::ImageIORegion::GetRegionDimension | ( | ) | const |
Dimension of the region to be written. This differs from the the image dimension and is calculated at run-time by examining the size of the image in each coordinate direction.
Definition at line 133 of file itkImageIORegion.cxx.
00134 { 00135 unsigned int dim=0; 00136 for (unsigned int i=0; i<m_ImageDimension; i++) 00137 { 00138 if ( m_Size[i] > 1 ) dim++; 00139 } 00140 return dim; 00141 }
| ImageIORegion::RegionType itk::ImageIORegion::GetRegionType | ( | ) | const [virtual] |
Return the region type. Images are described with structured regions.
Implements itk::Region.
Definition at line 126 of file itkImageIORegion.cxx.
| void itk::ImageIORegion::operator= | ( | const Self & | region | ) |
operator=. ImageIORegion is a lightweight object that is not reference counted, so operator= is public.
Definition at line 65 of file itkImageIORegion.cxx.
00066 { 00067 m_Index = region.m_Index; 00068 m_Size = region.m_Size; 00069 m_ImageDimension = region.m_ImageDimension; 00070 }
| void itk::ImageIORegion::SetIndex | ( | const IndexType & | index | ) |
Set the index defining the corner of the region.
Definition at line 83 of file itkImageIORegion.cxx.
Referenced by otb::ImageFileReader< TOutputImage >::GenerateData(), itk::MetaImageIO::GenerateStreamableReadRegionFromRequestedRegion(), itk::ImageIOBase::GenerateStreamableReadRegionFromRequestedRegion(), itk::ImageIOBase::GetSplitRegionForWritingCanStreamWrite(), itk::MetaImageIO::Read(), otb::StreamingImageFileWriter< TInputImage >::UpdateOutputData(), and itk::MetaImageIO::Write().
| const ImageIORegion::IndexType & itk::ImageIORegion::GetIndex | ( | void | ) | const |
Get index defining the corner of the region.
Definition at line 92 of file itkImageIORegion.cxx.
Referenced by itk::ImageFileReader< TOutputImage, ConvertPixelTraits >::EnlargeOutputRequestedRegion(), otb::ImageFileReader< TOutputImage >::GenerateData(), itk::ImageIOBase::GetSplitRegionForWritingCanStreamWrite(), otb::TileMapImageIO::Read(), itk::NiftiImageIO::Read(), itk::MetaImageIO::Read(), itk::ImageFileWriter< TInputImage >::Write(), otb::TileMapImageIO::Write(), and itk::MetaImageIO::Write().
| void itk::ImageIORegion::SetSize | ( | const SizeType & | size | ) |
Set the size of the region. This plus the index determines the rectangular shape, or extent, of the region.
Definition at line 102 of file itkImageIORegion.cxx.
Referenced by otb::ImageFileReader< TOutputImage >::GenerateData(), itk::MetaImageIO::GenerateStreamableReadRegionFromRequestedRegion(), itk::ImageIOBase::GenerateStreamableReadRegionFromRequestedRegion(), itk::ImageIOBase::GetSplitRegionForWritingCanStreamWrite(), itk::MetaImageIO::Read(), otb::StreamingImageFileWriter< TInputImage >::UpdateOutputData(), and itk::MetaImageIO::Write().
| const ImageIORegion::SizeType & itk::ImageIORegion::GetSize | ( | void | ) | const |
Get the size of the region.
Definition at line 110 of file itkImageIORegion.cxx.
Referenced by otb::ImageFileReader< TOutputImage >::GenerateData(), itk::ImageIOBase::GetActualNumberOfSplitsForWritingCanStreamWrite(), itk::ImageIOBase::GetSplitRegionForWritingCanStreamWrite(), otb::TileMapImageIO::Read(), itk::NiftiImageIO::Read(), itk::MetaImageIO::Read(), itk::MetaImageIO::Write(), and otb::TileMapImageIO::Write().
| ImageIORegion::SizeValueType itk::ImageIORegion::GetSize | ( | unsigned long | i | ) | const |
Convenience methods to get the size of the image in a particular coordinate direction i. Do not try to access image sizes beyond the the ImageDimension.
Definition at line 146 of file itkImageIORegion.cxx.
00147 { 00148 if( i >= m_Size.size() ) 00149 { 00150 itkExceptionMacro("Invalid index in GetSize()"); 00151 } 00152 return m_Size[i]; 00153 }
| bool itk::ImageIORegion::operator== | ( | const Self & | region | ) | const |
Compare two regions.
Definition at line 256 of file itkImageIORegion.cxx.
00257 { 00258 bool same; 00259 same = (m_Index == region.m_Index); 00260 same = same && (m_Size == region.m_Size); 00261 same = same && (m_ImageDimension == region.m_ImageDimension); 00262 return same; 00263 }
| bool itk::ImageIORegion::operator!= | ( | const Self & | region | ) | const |
Compare two regions.
Definition at line 268 of file itkImageIORegion.cxx.
00269 { 00270 bool same; 00271 same = (m_Index == region.m_Index); 00272 same = same && (m_Size == region.m_Size); 00273 same = same && (m_ImageDimension == region.m_ImageDimension); 00274 return !same; 00275 }
| bool itk::ImageIORegion::IsInside | ( | const IndexType & | index | ) | const |
Test if an index is inside
Definition at line 194 of file itkImageIORegion.cxx.
Referenced by itk::ImageFileWriter< TInputImage >::Write().
00195 { 00196 if (m_ImageDimension != index.size()) 00197 { 00198 return false; 00199 } 00200 for(unsigned int i=0; i<m_ImageDimension; i++) 00201 { 00202 if( index[i] < m_Index[i] ) 00203 { 00204 return false; 00205 } 00206 if( static_cast<SizeValueType>(index[i]-m_Index[i]) >= m_Size[i] ) 00207 { 00208 return false; 00209 } 00210 } 00211 return true; 00212 }
| bool itk::ImageIORegion::IsInside | ( | const Self & | region | ) | const |
Test if a region (the argument) is completly inside of this region
Definition at line 217 of file itkImageIORegion.cxx.
00218 { 00219 IndexType beginCorner = region.GetIndex(); 00220 if( ! this->IsInside( beginCorner ) ) 00221 { 00222 return false; 00223 } 00224 IndexType endCorner(region.m_ImageDimension); 00225 SizeType size = region.GetSize(); 00226 for(unsigned int i=0; i<m_ImageDimension; i++) 00227 { 00228 endCorner[i] = beginCorner[i] + size[i] - 1; 00229 } 00230 if( ! this->IsInside( endCorner ) ) 00231 { 00232 return false; 00233 } 00234 return true; 00235 }
| ImageIORegion::SizeValueType itk::ImageIORegion::GetNumberOfPixels | ( | void | ) | const |
Get the number of pixels contained in this region. This just multiplies the size components.
Definition at line 241 of file itkImageIORegion.cxx.
Referenced by itk::MetaImageIO::Read().
00242 { 00243 size_t numPixels=1; 00244 00245 for ( unsigned int d = 0; d < this->GetImageDimension(); ++d ) 00246 { 00247 numPixels *= m_Size[d]; 00248 } 00249 00250 return numPixels; 00251 }
| void itk::ImageIORegion::PrintSelf | ( | std::ostream & | os, | |
| Indent | indent | |||
| ) | const [protected, virtual] |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::Region.
Definition at line 280 of file itkImageIORegion.cxx.
00281 { 00282 Superclass::PrintSelf(os, indent); 00283 00284 os << indent << "Dimension: " << this->GetImageDimension() << std::endl; 00285 os << indent << "Index: "; 00286 for(ImageIORegion::IndexType::const_iterator i = this->GetIndex().begin(); 00287 i != this->GetIndex().end(); ++i) 00288 { 00289 os << *i << " "; 00290 } 00291 os << std::endl; 00292 os << indent << "Size: "; 00293 for(ImageIORegion::SizeType::const_iterator k = this->GetSize().begin(); 00294 k != this->GetSize().end(); ++k) 00295 { 00296 os << *k << " "; 00297 } 00298 os << std::endl; 00299 }
| void itk::Region::Print | ( | std::ostream & | os, | |
| Indent | indent = 0 | |||
| ) | const [virtual, inherited] |
Print the region.
Definition at line 27 of file itkRegion.cxx.
References itk::Indent::GetNextIndent().
Referenced by itk::ImageIOBase::PrintSelf().
00028 { 00029 this->PrintHeader(os,indent); 00030 this->PrintSelf(os, indent.GetNextIndent()); 00031 this->PrintTrailer(os,indent); 00032 }