Skip to content
Snippets Groups Projects
Commit ff662637 authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

BUG: Mantis-942: fix detection of an identity geotransform

parent 15d2fd93
Branches
Tags
No related merge requests found
......@@ -478,12 +478,21 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
std::string projRef;
itk::ExposeMetaData(dict, MetaDataKey::ProjectionRefKey, projRef);
// Compute spacing for an identity geotransform at current resolution
unsigned int resolution;
itk::ExposeMetaData<unsigned int>(dict,
MetaDataKey::ResolutionFactor,
resolution);
double idSpacing = 1.0;
if (resolution != 0)
idSpacing = 1.0 * vcl_pow((double)2.0, (double)resolution);
const double Epsilon = 1.0E-12;
if ( projRef.empty()
&& vcl_abs(origin[0] - 0.5) > Epsilon
&& vcl_abs(origin[1] - 0.5) > Epsilon
&& vcl_abs(spacing[0] - 1) > Epsilon
&& vcl_abs(spacing[1] - 1) > Epsilon)
&& vcl_abs(origin[0] - 0.5 * spacing[0]) > Epsilon
&& vcl_abs(origin[1] - 0.5 * spacing[1]) > Epsilon
&& vcl_abs(spacing[0] - idSpacing) > Epsilon
&& vcl_abs(spacing[1] - idSpacing) > Epsilon)
{
std::string wgs84ProjRef =
"GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\", 6378137, 298.257223563]],"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment