OTB  6.7.0
Orfeo Toolbox
otbVectorImage.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 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:
47 
49  typedef VectorImage Self;
54 
58 
60  itkNewMacro(Self);
61 
63  itkTypeMacro(VectorImage, itk::VectorImage);
64 
67  typedef typename Superclass::PixelType PixelType;
68 
70  typedef typename Superclass::ValueType ValueType;
71 
76  typedef typename Superclass::InternalPixelType InternalPixelType;
77 
78  typedef typename Superclass::IOPixelType IOPixelType;
79 
82  //typedef itk::DefaultVectorPixelAccessor< InternalPixelType > AccessorType;
83 
87 
91 
96  itkStaticConstMacro(ImageDimension, unsigned int, VImageDimension);
97 
99  typedef typename Superclass::PixelContainer PixelContainer;
100 
103 
105  typedef typename Superclass::OffsetType OffsetType;
106 
108  typedef typename Superclass::SizeType SizeType;
109 
111  typedef typename Superclass::DirectionType DirectionType;
112 
114  typedef typename Superclass::RegionType RegionType;
115 
119 
123 
125  virtual std::string GetProjectionRef(void) const;
126 
127  virtual void SetProjectionRef(const std::string& wkt);
128 
130  virtual std::string GetGCPProjection(void) const;
131 
132  virtual unsigned int GetGCPCount(void) const;
133 
134  virtual OTB_GCP& GetGCPs(unsigned int GCPnum);
135  virtual const OTB_GCP& GetGCPs(unsigned int GCPnum) const;
136 
137  virtual std::string GetGCPId(unsigned int GCPnum) const;
138  virtual std::string GetGCPInfo(unsigned int GCPnum) const;
139  virtual double GetGCPRow(unsigned int GCPnum) const;
140  virtual double GetGCPCol(unsigned int GCPnum) const;
141  virtual double GetGCPX(unsigned int GCPnum) const;
142  virtual double GetGCPY(unsigned int GCPnum) const;
143  virtual double GetGCPZ(unsigned int GCPnum) const;
144 
146  virtual VectorType GetGeoTransform(void) const;
147 
150 
152  virtual void SetSignedSpacing( SpacingType spacing );
153  virtual void SetSignedSpacing( double spacing[ VImageDimension ] );
155 
157  virtual VectorType GetUpperLeftCorner(void) const;
158  virtual VectorType GetUpperRightCorner(void) const;
159  virtual VectorType GetLowerLeftCorner(void) const;
160  virtual VectorType GetLowerRightCorner(void) const;
162 
164  virtual ImageKeywordlistType GetImageKeywordlist(void);
165  virtual const ImageKeywordlistType GetImageKeywordlist(void) const;
167 
168  virtual void SetImageKeywordList(const ImageKeywordlistType& kwl);
169 
171  void CopyInformation(const itk::DataObject *) override;
172 
173  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
174 
176 // AccessorType GetPixelAccessor( void )
177 // {
178 // return AccessorType( this->GetNumberOfComponentsPerPixel() );
179 // }
180 
182 // const AccessorType GetPixelAccessor( void ) const
183 // {
184 // return AccessorType( this->GetNumberOfComponentsPerPixel() );
185 // }
186 
189  {
190  return NeighborhoodAccessorFunctorType(this->GetNumberOfComponentsPerPixel());
191  }
192 
195  {
196  return NeighborhoodAccessorFunctorType(this->GetNumberOfComponentsPerPixel());
197  }
198 
199 protected:
200  VectorImage();
201  ~VectorImage() override {}
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()
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 // Prevent implicit instanciation of common types to improve build performance
227 // Explicit instanciations are provided in the .cxx
228 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned int, 2>;
229 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<int, 2>;
230 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned char, 2>;
231 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<char, 2>;
232 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<unsigned short, 2>;
233 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<short, 2>;
234 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<float, 2>;
235 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<double, 2>;
236 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<int> , 2>;
237 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<short> , 2>;
238 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<float> , 2>;
239 extern template class OTBImageBase_EXPORT_TEMPLATE VectorImage<std::complex<double> , 2>;
240 
241 }
242 
243 #endif
itk::Size< Monteverdi_DIMENSION > SizeType
Definition: mvdTypes.h:137
ImageMetadataInterfaceBase::ImageKeywordlistType ImageKeywordlistType
itk::WeakPointer< const Self > ConstWeakPointer
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< unsigned char, 2 >
Creation of an "otb" vector image which contains metadata.
~VectorImage() override
Storage and conversion for OSSIM metadata.
Superclass::PixelType PixelType
itk::VectorImageNeighborhoodAccessorFunctor< Self > NeighborhoodAccessorFunctorType
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< char, 2 >
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
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< int, 2 >
Superclass::SizeType SizeType
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< float, 2 >
Superclass::ValueType ValueType
Superclass::PointType PointType
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< short, 2 >
const NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() const
itk::VectorImage< TPixel, VImageDimension > Superclass
itk::DefaultVectorPixelAccessorFunctor< Self > AccessorFunctorType
Superclass::InternalPixelType InternalPixelType
itk::SmartPointer< const Self > ConstPointer
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< unsigned short, 2 >
VectorImageType::SpacingType SpacingType
Definition: mvdTypes.h:181
ImageMetadataInterfaceBase::Pointer ImageMetadataInterfacePointerType
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< double, 2 >
Superclass::RegionType RegionType
VectorImageType::PointType PointType
Definition: mvdTypes.h:189
ImageMetadataInterfacePointerType m_ImageMetadataInterface
template class OTBImageBase_EXPORT_TEMPLATE VectorImage< unsigned int, 2 >