Commit 175daaf0 authored by Mickael Savinaud's avatar Mickael Savinaud

ENH: manage the outputpixelType to the imageIO level to remove include...

ENH: manage the outputpixelType to the imageIO level to remove include otbGDALImageIO from otbImagefilereader
parent c00714f0
......@@ -290,6 +290,11 @@ public:
/** Get information about overviews available into the file specified
* Returns: overview info, empty if none. */
virtual std::vector<std::string> GetOverviewsInfo() = 0;
/** Provide hist about the output container to deal with complex pixel
* type */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage) = 0;
/*-------- This part of the interfaces deals with reading data ----- */
......
......@@ -114,6 +114,11 @@ public:
std::vector<std::string> desc;
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
protected:
/** Constructor.*/
......
......@@ -105,6 +105,15 @@ public:
{
return m_CreationOptions;
}
/** Provide hist about the output container to deal with complex pixel
* type */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage)
{
this->SetIsComplex(isComplexInternalPixelType);
this->SetIsVectorImage(isVectorImage);
}
/*-------- This part of the interface deals with reading data. ------ */
......
......@@ -73,6 +73,11 @@ public:
/** Get description about overviews available into the file specified */
virtual std::vector<std::string> GetOverviewsInfo();
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
/** Get number of available overviews in the jpeg2000 file
* ( if return = 0 => no overviews available because only one resolution
* is encoded in the file) */
......
......@@ -112,6 +112,11 @@ public:
std::vector<std::string> desc;
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
protected:
/** Constructor.*/
......
......@@ -105,6 +105,11 @@ public:
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
private:
MSTARImageIO(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
......
......@@ -112,6 +112,11 @@ public:
std::vector<std::string> desc;
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
protected:
/** Constructor.*/
......
......@@ -110,6 +110,11 @@ public:
std::vector<std::string> desc;
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
protected:
/** Constructor.*/
......
......@@ -113,6 +113,11 @@ public:
std::vector<std::string> desc;
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
protected:
/** Constructor.*/
......
......@@ -133,6 +133,11 @@ public:
std::vector<std::string> desc;
return desc;
}
/** Provide hist about the output container to deal with complex pixel
* type (Not used here) */
virtual void SetOutputImagePixelType( bool isComplexInternalPixelType,
bool isVectorImage){}
protected:
/** Constructor.*/
......
......@@ -36,8 +36,6 @@
#include "otbMacro.h"
#include "otbGDALImageIO.h" //FIXME avoid requiring GDALImageIO here
namespace otb
{
......@@ -312,42 +310,24 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
// Get the ImageIO MetaData Dictionary
itk::MetaDataDictionary& dict = this->m_ImageIO->GetMetaDataDictionary();
// Special actions for the gdal image IO
if (strcmp(this->m_ImageIO->GetNameOfClass(), "GDALImageIO") == 0)
{
typename GDALImageIO::Pointer imageIO = dynamic_cast<GDALImageIO*>(this->GetImageIO());
if(imageIO.IsNull())
{
otb::ImageFileReaderException e(__FILE__, __LINE__);
std::ostringstream msg;
msg << " ImageIO is of kind GDALImageIO, but fails to dynamic_cast (this should never happen)."<< std::endl;
e.SetDescription(msg.str().c_str());
throw e;
}
// Hint the IO whether the OTB image type takes complex pixels
// this will determine the strategy to fill up a vector image
OutputImagePixelType dummy;
imageIO->SetIsComplex(PixelIsComplex(dummy));
// VectorImage ??
if (strcmp(output->GetNameOfClass(), "VectorImage") == 0)
imageIO->SetIsVectorImage(true);
else
imageIO->SetIsVectorImage(false);
// Hint the IO whether the OTB image type takes complex pixels
// this will determine the strategy to fill up a vector image
OutputImagePixelType dummy;
bool lVectorImage = false;
if (strcmp(output->GetNameOfClass(), "VectorImage") == 0)
lVectorImage= true;
this->m_ImageIO->SetOutputImagePixelType(PixelIsComplex(dummy),lVectorImage);
// Pass the dataset number (used for hdf files for example)
if (m_FilenameHelper->SubDatasetIndexIsSet())
{
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::SubDatasetIndex, m_FilenameHelper->GetSubDatasetIndex());
}
else
{
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::SubDatasetIndex, m_AdditionalNumber);
}
// Pass the dataset number (used for hdf files for example)
if (m_FilenameHelper->SubDatasetIndexIsSet())
{
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::SubDatasetIndex, m_FilenameHelper->GetSubDatasetIndex());
}
else
{
itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::SubDatasetIndex, m_AdditionalNumber);
}
if (m_FilenameHelper->ResolutionFactorIsSet())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment