OTB  9.0.0
Orfeo Toolbox
otbTileImageFilter.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 #ifndef otbTileImageFilter_h
22 #define otbTileImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 
26 namespace otb
27 {
52 template <class TImage>
53 class ITK_EXPORT TileImageFilter : public itk::ImageToImageFilter<TImage, TImage>
54 {
55 public:
58  typedef itk::ImageToImageFilter<TImage, TImage> Superclass;
59  typedef itk::SmartPointer<Self> Pointer;
60  typedef itk::SmartPointer<const Self> ConstPointer;
61 
63  typedef TImage ImageType;
64  typedef typename ImageType::Pointer ImagePointerType;
65  typedef typename ImageType::SizeType SizeType;
66  typedef typename ImageType::RegionType RegionType;
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(TileImageFilter, ImageToImageFilter);
73 
74  itkSetMacro(Layout, SizeType);
75  itkGetConstReferenceMacro(Layout, SizeType);
76 
77 protected:
80 
82  ~TileImageFilter() override;
83 
85  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
86 
88  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
89 
91  void GenerateInputRequestedRegion() override;
92 
94  void GenerateOutputInformation() override;
95 
101  void VerifyInputInformation() override
102  {
103  }
104 
105 
106 private:
107  TileImageFilter(const Self&) = delete;
108  void operator=(const Self&) = delete;
109 
110  // Compute the overlapping region between the output requested
111  // region and the nth input tile largest region
112  RegionType OutputRegionToInputRegion(unsigned int tileIndex, const RegionType& requestedRegion);
113 
114  RegionType InputRegionToOutputRegion(unsigned int tileIndex, const RegionType& requestedRegion);
115 
116  // Layout of the images
118 
119  // Columns sizes
120  std::vector<unsigned int> m_ColumnsSizes;
121 
122  // Row sizes
123  std::vector<unsigned int> m_RowsSizes;
124 };
125 
126 } // end namespace itk
127 
128 #ifndef OTB_MANUAL_INSTANTIATION
129 #include "otbTileImageFilter.hxx"
130 #endif
131 
132 #endif
otbTileImageFilter.hxx
otb::TileImageFilter::ImageType
TImage ImageType
Definition: otbTileImageFilter.h:63
otb::TileImageFilter::m_Layout
SizeType m_Layout
Definition: otbTileImageFilter.h:117
otb::TileImageFilter::Superclass
itk::ImageToImageFilter< TImage, TImage > Superclass
Definition: otbTileImageFilter.h:58
otb::TileImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbTileImageFilter.h:59
otb::TileImageFilter::SizeType
ImageType::SizeType SizeType
Definition: otbTileImageFilter.h:65
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::TileImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbTileImageFilter.h:60
otb::TileImageFilter::m_RowsSizes
std::vector< unsigned int > m_RowsSizes
Definition: otbTileImageFilter.h:123
otb::TileImageFilter::Self
TileImageFilter Self
Definition: otbTileImageFilter.h:57
otb::TileImageFilter::RegionType
ImageType::RegionType RegionType
Definition: otbTileImageFilter.h:66
otb::TileImageFilter::ImagePointerType
ImageType::Pointer ImagePointerType
Definition: otbTileImageFilter.h:64
otb::TileImageFilter::VerifyInputInformation
void VerifyInputInformation() override
Definition: otbTileImageFilter.h:101
otb::TileImageFilter
This filter allows making a spatial mosaic from a set of images.
Definition: otbTileImageFilter.h:53
otb::TileImageFilter::m_ColumnsSizes
std::vector< unsigned int > m_ColumnsSizes
Definition: otbTileImageFilter.h:120