21 #ifndef otbVectorImage_hxx
22 #define otbVectorImage_hxx
26 #include "itkMetaDataObject.h"
31 template <
class TPixel,
unsigned int VImageDimension>
37 template <
class TPixel,
unsigned int VImageDimension>
40 auto spacing = this->GetSpacing();
41 for (
unsigned int i = 0; i < VImageDimension; ++i)
43 if (this->m_Direction[i][i] < 0)
44 spacing[i] = -spacing[i];
49 template <
class TPixel,
unsigned int VImageDimension>
53 for (
unsigned int i = 0; i < VImageDimension; i++)
57 if (this->m_Direction[i][i] > 0)
59 for (
unsigned j = 0; j < VImageDimension; ++j)
61 this->m_Direction[j][i] = -this->m_Direction[j][i];
64 spacing[i] = -spacing[i];
67 this->SetSpacing(spacing);
68 this->ComputeIndexToPhysicalPointMatrices();
72 template <
class TPixel,
unsigned int VImageDimension>
79 template <
class TPixel,
unsigned int VImageDimension>
82 Superclass::CopyInformation(data);
83 this->itk::Object::SetMetaDataDictionary(data->GetMetaDataDictionary());
89 if (imd.Bands.size() > 0 && imd.Bands.size() != this->GetNumberOfComponentsPerPixel())
91 SetImageMetadata(
ImageMetadata(imd.GeometryKeys, imd.NumericKeys, imd.StringKeys, imd.LUT1DKeys,
96 SetImageMetadata(imd);
102 template<
typename TPixel,
unsigned int VImageDimension >
106 if (this->GetNumberOfComponentsPerPixel() != n)
111 Superclass::SetNumberOfComponentsPerPixel(n);
114 template <
class TPixel,
unsigned int VImageDimension>
119 auto origin = this->GetOrigin();
120 auto spacing = this->GetSpacing();
121 auto direction = this->GetDirection();
124 geoTransform[0] = origin[0] - 0.5 * spacing[0] * direction[0][0];
125 geoTransform[3] = origin[1] - 0.5 * spacing[1] * direction[1][1];
126 geoTransform[1] = spacing[0] * direction[0][0];
127 geoTransform[5] = spacing[1] * direction[1][1];
128 geoTransform[2] = 0.;
129 geoTransform[4] = 0.;
130 return (geoTransform);
134 template <
class TPixel,
unsigned int VImageDimension>
139 itk::ContinuousIndex<double, VImageDimension> index;
141 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
142 return {physicalPoint[0],physicalPoint[1]};
145 template <
class TPixel,
unsigned int VImageDimension>
150 itk::ContinuousIndex<double, VImageDimension> index;
152 index[0] = -0.5 + this->GetLargestPossibleRegion().GetSize()[0];
153 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
154 return {physicalPoint[0],physicalPoint[1]};
157 template <
class TPixel,
unsigned int VImageDimension>
162 itk::ContinuousIndex<double, VImageDimension> index;
164 index[1] = -0.5 + this->GetLargestPossibleRegion().GetSize()[1];
165 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
166 return {physicalPoint[0],physicalPoint[1]};
169 template <
class TPixel,
unsigned int VImageDimension>
174 itk::ContinuousIndex<double, VImageDimension> index;
176 index[0] = -0.5 + this->GetLargestPossibleRegion().GetSize()[0];
177 index[1] = -0.5 + this->GetLargestPossibleRegion().GetSize()[1];
178 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
179 return {physicalPoint[0],physicalPoint[1]};
182 template <
class TPixel,
unsigned int VImageDimension>
185 Superclass::PrintSelf(os, indent);
186 os << indent << this->GetImageMetadata();