OTB  6.7.0
Orfeo Toolbox
otbDEMToImageGenerator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 otbDEMToImageGenerator_h
22 #define otbDEMToImageGenerator_h
23 
24 #include <stdio.h>
25 #include <string>
26 
27 #include "itkImageSource.h"
28 #include "otbImage.h"
29 #include "otbDEMHandler.h"
31 #include "otbGenericRSTransform.h"
32 
33 namespace otb
34 {
50 template <class TDEMImage>
51 class ITK_EXPORT DEMToImageGenerator :
52  public itk::ImageSource<TDEMImage>
53 {
54 public:
56  typedef TDEMImage DEMImageType;
57  typedef typename DEMImageType::Pointer DEMImagePointerType;
58  typedef typename DEMImageType::PixelType PixelType;
59 
65 
71  typedef typename Superclass::OutputImageRegionType OutputImageRegionType;
73 
75 
81 
82 
84  itkNewMacro(Self);
85 
87  itkTypeMacro(DEMToImageGenerator, ImageSource);
88 
90  itkSetMacro(OutputOrigin, PointType);
91  itkGetConstReferenceMacro(OutputOrigin, PointType);
93 
95  itkSetMacro(OutputSize, SizeType);
96  itkGetConstReferenceMacro(OutputSize, SizeType);
98 
100  itkSetMacro(OutputSpacing, SpacingType);
101  itkGetConstReferenceMacro(OutputSpacing, SpacingType);
103 
105  itkSetObjectMacro(Transform, GenericRSTransformType);
106  itkGetConstObjectMacro(Transform, GenericRSTransformType);
108 
111  itkSetMacro(AboveEllipsoid,bool);
112  itkGetMacro(AboveEllipsoid,bool);
113  itkBooleanMacro(AboveEllipsoid);
115 
116  void InstantiateTransform();
117 
124  void SetInputProjectionRef(const std::string& ref)
125  {
126  m_Transform->SetOutputProjectionRef(ref);
127  this->Modified();
128  }
130 
131  std::string GetInputProjectionRef() const
132  {
133  return m_Transform->GetOutputProjectionRef();
134  }
135 
136  void SetOutputProjectionRef(const std::string& ref)
137  {
138  m_Transform->SetInputProjectionRef(ref);
139  this->Modified();
140  }
141 
142  std::string GetOutputProjectionRef() const
143  {
144  return m_Transform->GetInputProjectionRef();
145  }
146 
149  {
150  m_Transform->SetOutputKeywordList(kwl);
151  this->Modified();
152  }
154  {
155  return m_Transform->GetOutputKeywordList();
156  }
158 
161  {
162  m_Transform->SetInputKeywordList(kwl);
163  this->Modified();
164  }
166 
168  {
169  return m_Transform->GetInputKeywordList();
170  }
171 
173  template <class TImageType> void SetOutputParametersFromImage(const TImageType * image)
174  {
175  this->SetOutputOrigin ( image->GetOrigin() );
176  this->SetOutputSpacing ( image->GetSignedSpacing() );
177  //this->SetOutputStartIndex ( image->GetLargestPossibleRegion().GetIndex() );
178  this->SetOutputSize ( image->GetLargestPossibleRegion().GetSize() );
179  this->SetOutputProjectionRef(image->GetProjectionRef());
180  this->SetOutputKeywordList(image->GetImageKeywordlist());
182 
183  InstantiateTransform();
184  }
185 
186 protected:
188  ~DEMToImageGenerator() override{}
189 
190  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
191  void BeforeThreadedGenerateData() override;
192  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread,
193  itk::ThreadIdType threadId) override;
194  void GenerateOutputInformation() override;
195 
202 
203 private:
204  DEMToImageGenerator(const Self &) = delete;
205  void operator =(const Self&) = delete;
206 
208 };
209 
210 } // namespace otb
211 
212 #ifndef OTB_MANUAL_INSTANTIATION
214 #endif
215 
216 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
Storage and conversion for OSSIM metadata.
DEMImageType::Pointer DEMImagePointerType
void SetInputKeywordList(const ImageKeywordlist &kwl)
GenericRSTransform GenericRSTransformType
std::string GetOutputProjectionRef() const
OutputImageType::PointType PointType
Class to generate an image from DEM data.
std::string GetInputProjectionRef() const
DEMImageType::PixelType PixelType
const ImageKeywordlist GetInputKeywordList()
const ImageKeywordlist GetOutputKeywordList()
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
OutputImageType::SizeType SizeType
OutputImageType::IndexType IndexType
unsigned int ThreadIdType
Superclass::Pointer OutputImagePointer
This is the class to handle generic remote sensing transform.
itk::ImageRegionIteratorWithIndex< DEMImageType > ImageIteratorType
DEMHandlerType::Pointer m_DEMHandler
GenericRSTransformPointerType m_Transform
itk::ImageSource< DEMImageType > Superclass
itk::SmartPointer< const Self > ConstPointer
void SetOutputProjectionRef(const std::string &ref)
Single access point for DEM data retrieval.
Definition: otbDEMHandler.h:90
void SetOutputKeywordList(const ImageKeywordlist &kwl)
GenericRSTransformType::Pointer GenericRSTransformPointerType
VectorImageType::SpacingType SpacingType
Definition: mvdTypes.h:181
OutputImageType::SpacingType SpacingType
void SetOutputParametersFromImage(const TImageType *image)
void SetInputProjectionRef(const std::string &ref)
Superclass::OutputImageRegionType OutputImageRegionType
VectorImageType::PointType PointType
Definition: mvdTypes.h:189
itk::SmartPointer< Self > Pointer
Class to overload method passed to virtual pure in ITK V4.
Definition: otbTransform.h:40