OTB  9.0.0
Orfeo Toolbox
otbImageRegionSquareTileSplitter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 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:
138  void operator=(const ImageRegionSquareTileSplitter&) = delete;
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
otb::ImageRegionSquareTileSplitter::RegionType
itk::ImageRegion< VImageDimension > RegionType
Definition: otbImageRegionSquareTileSplitter.h:108
otb::ImageRegionSquareTileSplitter::ImageRegionSquareTileSplitter
ImageRegionSquareTileSplitter()
Definition: otbImageRegionSquareTileSplitter.h:128
otb::ImageRegionSquareTileSplitter::m_TileDimension
unsigned int m_TileDimension
Definition: otbImageRegionSquareTileSplitter.h:141
otb::ImageRegionSquareTileSplitter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbImageRegionSquareTileSplitter.h:82
otb::ImageRegionSquareTileSplitter::GetImageDimension
static unsigned int GetImageDimension()
Definition: otbImageRegionSquareTileSplitter.h:94
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::ImageRegionSquareTileSplitter
Divide a region into several pieces.
Definition: otbImageRegionSquareTileSplitter.h:75
otb::ImageRegionSquareTileSplitter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImageRegionSquareTileSplitter.h:81
otb::ImageRegionSquareTileSplitter::m_SplitsPerDimension
itk::FixedArray< unsigned int, VImageDimension > m_SplitsPerDimension
Definition: otbImageRegionSquareTileSplitter.h:140
otbImageRegionSquareTileSplitter.hxx
otb::ImageRegionSquareTileSplitter::SizeType
itk::Size< VImageDimension > SizeType
Definition: otbImageRegionSquareTileSplitter.h:104
otb::ImageRegionSquareTileSplitter::SizeValueType
SizeType::SizeValueType SizeValueType
Definition: otbImageRegionSquareTileSplitter.h:105
otb::ImageRegionSquareTileSplitter::IndexValueType
IndexType::IndexValueType IndexValueType
Definition: otbImageRegionSquareTileSplitter.h:101
otb::ImageRegionSquareTileSplitter::IndexType
itk::Index< VImageDimension > IndexType
Definition: otbImageRegionSquareTileSplitter.h:100
otb::ImageRegionSquareTileSplitter::~ImageRegionSquareTileSplitter
~ImageRegionSquareTileSplitter() override
Definition: otbImageRegionSquareTileSplitter.h:131
otb::ImageRegionSquareTileSplitter::m_TileSizeAlignment
unsigned int m_TileSizeAlignment
Definition: otbImageRegionSquareTileSplitter.h:142
otb::ImageRegionSquareTileSplitter::Self
ImageRegionSquareTileSplitter Self
Definition: otbImageRegionSquareTileSplitter.h:79
otb::ImageRegionSquareTileSplitter::Superclass
itk::ImageRegionSplitter< VImageDimension > Superclass
Definition: otbImageRegionSquareTileSplitter.h:80