From d03b516df24542aeaf92b02033fb7ec21c974243 Mon Sep 17 00:00:00 2001 From: Caroline Ruffel <caroline.ruffel@c-s.fr> Date: Thu, 11 May 2006 06:41:49 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20en=20place=20des=20classes=20otb::Image?= =?UTF-8?q?=20et=20otb::VectorImage=20(lecture=20des=20Meta=20donn=C3=A9es?= =?UTF-8?q?=20des=20images=20GDAL).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Code/IO/otbVectorImage.h | 101 +++++++++++++++++++++++++++ Code/IO/otbVectorImage.txx | 138 +++++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 Code/IO/otbVectorImage.h create mode 100644 Code/IO/otbVectorImage.txx diff --git a/Code/IO/otbVectorImage.h b/Code/IO/otbVectorImage.h new file mode 100644 index 0000000000..d5fcdbf54d --- /dev/null +++ b/Code/IO/otbVectorImage.h @@ -0,0 +1,101 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - C.Ruffel + Language : C++ + Date : 09 mai 2006 + Version : + Role : Création d'une otb::VectorImage + $Id$ + +=========================================================================*/ +#ifndef __otbVectorImage_h +#define __otbVectorImage_h + +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "itkVectorImage.h" + +#include "otbImageBase.h" + +#include <iostream> +#include <string.h> + +namespace otb +{ +/** \class VectorImage + * \brief Creation of an "otb" vector image which contains metadata. + * + */ +template <class TPixel, unsigned int VImageDimension=2> +class ITK_EXPORT VectorImage : public itk::VectorImage<TPixel, VImageDimension>, + public otb::ImageBase +{ +public: + + typedef TPixel InputPixelType; + + + /** Standard class typedefs. */ + typedef VectorImage Self; + typedef itk::VectorImage<InputPixelType, VImageDimension> Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + + typedef ImageBase::VectorType VectorType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(VectorImage, itk::VectorImage); + + /** Get the projection coordinate system of the image. */ + virtual std::string GetProjectionRef( void ); + + /** Get the GCP projection coordinates of the image. */ + virtual std::string GetGCPProjection( void ); + + virtual unsigned int GetGCPCount( void ); + + virtual OTB_GCP & GetGCPs ( unsigned int GCPnum ); + + virtual std::string GetGCPId( unsigned int GCPnum ); + virtual std::string GetGCPInfo( unsigned int GCPnum ); + virtual double GetGCPRow( unsigned int GCPnum ); + virtual double GetGCPCol( unsigned int GCPnum ); + virtual double GetGCPX( unsigned int GCPnum ); + virtual double GetGCPY( unsigned int GCPnum ); + virtual double GetGCPZ( unsigned int GCPnum ); + + /** Get the six coefficients of affine geoTtransform. */ + virtual VectorType GetGeoTransform( void ); + + /** Get image corners. */ + virtual VectorType GetUpperLeftCorner( void ); + virtual VectorType GetUpperRightCorner( void ); + virtual VectorType GetLowerLeftCorner( void ); + virtual VectorType GetLowerRightCorner( void ); + + void PrintSelf(std::ostream& os, Indent indent) const; + +protected: + VectorImage(); + virtual ~VectorImage(){}; + +private: + VectorImage(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + +}; + + +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbVectorImage.txx" +#endif + +#endif diff --git a/Code/IO/otbVectorImage.txx b/Code/IO/otbVectorImage.txx new file mode 100644 index 0000000000..60ec0bcb54 --- /dev/null +++ b/Code/IO/otbVectorImage.txx @@ -0,0 +1,138 @@ +/*========================================================================= + + Programme : OTB (ORFEO ToolBox) + Auteurs : CS - C.Ruffel + Language : C++ + Date : 09 mai 2006 + Version : + Role : Création d'une otb::VectorImage + $Id: $ + +=========================================================================*/ +#ifndef __otbVectorImage_txx +#define __otbVectorImage_txx + + +#ifdef _MSC_VER +#pragma warning ( disable : 4786 ) +#endif + +#include "otbVectorImage.h" + +namespace otb +{ + +template <class TPixel, unsigned int VImageDimension> +VectorImage<TPixel,VImageDimension>::VectorImage() +{ +} + +template <class TPixel, unsigned int VImageDimension> +std::string VectorImage<TPixel, VImageDimension>::GetProjectionRef( void ) +{ + return ( this->ImageBase::GetProjectionRef( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +std::string VectorImage<TPixel, VImageDimension>::GetGCPProjection( void ) +{ + return ( this->ImageBase::GetGCPProjection( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +unsigned int VectorImage<TPixel, VImageDimension>::GetGCPCount( void ) +{ + return ( this->ImageBase::GetGCPCount( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +OTB_GCP & VectorImage<TPixel, VImageDimension>::GetGCPs ( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPs( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +std::string VectorImage<TPixel, VImageDimension>::GetGCPId( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPId( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +std::string VectorImage<TPixel, VImageDimension>::GetGCPInfo( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPInfo( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +double VectorImage<TPixel, VImageDimension>::GetGCPRow( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPRow( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +double VectorImage<TPixel, VImageDimension>::GetGCPCol( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPCol( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +double VectorImage<TPixel, VImageDimension>::GetGCPX( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPX( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +double VectorImage<TPixel, VImageDimension>::GetGCPY( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPY( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +double VectorImage<TPixel, VImageDimension>::GetGCPZ( unsigned int GCPnum ) +{ + return ( this->ImageBase::GetGCPZ( this->GetMetaDataDictionary(), GCPnum ) ); +} + +template <class TPixel, unsigned int VImageDimension> +ImageBase::VectorType VectorImage<TPixel, VImageDimension>::GetGeoTransform( void ) +{ + return ( this->ImageBase::GetGeoTransform( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +ImageBase::VectorType VectorImage<TPixel, VImageDimension>::GetUpperLeftCorner( void ) +{ + return ( this->ImageBase::GetUpperLeftCorner( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +ImageBase::VectorType VectorImage<TPixel, VImageDimension>::GetUpperRightCorner( void ) +{ + return ( this->ImageBase::GetUpperRightCorner( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +ImageBase::VectorType VectorImage<TPixel, VImageDimension>::GetLowerLeftCorner( void ) +{ + return ( this->ImageBase::GetLowerLeftCorner( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +ImageBase::VectorType VectorImage<TPixel, VImageDimension>::GetLowerRightCorner( void ) +{ + return ( this->ImageBase::GetLowerRightCorner( this->GetMetaDataDictionary() ) ); +} + +template <class TPixel, unsigned int VImageDimension> +void +VectorImage<TPixel, VImageDimension>::PrintSelf(std::ostream& os, Indent indent) const +{ + Superclass::PrintSelf(os,indent); + + this->ImageBase::PrintSelf( os, indent, this->GetMetaDataDictionary() ); + +} + + +} // end namespace otb +#endif -- GitLab