Skip to content
Snippets Groups Projects
Commit d9d9b382 authored by Julien Michel's avatar Julien Michel
Browse files

MRG

parents 3162bc6e ecd9e4c9
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,16 @@
#include "itkObjectFactoryBase.h"
#include "vnl/vnl_vector.h"
#include "imaging/ossimImageHandlerRegistry.h"
#include "ossim/imaging/ossimImageHandlerSarFactory.h"
#include "imaging/ossimImageHandler.h"
#include "init/ossimInit.h"
#include "base/ossimKeywordlist.h"
#include "itkMetaDataObject.h"
#include "otbImageKeywordlist.h"
#include "otbMetaDataKey.h"
#include "otbMacro.h"
namespace otb
......@@ -76,6 +86,30 @@ ImageFileWriter<TInputImage>
//TODO: Force ImageIO desctructor. Should be fixed once GDALImageIO
//will be refactored.
this->SetImageIO(NULL);
// Write the image keyword list if any
ossimKeywordlist geom_kwl;
ImageKeywordlist otb_kwl;
itk::MetaDataDictionary dict = this->GetInput()->GetMetaDataDictionary();
itk::ExposeMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, otb_kwl);
otb_kwl.convertToOSSIMKeywordlist(geom_kwl);
if(geom_kwl.getSize()>0)
{
otbMsgDevMacro(<<"Exporting keywordlist ...");
ossimImageHandlerRegistry::instance()->addFactory(ossimImageHandlerSarFactory::instance());
ossimImageHandler* handler = ossimImageHandlerRegistry::instance()->open(ossimFilename(this->GetFileName()));
if(!handler)
{
otbMsgDevMacro(<<"OSSIM Open Image FAILED !");
}
handler->setImageGeometry(geom_kwl);
handler->saveImageGeometry();
handler->close();
}
}
/**
......
......@@ -26,6 +26,16 @@
#include "itkImageRegionMultidimensionalSplitter.h"
#include "otbImageIOFactory.h"
#include "imaging/ossimImageHandlerRegistry.h"
#include "ossim/imaging/ossimImageHandlerSarFactory.h"
#include "imaging/ossimImageHandler.h"
#include "init/ossimInit.h"
#include "base/ossimKeywordlist.h"
#include "itkMetaDataObject.h"
#include "otbImageKeywordlist.h"
#include "otbMetaDataKey.h"
#include "otbConfigure.h"
namespace otb
......@@ -521,6 +531,29 @@ StreamingImageFileWriter<TInputImage>
this->GetOutput(idx)->DataHasBeenGenerated();
}
}
// Write the image keyword list if any
ossimKeywordlist geom_kwl;
ImageKeywordlist otb_kwl;
itk::MetaDataDictionary dict = this->GetInput()->GetMetaDataDictionary();
itk::ExposeMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, otb_kwl);
otb_kwl.convertToOSSIMKeywordlist(geom_kwl);
if(geom_kwl.getSize()>0)
{
otbMsgDevMacro(<<"Exporting keywordlist ...");
ossimImageHandlerRegistry::instance()->addFactory(ossimImageHandlerSarFactory::instance());
ossimImageHandler* handler = ossimImageHandlerRegistry::instance()->open(ossimFilename(this->GetFileName()));
if(!handler)
{
otbMsgDevMacro(<<"OSSIM Open Image FAILED !");
}
handler->setImageGeometry(geom_kwl);
handler->saveImageGeometry();
handler->close();
}
/**
* Release any inputs if marked for release
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment