KWStyle - itkImageRegionSplitter.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkImageRegionSplitter.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:39 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkImageRegionSplitter_h
18 #define __itkImageRegionSplitter_h
19
20 #include "itkObject.h"
21 #include "itkRegion.h"
22 #include "itkImageRegion.h"
23 #include "itkObjectFactory.h"
24 #include "itkIndex.h"
25 #include "itkSize.h"
26
27 namespace itk
28 {
29
30 /** \class ImageRegionSplitter
31  * \brief Divide a region into several pieces.
32  *
33  * ImageRegionSplitter divides an ImageRegion into smaller regions.
34  * ImageRegionSplitter is used by the StreamingImageFilter to divide a
35  * requested output region into a series of smaller requests of the
36  * pipeline.  This object has two basic methods: GetNumberOfSplits()
37  * and GetSplit().
38  * 
39  * GetNumberOfSplits() is used to determine how may subregions a given
40  * region can be divided.  You call GetNumberOfSplits with an argument
41  * that is the number of subregions you want.  If the image region can
42  * support that number of subregions, that number is returned.
43  * Otherwise, the maximum number of splits a region can support will
44  * be returned.  For example, if a region splitter class only divides
45  * a region into horizontal slabs, then the maximum number of splits
46  * will be the number of rows in the region.
47  *
48  * GetSplit() returns the ith of N subregions (as an ImageRegion object).
49  *
50  * This ImageRegionSplitter class divides a region along the outermost
51  * dimension. If the outermost dimension has size 1 (i.e. a volume
52  * with a single slice), the ImageRegionSplitter will divide the
53  * region along the next outermost dimension. If that dimension has size 1,
54  * the process continues with the next outermost dimension.
55  *
56  * Other ImageRegionSplitter subclasses could divide an image into
57  * more uniform shaped regions instead of slabs.
58  *
59  * \sa ImageRegionMultidimensionalSplitter
60  *
61  * \ingroup ITKSystemObjects
62  * \ingroup DataProcessing
63  */
64
65 template <unsigned int VImageDimension>
66 class ITK_EXPORT ImageRegionSplitter: public Object
67 {
68 public:
69   /** Standard class typedefs. */
70   typedef ImageRegionSplitter              Self;
71 TDA   typedef Object  Superclass;
72 TDA   typedef SmartPointer<Self>  Pointer;
73 TDA   typedef SmartPointer<const Self>  ConstPointer;
74   
75   /** Method for creation through the object factory. */
76   itkNewMacro(Self);
77   
78   /** Run-time type information (and related methods). */
79   itkTypeMacro(ImageRegionSplitter,Object);
80
81   /** Dimension of the image available at compile time. */
82   itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
83   
84   /** Dimension of the image available at run time. */
85   static unsigned int GetImageDimension() 
86     { return VImageDimension; }
87
88   /** Index typedef support. An index is used to access pixel values. */
89   typedef Index<VImageDimension>  IndexType;
90 TDA   typedef typename IndexType::IndexValueType  IndexValueType;
91   
92   /** Size typedef support. A size is used to define region bounds. */
93   typedef Size<VImageDimension>  SizeType;
94 TDA   typedef typename SizeType::SizeValueType  SizeValueType;
95     
96   /** Region typedef support.   */
97   typedef ImageRegion<VImageDimension> RegionType;
98
99   /** How many pieces can the specifed region be split? A given region
100    * cannot always be divided into the requested number of pieces.  For
101    * instance, if the numberOfPieces exceeds the number of pixels along
102    * a certain dimensions, then some splits will not be possible. This
103    * method returns a number less than or equal to the requested number
104    * of pieces. */
105   virtual unsigned int GetNumberOfSplits(const RegionType ®ion,
106                                          unsigned int requestedNumber);
107
108   /** Get a region definition that represents the ith piece a specified region.
109    * The "numberOfPieces" specified should be less than or equal to what
110    * GetNumberOfSplits() returns. */
111   virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces,
112                               const RegionType ®ion);
113
114 protected:
115   ImageRegionSplitter() {}
116   ~ImageRegionSplitter() {}
117   void PrintSelf(std::ostream& os, Indent indent) const;
118
119 private:
120   ImageRegionSplitter(const ImageRegionSplitter&); //purposely not implemented
121   void operator=(const ImageRegionSplitter&); //purposely not implemented
122
123 };
124
125
126 // end namespace itk
127
128 #ifndef ITK_MANUAL_INSTANTIATION
129 #include "itkImageRegionSplitter.txx"
130 #endif
131
132 #endif
133
134 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:14PM
© Kitware Inc.