26 #include "itkMetaDataObject.h"
31 template <
class TPixel,
unsigned int VImageDimension>
37 template <
class TPixel,
unsigned int VImageDimension>
40 auto spacing = this->GetSpacing();
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);
101 template <
class TPixel,
unsigned int VImageDimension>
106 auto origin = this->GetOrigin();
107 auto spacing = this->GetSpacing();
108 auto direction = this->GetDirection();
111 geoTransform[0] = origin[0] - 0.5 * spacing[0] * direction[0][0];
112 geoTransform[3] = origin[1] - 0.5 * spacing[1] * direction[1][1];
113 geoTransform[1] = spacing[0] * direction[0][0];
114 geoTransform[5] = spacing[1] * direction[1][1];
115 geoTransform[2] = 0.;
116 geoTransform[4] = 0.;
117 return (geoTransform);
121 template <
class TPixel,
unsigned int VImageDimension>
126 itk::ContinuousIndex<double, VImageDimension> index;
128 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
129 return {physicalPoint[0],physicalPoint[1]};
132 template <
class TPixel,
unsigned int VImageDimension>
137 itk::ContinuousIndex<double, VImageDimension> index;
139 index[0] = -0.5 + this->GetLargestPossibleRegion().GetSize()[0];
140 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
141 return {physicalPoint[0],physicalPoint[1]};
144 template <
class TPixel,
unsigned int VImageDimension>
149 itk::ContinuousIndex<double, VImageDimension> index;
151 index[1] = -0.5 + this->GetLargestPossibleRegion().GetSize()[1];
152 this->TransformContinuousIndexToPhysicalPoint (index, physicalPoint) ;
153 return {physicalPoint[0],physicalPoint[1]};
156 template <
class TPixel,
unsigned int VImageDimension>
161 itk::ContinuousIndex<double, VImageDimension> index;
163 index[0] = -0.5 + this->GetLargestPossibleRegion().GetSize()[0];
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>
172 Superclass::PrintSelf(os, indent);
173 os << indent << this->GetImageMetadata();