From 91d5a732cad112c2778582908aee75d961484654 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr>
Date: Tue, 7 Jul 2020 09:38:51 +0200
Subject: [PATCH] REFAC: don't use GetProjectionRef in
 ChangeInformationImageFilter because the method don't use the itk metadata
 dictionary anymore

---
 .../test/otbChangeInformationImageFilter.cxx         | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx b/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx
index 02ede6e356..358820d89c 100644
--- a/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx
+++ b/Modules/Filtering/ImageManipulation/test/otbChangeInformationImageFilter.cxx
@@ -50,13 +50,23 @@ int otbChangeInformationImageFilter(int itkNotUsed(argc), char* argv[])
   filter->UpdateOutputInformation();
 
   ImageType::Pointer outImage = filter->GetOutput();
-  if (!outImage->GetProjectionRef().empty())
+
+  // TODO: RemoveOssim. ChangeInformationImageFilter should change the ImageMetadata object stored in 
+  // the image instead of modifying the itk metadata dictionary. GetProjectionRef() look for the 
+  // projection in ImageMetadata now, so we can't use this method in the test. The temporary solution
+  // is to look in the itk dictionary instead (this was the old behavior of GetProjectionRef). But
+  // when ChangeInformationImageFilter will be refactored, GetProjectionRef should be used again.. 
+
+  //if (!outImage->GetProjectionRef().empty())
+  if (outImage->GetMetaDataDictionary().HasKey(otb::MetaDataKey::ProjectionRefKey))
   {
     std::cout << "Projection is supposed to be removed but is still present !" << std::endl;
     return EXIT_FAILURE;
   }
 
+  
   itk::MetaDataDictionary& dict = outImage->GetMetaDataDictionary();
+
   if (!dict.HasKey(otb::MetaDataKey::NoDataValueAvailable) || !dict.HasKey(otb::MetaDataKey::NoDataValue))
   {
     std::cout << "Missing no data metadata !" << std::endl;
-- 
GitLab