Commit 4db72a15 authored by Guillaume Pasero's avatar Guillaume Pasero

Merge branch '1708-static-imageiobase-fcn' into 'develop'

ImageIOBase AsString functions should be static

Closes #1708

See merge request !229
parents e80f1451 2d331aac
......@@ -208,7 +208,7 @@ public:
/** Convenience method returns the IOPixelType as a string. This can be
* used for writing output files. */
std::string GetPixelTypeAsString(IOPixelType) const;
static std::string GetPixelTypeAsString(IOPixelType);
/** Enums used to specify write style: whether binary or ASCII. Some
* subclasses use this, some ignore it. */
......@@ -255,11 +255,11 @@ public:
/** Convenience method returns the FileType as a string. This can be
* used for writing output files. */
std::string GetFileTypeAsString(FileType) const;
static std::string GetFileTypeAsString(FileType);
/** Convenience method returns the ByteOrder as a string. This can be
* used for writing output files. */
std::string GetByteOrderAsString(ByteOrder) const;
static std::string GetByteOrderAsString(ByteOrder);
/** Type for representing size of bytes, and or positions along a file */
typedef std::streamoff SizeType;
......
......@@ -709,7 +709,7 @@ unsigned int ImageIOBase::GetComponentSize() const
return 0;
}
std::string ImageIOBase::GetFileTypeAsString(FileType t) const
std::string ImageIOBase::GetFileTypeAsString(FileType t)
{
std::string s;
switch(t)
......@@ -724,7 +724,7 @@ std::string ImageIOBase::GetFileTypeAsString(FileType t) const
}
}
std::string ImageIOBase::GetByteOrderAsString(ByteOrder t) const
std::string ImageIOBase::GetByteOrderAsString(ByteOrder t)
{
std::string s;
switch(t)
......@@ -778,7 +778,7 @@ std::string ImageIOBase::GetComponentTypeAsString(IOComponentType t)
}
}
std::string ImageIOBase::GetPixelTypeAsString(IOPixelType t) const
std::string ImageIOBase::GetPixelTypeAsString(IOPixelType t)
{
std::string s;
switch(t)
......@@ -805,7 +805,7 @@ std::string ImageIOBase::GetPixelTypeAsString(IOPixelType t) const
return (s = "complex");
case UNKNOWNPIXELTYPE:
default:
itkExceptionMacro ("Unknown pixel type: " << t);
return (s = "unknown");
}
}
......@@ -1325,13 +1325,13 @@ void ImageIOBase::PrintSelf(std::ostream& os, itk::Indent indent) const
Superclass::PrintSelf(os, indent);
os << indent << "FileName: " << m_FileName << std::endl;
os << indent << "FileType: " << this->GetFileTypeAsString(m_FileType) << std::endl;
os << indent << "ByteOrder: " << this->GetByteOrderAsString(m_ByteOrder) << std::endl;
os << indent << "FileType: " << ImageIOBase::GetFileTypeAsString(m_FileType) << std::endl;
os << indent << "ByteOrder: " << ImageIOBase::GetByteOrderAsString(m_ByteOrder) << std::endl;
os << indent << "IORegion: " << std::endl;
m_IORegion.Print(os, indent.GetNextIndent());
os << indent << "Number of Components/Pixel: " << m_NumberOfComponents << "\n";
os << indent << "Pixel Type: " << this->GetPixelTypeAsString(m_PixelType) << std::endl;
os << indent << "Component Type: " << this->GetComponentTypeAsString(m_ComponentType)
os << indent << "Pixel Type: " << ImageIOBase::GetPixelTypeAsString(m_PixelType) << std::endl;
os << indent << "Component Type: " << ImageIOBase::GetComponentTypeAsString(m_ComponentType)
<< std::endl;
os << indent << "Dimensions: ( ";
for (unsigned int i=0; i < m_NumberOfDimensions; i++)
......
......@@ -1313,7 +1313,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer)
}
else
{
itkExceptionMacro(<< "This complex type is not defined :" << this->GetPixelTypeAsString(this->GetPixelType()) );
itkExceptionMacro(<< "This complex type is not defined :" << ImageIOBase::GetPixelTypeAsString(this->GetPixelType()) );
}
}
else
......
......@@ -384,13 +384,13 @@ void ONERAImageIO::InternalReadImageInformation()
otbMsgDebugMacro(<< "Driver to read: ONERA");
otbMsgDebugMacro(<< " Read file : " << m_FileName);
otbMsgDebugMacro(<< " Size : " << m_Dimensions[0] << "," << m_Dimensions[1]);
otbMsgDebugMacro(<< " PixelType : " << this->GetPixelTypeAsString(this->GetPixelType()));
otbMsgDebugMacro(<< " ComponentType : " << this->GetComponentTypeAsString(this->GetComponentType()));
otbMsgDebugMacro(<< " PixelType : " << ImageIOBase::GetPixelTypeAsString(this->GetPixelType()));
otbMsgDebugMacro(<< " ComponentType : " << ImageIOBase::GetComponentTypeAsString(this->GetComponentType()));
otbMsgDebugMacro(<< " ComponentSize : " << this->GetComponentSize());
otbMsgDebugMacro(<< " NumberOfComponents : " << this->GetNumberOfComponents());
otbMsgDebugMacro(<< " BytePerPixel : " << m_BytePerPixel);
otbMsgDebugMacro(<< " Host byte order : " << this->GetByteOrderAsString(m_ByteOrder));
otbMsgDebugMacro(<< " File byte order : " << this->GetByteOrderAsString(m_FileByteOrder));
otbMsgDebugMacro(<< " Host byte order : " << ImageIOBase::GetByteOrderAsString(m_ByteOrder));
otbMsgDebugMacro(<< " File byte order : " << ImageIOBase::GetByteOrderAsString(m_FileByteOrder));
delete [] sHeader;
}
......@@ -595,7 +595,7 @@ void ONERAImageIO::InternalWriteImageInformation()
otbMsgDebugMacro(<< " ComponentType : " << this->GetComponentType());
otbMsgDebugMacro(<< " NumberOfComponents : " << this->GetNumberOfComponents());
otbMsgDebugMacro(<< " BytePerPixel : " << m_BytePerPixel);
otbMsgDebugMacro(<< " Host byte order : " << this->GetByteOrderAsString(m_ByteOrder));
otbMsgDebugMacro(<< " Host byte order : " << ImageIOBase::GetByteOrderAsString(m_ByteOrder));
}
} // end namespace otb
......@@ -618,8 +618,8 @@ void RADImageIO::WriteImageInformation()
m_HeaderFile << "TYPECODAGE ";
std::string lExtension;
std::string lStringPixelType = itksys::SystemTools::UpperCase(this->GetPixelTypeAsString(m_PixelType));
std::string lStringComponentType = itksys::SystemTools::UpperCase(this->GetComponentTypeAsString(this->GetComponentType()));
std::string lStringPixelType = itksys::SystemTools::UpperCase(ImageIOBase::GetPixelTypeAsString(m_PixelType));
std::string lStringComponentType = itksys::SystemTools::UpperCase(ImageIOBase::GetComponentTypeAsString(this->GetComponentType()));
if (lStringPixelType == "SCALAR")
{
......
......@@ -889,7 +889,7 @@ ImageFileReader<TOutputImage, ConvertPixelTraits>
std::ostringstream msg;
msg <<"Couldn't convert component type: "
<< std::endl << " "
<< m_ImageIO->GetComponentTypeAsString(m_ImageIO->GetComponentType())
<< ImageIOBase::GetComponentTypeAsString(m_ImageIO->GetComponentType())
<< std::endl << "to one of: "
<< std::endl << " " << typeid(unsigned char).name()
<< std::endl << " " << typeid(char).name()
......
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