ITK  6.0.0
Insight Toolkit
itkImageRegionSplitterBase.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkImageRegionSplitterBase_h
19#define itkImageRegionSplitterBase_h
20
21#include "itkImageRegion.h"
22#include "itkObjectFactory.h"
23#include "itkImageIORegion.h"
24
25namespace itk
26{
27
58class ITKCommon_EXPORT ImageRegionSplitterBase : public Object
59{
60public:
61 ITK_DISALLOW_COPY_AND_MOVE(ImageRegionSplitterBase);
62
68
70 itkOverrideGetNameOfClassMacro(ImageRegionSplitterBase);
71
78 template <unsigned int VImageDimension>
79 unsigned int
80 GetNumberOfSplits(const ImageRegion<VImageDimension> & region, unsigned int requestedNumber) const
81 {
82 return this->GetNumberOfSplitsInternal(
83 VImageDimension, region.GetIndex().m_InternalArray, region.GetSize().m_InternalArray, requestedNumber);
84 }
85 inline unsigned int
86 GetNumberOfSplits(const ImageIORegion & region, unsigned int requestedNumber) const
87 {
88 return this->GetNumberOfSplitsInternal(
89 region.GetImageDimension(), &region.GetIndex()[0], &region.GetSize()[0], requestedNumber);
90 }
102 template <unsigned int VImageDimension>
103 unsigned int
104 GetSplit(unsigned int i, unsigned int numberOfPieces, ImageRegion<VImageDimension> & region) const
105 {
106 return this->GetSplitInternal(VImageDimension,
107 i,
108 numberOfPieces,
111 }
112 unsigned int
113 GetSplit(unsigned int i, unsigned int numberOfPieces, ImageIORegion & region) const
114 {
115 return this->GetSplitInternal(
116 region.GetImageDimension(), i, numberOfPieces, &region.GetModifiableIndex()[0], &region.GetModifiableSize()[0]);
117 }
118
119protected:
121
124 virtual unsigned int
126 const IndexValueType regionIndex[],
127 const SizeValueType regionSize[],
128 unsigned int requestedNumber) const = 0;
129
134 virtual unsigned int
135 GetSplitInternal(unsigned int dim,
136 unsigned int i,
137 unsigned int numberOfPieces,
138 IndexValueType regionIndex[],
139 SizeValueType regionSize[]) const = 0;
140
141 void
142 PrintSelf(std::ostream & os, Indent indent) const override;
143};
144} // end namespace itk
145
146#endif
An ImageIORegion represents a structured region of data.
const IndexType & GetIndex() const
unsigned int GetImageDimension() const
const SizeType & GetSize() const
IndexType & GetModifiableIndex()
SizeType & GetModifiableSize()
Divide an image region into several pieces.
unsigned int GetSplit(unsigned int i, unsigned int numberOfPieces, ImageIORegion &region) const
void PrintSelf(std::ostream &os, Indent indent) const override
virtual unsigned int GetNumberOfSplitsInternal(unsigned int dim, const IndexValueType regionIndex[], const SizeValueType regionSize[], unsigned int requestedNumber) const =0
unsigned int GetSplit(unsigned int i, unsigned int numberOfPieces, ImageRegion< VImageDimension > &region) const
Get a region definition that represents the ith piece a specified region.
unsigned int GetNumberOfSplits(const ImageRegion< VImageDimension > &region, unsigned int requestedNumber) const
unsigned int GetNumberOfSplits(const ImageIORegion &region, unsigned int requestedNumber) const
virtual unsigned int GetSplitInternal(unsigned int dim, unsigned int i, unsigned int numberOfPieces, IndexValueType regionIndex[], SizeValueType regionSize[]) const =0
An image region represents a structured region of data.
const IndexType & GetIndex() const
IndexType & GetModifiableIndex()
SizeType & GetModifiableSize()
const SizeType & GetSize() const
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Base class for most ITK classes.
Definition: itkObject.h:62
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
long IndexValueType
Definition: itkIntTypes.h:93
unsigned long SizeValueType
Definition: itkIntTypes.h:86
IndexValueType m_InternalArray[VDimension]
Definition: itkIndex.h:291
SizeValueType m_InternalArray[VDimension]
Definition: itkSize.h:243