OTB  10.0.0
Orfeo Toolbox
otbImageRegionSquareTileSplitter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 
22 #ifndef otbImageRegionSquareTileSplitter_h
23 #define otbImageRegionSquareTileSplitter_h
24 
25 #include "itkRegion.h"
26 #include "itkImageRegionSplitter.h"
27 #include "itkObjectFactory.h"
28 #include "itkIndex.h"
29 #include "itkSize.h"
30 
31 namespace otb
32 {
33 
74 template <unsigned int VImageDimension>
75 class ITK_EXPORT ImageRegionSquareTileSplitter : public itk::ImageRegionSplitter<VImageDimension>
76 {
77 public:
80  typedef itk::ImageRegionSplitter<VImageDimension> Superclass;
81  typedef itk::SmartPointer<Self> Pointer;
82  typedef itk::SmartPointer<const Self> ConstPointer;
83 
85  itkNewMacro(Self);
86 
88  itkTypeMacro(ImageRegionSquareTileSplitter, itk::Object);
89 
91  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
92 
94  static unsigned int GetImageDimension()
95  {
96  return VImageDimension;
97  }
98 
100  typedef itk::Index<VImageDimension> IndexType;
101  typedef typename IndexType::IndexValueType IndexValueType;
102 
104  typedef itk::Size<VImageDimension> SizeType;
105  typedef typename SizeType::SizeValueType SizeValueType;
106 
108  typedef itk::ImageRegion<VImageDimension> RegionType;
109 
115  unsigned int GetNumberOfSplits(const RegionType& region, unsigned int requestedNumber) override;
116 
120  RegionType GetSplit(unsigned int i, unsigned int numberOfPieces, const RegionType& region) override;
121 
122  itkGetMacro(TileSizeAlignment, unsigned int);
123  itkSetMacro(TileSizeAlignment, unsigned int);
124 
125  itkGetMacro(TileDimension, unsigned int);
126 
127 protected:
128  ImageRegionSquareTileSplitter() : m_SplitsPerDimension(0U), m_TileDimension(0), m_TileSizeAlignment(16)
129  {
130  }
132  {
133  }
134  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
135 
136 private:
139 
140  itk::FixedArray<unsigned int, VImageDimension> m_SplitsPerDimension;
141  unsigned int m_TileDimension;
142  unsigned int m_TileSizeAlignment;
143 };
144 
145 } // end namespace otb
146 
147 #ifndef OTB_MANUAL_INSTANTIATION
149 #endif
150 
151 #endif
Divide a region into several pieces.
void operator=(const ImageRegionSquareTileSplitter &)=delete
itk::FixedArray< unsigned int, VImageDimension > m_SplitsPerDimension
ImageRegionSquareTileSplitter(const ImageRegionSquareTileSplitter &)=delete
itk::ImageRegion< VImageDimension > RegionType
itk::ImageRegionSplitter< VImageDimension > Superclass
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.