OTB  7.2.0
Orfeo Toolbox
otbVectorImage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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 otbVectorImage_h
22 #define otbVectorImage_h
23 
24 #if defined(__GNUC__) || defined(__clang__)
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wunused-parameter"
27 #include "itkVectorImage.h"
28 #pragma GCC diagnostic pop
29 #else
30 #include "itkVectorImage.h"
31 #endif
33 #include "OTBImageBaseExport.h"
34 
35 namespace otb
36 {
43 template <class TPixel, unsigned int VImageDimension = 2>
44 class OTBImageBase_EXPORT_TEMPLATE VectorImage : public itk::VectorImage<TPixel, VImageDimension>
45 {
46 public:
48  typedef VectorImage Self;
49  typedef itk::VectorImage<TPixel, VImageDimension> Superclass;
50  typedef itk::SmartPointer<Self> Pointer;
51  typedef itk::SmartPointer<const Self> ConstPointer;
52  typedef itk::WeakPointer<const Self> ConstWeakPointer;
53 
57 
59  itkNewMacro(Self);
60 
62  itkTypeMacro(VectorImage, itk::VectorImage);
63 
66  typedef typename Superclass::PixelType PixelType;
67 
69  typedef typename Superclass::ValueType ValueType;
70 
75  typedef typename Superclass::InternalPixelType InternalPixelType;
76 
77  typedef typename Superclass::IOPixelType IOPixelType;
78 
81  // typedef itk::DefaultVectorPixelAccessor< InternalPixelType > AccessorType;
82 
85  typedef itk::DefaultVectorPixelAccessorFunctor<Self> AccessorFunctorType;
86 
88  typedef itk::VectorImageNeighborhoodAccessorFunctor<Self> NeighborhoodAccessorFunctorType;
89 
94  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
95 
97  typedef typename Superclass::PixelContainer PixelContainer;
98 
101 
103  typedef typename Superclass::OffsetType OffsetType;
104 
106  typedef typename Superclass::SizeType SizeType;
107 
109  typedef typename Superclass::DirectionType DirectionType;
110 
112  typedef typename Superclass::RegionType RegionType;
113 
117 
121 
123  virtual std::string GetProjectionRef(void) const;
124 
125  virtual void SetProjectionRef(const std::string& wkt);
126 
128  virtual std::string GetGCPProjection(void) const;
129 
130  virtual unsigned int GetGCPCount(void) const;
131 
132  virtual OTB_GCP& GetGCPs(unsigned int GCPnum);
133  virtual const OTB_GCP& GetGCPs(unsigned int GCPnum) const;
134 
135  virtual std::string GetGCPId(unsigned int GCPnum) const;
136  virtual std::string GetGCPInfo(unsigned int GCPnum) const;
137  virtual double GetGCPRow(unsigned int GCPnum) const;
138  virtual double GetGCPCol(unsigned int GCPnum) const;
139  virtual double GetGCPX(unsigned int GCPnum) const;
140  virtual double GetGCPY(unsigned int GCPnum) const;
141  virtual double GetGCPZ(unsigned int GCPnum) const;
142 
144  virtual VectorType GetGeoTransform(void) const;
145 
147  SpacingType GetSignedSpacing() const;
148 
150  virtual void SetSignedSpacing(SpacingType spacing);
151  virtual void SetSignedSpacing(double spacing[VImageDimension]);
153 
155  virtual VectorType GetUpperLeftCorner(void) const;
156  virtual VectorType GetUpperRightCorner(void) const;
157  virtual VectorType GetLowerLeftCorner(void) const;
158  virtual VectorType GetLowerRightCorner(void) const;
160 
162  virtual ImageKeywordlistType GetImageKeywordlist(void);
163  virtual const ImageKeywordlistType GetImageKeywordlist(void) const;
165 
166  virtual void SetImageKeywordList(const ImageKeywordlistType& kwl);
167 
169  void CopyInformation(const itk::DataObject*) override;
170 
171  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
172 
174  // AccessorType GetPixelAccessor( void )
175  // {
176  // return AccessorType( this->GetNumberOfComponentsPerPixel() );
177  // }
178 
180  // const AccessorType GetPixelAccessor( void ) const
181  // {
182  // return AccessorType( this->GetNumberOfComponentsPerPixel() );
183  // }
184 
186  NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
187  {
188  return NeighborhoodAccessorFunctorType(this->GetNumberOfComponentsPerPixel());
189  }
190 
192  const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
193  {
194  return NeighborhoodAccessorFunctorType(this->GetNumberOfComponentsPerPixel());
195  }
196 
197 protected:
198  VectorImage();
199  ~VectorImage() override
200  {
201  }
202 
203 private:
204  VectorImage(const Self&) = delete;
205  void operator=(const Self&) = delete;
206 
210  ImageMetadataInterfacePointerType GetMetaDataInterface() const;
211 
212  // The image metadata accessor object. Don't use it directly. Instead use GetMetaDataInterface()
213  mutable ImageMetadataInterfacePointerType m_ImageMetadataInterface;
214 };
215 
216 } // end namespace otb
217 
218 #ifndef OTB_MANUAL_INSTANTIATION
219 #include "otbVectorImage.hxx"
220 #endif
221 
222 #include <complex>
223 
224 namespace otb
225 {
226 
227 // Prevent implicit instantiation of common types to improve build performance
228 // Explicit instanciations are provided in the .cxx
229 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned int, 2>;
230 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<int, 2>;
231 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned char, 2>;
232 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<char, 2>;
233 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned short, 2>;
234 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<short, 2>;
235 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<float, 2>;
236 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<double, 2>;
237 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<int>, 2>;
238 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<short>, 2>;
239 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<float>, 2>;
240 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<double>, 2>;
241 }
242 
243 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
ImageMetadataInterfaceBase::ImageKeywordlistType ImageKeywordlistType
itk::WeakPointer< const Self > ConstWeakPointer
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
Creation of an "otb" vector image which contains metadata.
~VectorImage() override
const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
Storage and conversion for OSSIM metadata.
Superclass::PixelType PixelType
This OTB_GCP class is used to manage the GCP parameters in OTB.
void SetSignedSpacing(InputImage *input, SpacingType spacing)
Definition: otbImage.h:53
Superclass::SpacingType SpacingType
Superclass::IndexType IndexType
ImageMetadataInterfaceBase::VectorType VectorType
VectorImage Self
Superclass::OffsetType OffsetType
Superclass::DirectionType DirectionType
NeighborhoodAccessorFunctorType GetNeighborhoodAccessor()
ImageType::SpacingType GetSignedSpacing(const ImageType *input)
Definition: otbImage.h:41
Superclass::PixelContainer PixelContainer
itk::SmartPointer< Self > Pointer
Superclass::IOPixelType IOPixelType
Superclass::SizeType SizeType
itk::VectorImageNeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType
Superclass::ValueType ValueType
Superclass::PointType PointType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
itk::VectorImage< TPixel, VImageDimension > Superclass
itk::DefaultVectorPixelAccessorFunctor< Self > AccessorFunctorType
Superclass::InternalPixelType InternalPixelType
itk::SmartPointer< const Self > ConstPointer
VectorImageType::SpacingType SpacingType
Definition: mvdTypes.h:175
ImageMetadataInterfaceBase::Pointer ImageMetadataInterfacePointerType
Superclass::RegionType RegionType
VectorImageType::PointType PointType
Definition: mvdTypes.h:183
ImageMetadataInterfacePointerType m_ImageMetadataInterface