| 1 |
|
/*========================================================================= |
| 2 |
|
|
| 3 |
|
Program: Insight Segmentation & Registration Toolkit |
| 4 |
|
Module: $RCSfile: itkImageRegionMultidimensionalSplitter.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 __itkImageRegionMultidimensionalSplitter_h |
| 18 |
|
#define __itkImageRegionMultidimensionalSplitter_h |
| 19 |
|
|
| 20 |
|
#include "itkObject.h" |
| 21 |
|
#include "itkRegion.h" |
| 22 |
|
#include "itkObjectFactory.h" |
| 23 |
|
#include "itkIndex.h" |
| 24 |
|
#include "itkSize.h" |
| 25 |
|
#include "itkImageRegionSplitter.h" |
| 26 |
|
|
| 27 |
|
namespace itk |
| 28 |
|
{ |
| 29 |
|
|
| 30 |
|
/** \class ImageRegionMultidimensionalSplitter |
| 31 |
|
* \brief Divide a region into several pieces. |
| 32 |
|
* |
| 33 |
|
* ImageRegionMultidimensionalSplitter divides an ImageRegion into |
| 34 |
|
* smaller regions. ImageRegionMultidimensionalSplitter is used by |
| 35 |
|
* the StreamingImageFilter to divide a requested output region into a |
| 36 |
|
* series of smaller requests of the pipeline. This object has two |
| 37 |
|
* basic methods: GetNumberOfSplits() 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 |
|
* ImageRegionMultidimensionalSplitter class divides a region |
| 51 |
|
* into hypercubes (as opposed to the slabs used by the superclass |
| 52 |
|
* ImageRegionSplitter). In other words, it splits every dimension of the |
| 53 |
|
* region to form ND rectangular prisms. |
| 54 |
|
* |
| 55 |
|
* \ingroup ITKSystemObjects |
| 56 |
|
* \ingroup DataProcessing |
| 57 |
|
*/ |
| 58 |
|
|
| 59 |
|
template <unsigned int VImageDimension> |
| 60 |
LEN |
class ITK_EXPORT ImageRegionMultidimensionalSplitter: public ImageRegionSplitter<VImageDimension> |
| 61 |
|
{ |
| 62 |
|
public: |
| 63 |
|
/** Standard class typedefs. */ |
| 64 |
|
typedef ImageRegionMultidimensionalSplitter Self; |
| 65 |
TDA |
typedef ImageRegionSplitter<VImageDimension> Superclass; |
| 66 |
TDA |
typedef SmartPointer<Self> Pointer; |
| 67 |
TDA |
typedef SmartPointer<const Self> ConstPointer; |
| 68 |
|
|
| 69 |
|
/** Method for creation through the object factory. */ |
| 70 |
|
itkNewMacro(Self); |
| 71 |
|
|
| 72 |
|
/** Run-time type information (and related methods). */ |
| 73 |
|
itkTypeMacro(ImageRegionMultidimensionalSplitter,ImageRegionSplitter); |
| 74 |
|
|
| 75 |
|
/** Dimension of the image available at compile time. */ |
| 76 |
|
itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension); |
| 77 |
|
|
| 78 |
|
/** Index typedef support. An index is used to access pixel values. */ |
| 79 |
|
typedef Index<VImageDimension> IndexType; |
| 80 |
|
|
| 81 |
|
/** Size typedef support. A size is used to define region bounds. */ |
| 82 |
|
typedef Size<VImageDimension> SizeType; |
| 83 |
|
|
| 84 |
|
/** Region typedef support. */ |
| 85 |
|
typedef ImageRegion<VImageDimension> RegionType; |
| 86 |
|
|
| 87 |
|
/** How many pieces can the specifed region be split? A given region |
| 88 |
|
* cannot always be divided into the requested number of pieces. For |
| 89 |
|
* instance, if the numberOfPieces exceeds the number of pixels along |
| 90 |
|
* a certain dimensions, then some splits will not be possible. This |
| 91 |
|
* method returns a number less than or equal to the requested number |
| 92 |
|
* of pieces. */ |
| 93 |
|
virtual unsigned int GetNumberOfSplits(const RegionType ®ion, |
| 94 |
|
unsigned int requestedNumber); |
| 95 |
|
|
| 96 |
|
/** Get a region definition that represents the ith piece a specified region. |
| 97 |
|
* The "numberOfPieces" specified should be less than or equal to what |
| 98 |
|
* GetNumberOfSplits() returns. */ |
| 99 |
|
virtual RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, |
| 100 |
|
const RegionType ®ion); |
| 101 |
|
|
| 102 |
|
protected: |
| 103 |
|
ImageRegionMultidimensionalSplitter() {} |
| 104 |
|
~ImageRegionMultidimensionalSplitter() {} |
| 105 |
|
void PrintSelf(std::ostream& os, Indent indent) const; |
| 106 |
|
|
| 107 |
|
private: |
| 108 |
|
ImageRegionMultidimensionalSplitter(const Self&); //purposely not implemented |
| 109 |
|
void operator=(const Self&); //purposely not implemented |
| 110 |
|
|
| 111 |
|
}; |
| 112 |
|
|
| 113 |
|
|
| 114 |
|
} // end namespace itk |
| 115 |
|
|
| 116 |
|
#ifndef ITK_MANUAL_INSTANTIATION |
| 117 |
|
#include "itkImageRegionMultidimensionalSplitter.txx" |
| 118 |
|
#endif |
| 119 |
|
|
| 120 |
|
#endif |
| 121 |
|
|
| 122 |
EOF |
|