diff --git a/Documentation/SoftwareGuide/Latex/ContributorList.tex b/Documentation/SoftwareGuide/Latex/ContributorList.tex index d17508de9313fa479c70eac7773d244c213dc383..ebe1243dd226361346cacbeb8c0f122d66ad8c61 100644 --- a/Documentation/SoftwareGuide/Latex/ContributorList.tex +++ b/Documentation/SoftwareGuide/Latex/ContributorList.tex @@ -16,7 +16,6 @@ David Dubois, David Youssefi (CNES Intern, then CS), Edouard Barthelet (Telecom Bretagne and Thales Communications), Emmanuel Christophe (CNES, then CRISP, then Google), -Eric Bughin (CMLA), Etienne Bougoin (CS), Gr\'egoire Mercier (Telecom Bretagne), Guillaume Borrut (CS), diff --git a/Modules/IO/IOMW/CMakeLists.txt b/Modules/IO/IOMW/CMakeLists.txt deleted file mode 100644 index 9596856ce4189651418a2a55ca5df85c6cd76311..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -project(OTBIOMW) - -set(OTBIOMW_LIBRARIES OTBIOMW) -otb_module_impl() diff --git a/Modules/IO/IOMW/include/otbMWImageIO.h b/Modules/IO/IOMW/include/otbMWImageIO.h deleted file mode 100644 index d47b6347afb4b1a284b8d7eb5385253f11bd99d9..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/include/otbMWImageIO.h +++ /dev/null @@ -1,187 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#ifndef otbMWImageIO_h -#define otbMWImageIO_h - -#include "otbImageIOBase.h" -#include <fstream> -#include <string> -#include <vector> - -namespace otb -{ - -/** \class MWImageIO - * - * \brief ImageIO object for reading (not writing) MW format images - * - * The streaming read is implemented. - * - * \ingroup IOFilters - * - * - * \ingroup OTBIOMW - */ -class ITK_EXPORT MWImageIO : public otb::ImageIOBase -{ -public: - - /** Standard class typedefs. */ - typedef MWImageIO Self; - typedef otb::ImageIOBase Superclass; - typedef itk::SmartPointer<Self> Pointer; - - /** Byte order typedef */ - typedef Superclass::ByteOrder ByteOrder; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Run-time type information (and related methods). */ - itkTypeMacro(MWImageIO, otb::ImageIOBase); - - /*-------- This part of the interface deals with reading data. ------ */ - - /** Determine the file type. Returns true if this ImageIO can read the - * file specified. */ - bool CanReadFile(const char*) ITK_OVERRIDE; - - /** Determine the file type. Returns true if the ImageIO can stream read the specified file */ - bool CanStreamRead() ITK_OVERRIDE - { - return true; - } - - /** Set the spacing and dimension information for the set filename. */ - void ReadImageInformation() ITK_OVERRIDE; - - /** Reads the data from disk into the memory buffer provided. */ - void Read(void* buffer) ITK_OVERRIDE; - - /** Reads 3D data from multiple files assuming one slice per file. */ - virtual void ReadVolume(void* buffer); - - /*-------- This part of the interfaces deals with writing data. ----- */ - - /** Determine the file type. Returns true if this ImageIO can read the - * file specified. */ - bool CanWriteFile(const char*) ITK_OVERRIDE; - - /** Determine the file type. Returns true if the ImageIO can stream write the specified file */ - bool CanStreamWrite() ITK_OVERRIDE - { - return true; - } - - /** Writes the spacing and dimensions of the image. - * Assumes SetFileName has been called with a valid file name. */ - void WriteImageInformation() ITK_OVERRIDE; - - /** Writes the data to disk from the memory buffer provided. Make sure - * that the IORegion has been set properly. */ - void Write(const void* buffer) ITK_OVERRIDE; - // JULIEN: NOT USED, NOT IMPLEMENTED - //void SampleImage(void* buffer, int XBegin, int YBegin, int SizeXRead, int SizeYRead, int XSample, int YSample); - - /** Get the number of overviews available into the file specified - * This imageIO didn't support overviews */ - unsigned int GetOverviewsCount() ITK_OVERRIDE - { - // MANTIS-1154: Source image is always considered as the best - // resolution overview. - return 1; - } - - /** Get information about overviews available into the file specified - * This imageIO didn't support overviews */ - std::vector<std::string> GetOverviewsInfo() ITK_OVERRIDE - { - std::vector<std::string> desc; - return desc; - } - - /** Provide hist about the output container to deal with complex pixel - * type (Not used here) */ - void SetOutputImagePixelType( bool itkNotUsed(isComplexInternalPixelType), - bool itkNotUsed(isVectorImage)) ITK_OVERRIDE{} - -protected: - /** Constructor.*/ - MWImageIO(); - /** Destructor.*/ - ~MWImageIO() ITK_OVERRIDE; - - bool OpenOneraDataFileForReading(const char* filename); - bool OpenOneraHeaderFileForReading(const char* filename); - void InternalReadImageInformation(); - - bool OpenOneraDataFileForWriting(const char* filename); - bool OpenOneraHeaderFileForWriting(const char* filename); - - void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE; - -private: - MWImageIO(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - - /** Internal method to read filename extension */ - - std::string GetExtension(const std::string& filename); - - /** Internal method to read header information */ - bool InternalReadHeaderInformation(std::fstream& file, const bool reportError); - inline void ByteSplitting(unsigned short a, unsigned short& low, unsigned short& high) - { - unsigned short b = 255; - low = a & b; - high = (a >> 8) & b; - } - -#define otbSwappFileOrderToSystemOrderMacro(StrongType, buffer, buffer_size) \ - { \ - typedef itk::ByteSwapper<StrongType> InternalByteSwapperType; \ - if (m_ByteOrder != m_FileByteOrder) \ - { \ - if (m_ByteOrder == LittleEndian) \ - { \ - InternalByteSwapperType::SwapRangeFromSystemToBigEndian((StrongType *) buffer, buffer_size); \ - } \ - else if (m_ByteOrder == BigEndian) \ - { \ - InternalByteSwapperType::SwapRangeFromSystemToLittleEndian((StrongType *) buffer, buffer_size); \ - } \ - } \ - } - -#define otbSwappFileToSystemMacro(StrongType, WeakType, buffer, buffer_size) \ - else if (this->GetComponentType() == WeakType) \ - { \ - otbSwappFileOrderToSystemOrderMacro(StrongType, buffer, buffer_size) \ - } - - bool m_FlagWriteImageInformation; - std::string m_TypeMW; //used for write - otb::ImageIOBase::ByteOrder m_FileByteOrder; - std::fstream m_File; - unsigned int m_Ncom; - -}; - -} // end namespace otb - -#endif // otbMWImageIO_h diff --git a/Modules/IO/IOMW/include/otbMWImageIOFactory.h b/Modules/IO/IOMW/include/otbMWImageIOFactory.h deleted file mode 100644 index 261cb79636d0df4da013ca20e8e70ec5b876107e..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/include/otbMWImageIOFactory.h +++ /dev/null @@ -1,69 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#ifndef otbMWImageIOFactory_h -#define otbMWImageIOFactory_h - -#include "itkObjectFactoryBase.h" - -namespace otb -{ -/** \class MWImageIOFactory - * \brief Creation d'un instance d'un objet LUMImageIO utilisant les object factory. - * - * \ingroup OTBIOMW - */ -class ITK_EXPORT MWImageIOFactory : public itk::ObjectFactoryBase -{ -public: - /** Standard class typedefs. */ - typedef MWImageIOFactory Self; - typedef itk::ObjectFactoryBase Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Class methods used to interface with the registered factories. */ - const char* GetITKSourceVersion(void) const ITK_OVERRIDE; - const char* GetDescription(void) const ITK_OVERRIDE; - - /** Method for class instantiation. */ - itkFactorylessNewMacro(Self); - static MWImageIOFactory * FactoryNew() { return new MWImageIOFactory; } - - /** Run-time type information (and related methods). */ - itkTypeMacro(MWImageIOFactory, itk::ObjectFactoryBase); - - /** Register one factory of this type */ - static void RegisterOneFactory(void) - { - MWImageIOFactory::Pointer MWFactory = MWImageIOFactory::New(); - itk::ObjectFactoryBase::RegisterFactory(MWFactory); - } - -protected: - MWImageIOFactory(); - ~MWImageIOFactory() ITK_OVERRIDE; - -private: - MWImageIOFactory(const Self &); //purposely not implemented - void operator =(const Self&); //purposely not implemented - -}; - -} // end namespace otb - -#endif diff --git a/Modules/IO/IOMW/otb-module.cmake b/Modules/IO/IOMW/otb-module.cmake deleted file mode 100644 index bacdf6ca8158a11b668586cdc118b1dad9139ffe..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/otb-module.cmake +++ /dev/null @@ -1,14 +0,0 @@ -set(DOCUMENTATION "This module contains features to read MW format images.") - -otb_module(OTBIOMW - DEPENDS - OTBImageBase - OTBCommon - OTBITK - - TEST_DEPENDS - OTBTestKernel - - DESCRIPTION - "${DOCUMENTATION}" -) diff --git a/Modules/IO/IOMW/src/CMakeLists.txt b/Modules/IO/IOMW/src/CMakeLists.txt deleted file mode 100644 index 5ced567cb020ff828d5620c29bcdff7111c215eb..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/src/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(OTBIOMW_SRC - otbMWImageIOFactory.cxx - otbMWImageIO.cxx - ) - -add_library(OTBIOMW ${OTBIOMW_SRC}) -target_link_libraries(OTBIOMW - ${OTBImageBase_LIBRARIES} - ${OTBCommon_LIBRARIES} - - ) - -otb_module_target(OTBIOMW) diff --git a/Modules/IO/IOMW/src/otbMWImageIO.cxx b/Modules/IO/IOMW/src/otbMWImageIO.cxx deleted file mode 100644 index 72a803c5270ef618c1d13d232a88a28eb7858a51..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/src/otbMWImageIO.cxx +++ /dev/null @@ -1,434 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#include "otbMWImageIO.h" -#include "itkByteSwapper.h" -#include "otbSystem.h" -#include "itksys/SystemTools.hxx" - -#include "otbMacro.h" - - -namespace otb -{ - -MWImageIO::MWImageIO() -{ - // By default set number of dimensions to two. - this->SetNumberOfDimensions(2); - m_PixelType = SCALAR; - m_ComponentType = UCHAR; - if (itk::ByteSwapper<char>::SystemIsLittleEndian() == true) - { - m_ByteOrder = LittleEndian; - } - else - { - m_ByteOrder = BigEndian; - } - - m_FileByteOrder = BigEndian; - - // Set default spacing to one - m_Spacing[0] = 1.0; - m_Spacing[1] = 1.0; - // Set default origin to [0.5 , 0.5] - // (consistency between ImageIO, see Mantis #942) - m_Origin[0] = 0.5; - m_Origin[1] = 0.5; - - m_FlagWriteImageInformation = true; - m_Ncom = 0; - - this->AddSupportedWriteExtension(".img"); - this->AddSupportedWriteExtension(".IMG"); - this->AddSupportedWriteExtension(".mw"); - this->AddSupportedWriteExtension(".MW"); - - this->AddSupportedReadExtension(".img"); - this->AddSupportedReadExtension(".IMG"); - this->AddSupportedReadExtension(".mw"); - this->AddSupportedReadExtension(".MW"); - -} - -MWImageIO::~MWImageIO() -{ - if (m_File.is_open()) - { - m_File.close(); - } -} - -bool MWImageIO::CanReadFile(const char* filename) -{ - std::string lFileName(filename); - // Test the extension - std::string extension = GetExtension(filename); - if ((extension != "img") && (extension != "") && (extension != "mw")) return false; - if (itksys::SystemTools::FileIsDirectory(lFileName.c_str()) == true) return false; - if (m_File.is_open()) m_File.close(); - - std::fstream header_file; - header_file.open(filename, std::ios::in | std::ios::binary); - if (header_file.fail()) - { - otbMsgDevMacro(<< "MWImageIO::CanReadFile() failed header open ! "); - return false; - } - - //Read header information - bool lResult = InternalReadHeaderInformation(header_file, false); - header_file.close(); - return (lResult); -} - -// Used to print information about this object -void MWImageIO::PrintSelf(std::ostream& os, itk::Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} - -// Read a 3D image (or event more bands)... not implemented yet -void MWImageIO::ReadVolume(void*) -{ -} - -// Read image -void MWImageIO::Read(void* buffer) -{ - char * p = static_cast<char *>(buffer); - - int lNbLignes = this->GetIORegion().GetSize()[1]; - int lNbColonnes = this->GetIORegion().GetSize()[0]; - int lPremiereLigne = this->GetIORegion().GetIndex()[1]; // [1... ] - int lPremiereColonne = this->GetIORegion().GetIndex()[0]; // [1... ] - - otbMsgDevMacro(<< " MWImageIO::Read() "); - otbMsgDevMacro(<< " Dimensions de l'image : " << m_Dimensions[0] << "," << m_Dimensions[1]); - otbMsgDevMacro(<< " Region lue (IORegion) : " << this->GetIORegion()); - otbMsgDevMacro(<< " Nb Of Components : " << this->GetNumberOfComponents()); - - std::streamoff headerLength = - static_cast<std::streamoff> (64 * sizeof(char)) + static_cast<std::streamoff> (m_Ncom * sizeof(char)); - std::streamoff numberOfBytesPerLines = static_cast<std::streamoff>(this->GetComponentSize() * m_Dimensions[0]); - std::streamoff offset; - std::streamsize numberOfBytesToBeRead = static_cast<std::streamsize>(this->GetComponentSize() * lNbColonnes); - std::streamsize numberOfBytesRead; - std::streamsize cpt = 0; - for (int LineNo = lPremiereLigne; LineNo < lPremiereLigne + lNbLignes; LineNo++) - { - offset = headerLength + numberOfBytesPerLines * static_cast<std::streamoff>(LineNo); - offset += static_cast<std::streamoff>(this->GetComponentSize() * lPremiereColonne); - m_File.seekg(offset, std::ios::beg); - m_File.read(static_cast<char *>(p + cpt), numberOfBytesToBeRead); - numberOfBytesRead = m_File.gcount(); -#ifdef __APPLE_CC__ - // fail() is broken in the Mac. It returns true when reaches eof(). - if (numberOfBytesRead != numberOfBytesToBeRead) -#else - if ((numberOfBytesRead != numberOfBytesToBeRead) || m_File.fail()) -#endif - { - itkExceptionMacro(<< "MWImageIO::Read() Can Read the specified Region"); // read failed - } - cpt += numberOfBytesToBeRead; - } - - unsigned long numberOfPixelsPerLines = lNbLignes * lNbColonnes; - // Swap bytes if necessary - if (0) {} - otbSwappFileToSystemMacro(float, FLOAT, buffer, numberOfPixelsPerLines) - else - { - itkExceptionMacro(<< "MWImageIO::Read() undefined component type! "); - } -} - -void MWImageIO::ReadImageInformation() -{ - if (m_File.is_open()) - { - m_File.close(); - } - - m_File.open(m_FileName.c_str(), std::ios::in | std::ios::binary); - if (m_File.fail()) - { - itkExceptionMacro(<< "MWImageIO::ReadImageInformation() failed header open ! "); - } - - //Read header information - InternalReadHeaderInformation(m_File, true); - - otbMsgDebugMacro(<< "Driver to read: MW"); - otbMsgDebugMacro(<< " Read file : " << m_FileName); - otbMsgDebugMacro(<< " Size : " << m_Dimensions[0] << "," << m_Dimensions[1]); - otbMsgDebugMacro(<< " ComponentType : " << this->GetComponentType()); - otbMsgDebugMacro(<< " NumberOfComponents : " << this->GetNumberOfComponents()); - otbMsgDebugMacro(<< " ComponentSize : " << this->GetComponentSize()); - otbMsgDebugMacro(<< " GetPixelSize : " << this->GetPixelSize()); - -} - -bool MWImageIO::InternalReadHeaderInformation(std::fstream& file, const bool reportError) -{ - - char * headerInformation = new char[64]; - file.seekg(0, std::ios::beg); - file.read(headerInformation, 64); - unsigned short NbCol(0); - unsigned short NbLig(0); - unsigned short Nbcom(0); - - //Set file byte order - if (headerInformation[0] == *("R") || headerInformation[1] == *("I")) - { - m_FileByteOrder = BigEndian; - //Read image dimensions - Nbcom = (static_cast<unsigned int>(headerInformation[3]) << 8) + static_cast<unsigned char> (headerInformation[2]); - m_Ncom = Nbcom; - NbCol = (static_cast<unsigned int>(headerInformation[5]) << 8) + static_cast<unsigned char> (headerInformation[4]); - NbLig = (static_cast<unsigned int>(headerInformation[7]) << 8) + static_cast<unsigned char> (headerInformation[6]); - } - else if (headerInformation[0] == *("I") || headerInformation[1] == *("R")) - { - m_FileByteOrder = LittleEndian; - //Read image dimensions - Nbcom = ((static_cast<unsigned int>(headerInformation[2])) << 8) + static_cast<unsigned char> (headerInformation[3]); - m_Ncom = Nbcom; - NbCol = ((static_cast<unsigned int>(headerInformation[4])) << 8) + static_cast<unsigned char> (headerInformation[5]); - NbLig = ((static_cast<unsigned int>(headerInformation[6])) << 8) + static_cast<unsigned char> (headerInformation[7]); - } - else - { - delete [] headerInformation; - - if (reportError == true) - { - itkExceptionMacro(<< "MW : impossible to determine CodePix information of the image"); - } - return false; - } - - SetComponentType(FLOAT); - - //Initialization of image information - m_Dimensions[0] = NbCol; - m_Dimensions[1] = NbLig; - this->SetNumberOfComponents(1); - this->SetFileTypeToBinary(); - this->SetNumberOfDimensions(2); - delete[] headerInformation; - return (true); -} - -bool MWImageIO::CanWriteFile(const char* filename) -{ - std::string lFileName(filename); - std::string extension = GetExtension(filename); - if (extension != "mw") return false; - if (itksys::SystemTools::FileIsDirectory(lFileName.c_str()) == true) return false; - - return true; -} - -void MWImageIO::Write(const void* buffer) -{ - if (m_FlagWriteImageInformation == true) - { - this->WriteImageInformation(); - m_FlagWriteImageInformation = false; - } - - unsigned long lNbLignes = this->GetIORegion().GetSize()[1]; - unsigned long lNbColonnes = this->GetIORegion().GetSize()[0]; - unsigned long lPremiereLigne = this->GetIORegion().GetIndex()[1]; // [1... ] - int lPremiereColonne = this->GetIORegion().GetIndex()[0]; // [1... ] - - if ((lNbLignes == m_Dimensions[1]) && (lNbColonnes == m_Dimensions[0])) - { - otbMsgDevMacro(<< "Forcing offset to [0, 0]"); - lPremiereLigne = 0; - lPremiereColonne = 0; - } - - otbMsgDevMacro(<< " MWImageIO::Write() "); - otbMsgDevMacro(<< " Dimensions de l'image : " << m_Dimensions[0] << "," << m_Dimensions[1]); - otbMsgDevMacro(<< " Region lue (IORegion) : " << this->GetIORegion()); - otbMsgDevMacro(<< " Nb Of Components : " << this->GetNumberOfComponents()); - otbMsgDevMacro(<< " GetComponentSize : " << this->GetComponentSize()); - - std::streamoff numberOfBytesPerLines = this->GetComponentSize() * m_Dimensions[0]; - std::streamoff headerLength = - static_cast<std::streamoff> (64 * sizeof(char)) + static_cast<std::streamoff> (m_Ncom * sizeof(char)); - std::streamoff offset; - std::streamsize numberOfBytesToBeWrite = this->GetComponentSize() * lNbColonnes; -// std::streamsize numberOfBytesToBeWriteFloat = sizeof(float) * lNbColonnes; - std::streamsize cpt = 0; - - const char * p = static_cast<const char *>(buffer); -// const float * p = dynamic_cast<const float *>(buffer); - -// float floatImage[m_Dimensions[0]*m_Dimensions[1]]; - -// std::streamsize counter = 0; -// std::cout << "begin conversion" << std::endl; -// for (unsigned int i=0; i<m_Dimensions[0]*m_Dimensions[1]; ++i) -// { -// floatImage[i] = static_cast< float > ( *(p+counter) ); -// std::cout << "float " << floatImage[i] << std::endl; -// counter+=sizeof(char); -// } - - for (unsigned long LineNo = lPremiereLigne; LineNo < lPremiereLigne + lNbLignes; LineNo++) - { - offset = headerLength + numberOfBytesPerLines * static_cast<std::streamoff>(LineNo); - offset += static_cast<std::streamoff>(this->GetComponentSize() * lPremiereColonne); - m_File.seekp(offset, std::ios::beg); - m_File.write(static_cast<const char *>(p + cpt), numberOfBytesToBeWrite); -// m_File.write( (char *)( floatImage + cpt ), numberOfBytesToBeWriteFloat ); - cpt += numberOfBytesToBeWrite; - } -} - -void MWImageIO::WriteImageInformation() -{ - - if (m_FileName == "") - { - itkExceptionMacro(<< "A FileName must be specified."); - } - if (CanWriteFile(m_FileName.c_str()) == false) - { - itkExceptionMacro(<< "The file " << m_FileName.c_str() << " is not defined as a MW file"); - } - // Close file from any previous image - if (m_File.is_open()) - { - m_File.close(); - } - - // Open the new file for writing - // Actually open the file - m_File.open(m_FileName.c_str(), std::ios::out | std::ios::trunc | std::ios::binary); - if (m_File.fail()) - { - itkExceptionMacro(<< "Cannot write requested file " << m_FileName.c_str() << "."); - } - - //Comment by MG to review write process - - //Writing header information -// if ( 0 ) {} -// if ( (this->GetComponentType() != FLOAT) ) -// { -// itkExceptionMacro(<< "MegaWave fimage format only accepts FLOAT32 data type"); -// } - m_ComponentType = FLOAT; - - m_File.seekp(0, std::ios::beg); - - char header[64]; - std::string comments("Image written with otb mw_IO_factory"); - m_Ncom = comments.length(); - //Initialization to 0 - for (unsigned int i = 0; i < 64; ++i) - header[i] = static_cast<unsigned char>(0); - //Write image size and other information - unsigned short lNbComments = m_Ncom; - unsigned short lNbLignes = static_cast<unsigned short>(this->GetIORegion().GetSize()[1]); - unsigned short lNbColonnes = static_cast<unsigned short>(this->GetIORegion().GetSize()[0]); - - unsigned short low, high; - if (m_ByteOrder == BigEndian) - { - header[0] = *("R"); - header[1] = *("I"); - - ByteSplitting(lNbComments, low, high); - header[2] = static_cast<unsigned char>(low); - header[3] = static_cast<unsigned char>(high); - - ByteSplitting(lNbColonnes, low, high); - header[4] = static_cast<unsigned char>(low); - header[5] = static_cast<unsigned char>(high); - - ByteSplitting(lNbLignes, low, high); - header[6] = static_cast<unsigned char>(low); - header[7] = static_cast<unsigned char>(high); - } - else if (m_ByteOrder == LittleEndian) - { - header[0] = *("I"); - header[1] = *("R"); - - ByteSplitting(lNbComments, low, high); - header[3] = static_cast<unsigned char>(low); - header[2] = static_cast<unsigned char>(high); - - ByteSplitting(lNbColonnes, low, high); - header[5] = static_cast<unsigned char>(low); - header[4] = static_cast<unsigned char>(high); - - ByteSplitting(lNbLignes, low, high); - header[7] = static_cast<unsigned char>(low); - header[6] = static_cast<unsigned char>(high); - } - else - { - itkExceptionMacro(<< "Unknown Byte order"); - } - - m_File.write(header, 64); - m_File.write(comments.data(), 36); - - otbMsgDebugMacro(<< "Driver to write: MW"); - otbMsgDebugMacro(<< " Write file : " << m_FileName); - otbMsgDebugMacro(<< " Size : " << m_Dimensions[0] << "," << m_Dimensions[1]); - otbMsgDebugMacro(<< " Type Mw : " << m_TypeMW); - otbMsgDebugMacro(<< " ComponentType : " << this->GetComponentType()); - otbMsgDebugMacro(<< " NumberOfComponents : " << this->GetNumberOfComponents()); - otbMsgDebugMacro(<< " ComponentSize : " << this->GetComponentSize()); - otbMsgDebugMacro(<< " GetPixelSize : " << this->GetPixelSize()); - -} - -std::string MWImageIO::GetExtension(const std::string& filename) -{ - // This assumes that the final '.' in a file name is the delimiter - // for the file's extension type - const std::string::size_type it = filename.find_last_of("."); - - // This determines the file's type by creating a new string - // who's value is the extension of the input filename - // eg. "myimage.gif" has an extension of "gif" - std::string fileExt(filename, it + 1, filename.length()); - - //If the extension has a "/" in it then this is not an extension and there are no extension. - std::string::size_type it2 = fileExt.find_last_of("/"); - if (it2 != std::string::npos) - { - std::string fileExt3(""); - return (fileExt3); - } - - return (fileExt); - -} - -} // end namespace otb diff --git a/Modules/IO/IOMW/src/otbMWImageIOFactory.cxx b/Modules/IO/IOMW/src/otbMWImageIOFactory.cxx deleted file mode 100644 index a645c838cb7d3e4078e01f0713192add995770d8..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/src/otbMWImageIOFactory.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#include "otbMWImageIOFactory.h" - -#include "itkCreateObjectFunction.h" -#include "otbMWImageIO.h" -#include "itkVersion.h" - -namespace otb -{ - -MWImageIOFactory::MWImageIOFactory() -{ - this->RegisterOverride("otbImageIOBase", - "otbMWImageIO", - "MW Image IO", - 1, - itk::CreateObjectFunction<MWImageIO>::New()); -} - -MWImageIOFactory::~MWImageIOFactory() -{ -} - -const char* -MWImageIOFactory::GetITKSourceVersion(void) const -{ - return ITK_SOURCE_VERSION; -} - -const char* -MWImageIOFactory::GetDescription() const -{ - return "MegaWave ImageIO Factory, permettant le chargement d'image au format MW dans l'OTB"; -} - -// Undocumented API used to register during static initialization. -// DO NOT CALL DIRECTLY. - -static bool MWImageIOFactoryHasBeenRegistered; - -void MWImageIOFactoryRegister__Private(void) -{ - if( ! MWImageIOFactoryHasBeenRegistered ) - { - MWImageIOFactoryHasBeenRegistered = true; - MWImageIOFactory::RegisterOneFactory(); - } -} -} // end namespace otb diff --git a/Modules/IO/IOMW/test/CMakeLists.txt b/Modules/IO/IOMW/test/CMakeLists.txt deleted file mode 100644 index 5ed4655ecfd6e7fcd94d733dd00a5edcf422474f..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/test/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -otb_module_test() - -set(OTBIOMWTests -otbIOMWTestDriver.cxx -otbMWImageIOTestCanRead.cxx -otbMWImageIOTestCanWrite.cxx -) - -add_executable(otbIOMWTestDriver ${OTBIOMWTests}) -target_link_libraries(otbIOMWTestDriver ${OTBIOMW-Test_LIBRARIES}) -otb_module_target_label(otbIOMWTestDriver) - -# Tests Declaration - -otb_add_test(NAME ioTuMWImageIOCanReadIMG COMMAND otbIOMWTestDriver otbMWImageIOTestCanRead - ${BASELINE}/QB_Toulouse_Ortho_PAN.img) - -otb_add_test(NAME ioTuMWImageIOCanReadMW COMMAND otbIOMWTestDriver otbMWImageIOTestCanRead - ${BASELINE}/QB_Toulouse_Ortho_PAN.mw) - -otb_add_test(NAME ioTuMWImageIOCanWriteIMG COMMAND otbIOMWTestDriver otbMWImageIOTestCanWrite - ${TEMP}/QB_Toulouse_Ortho_PAN.img) -set_property(TEST ioTuMWImageIOCanWriteIMG PROPERTY WILL_FAIL true) - -otb_add_test(NAME ioTuMWImageIOCanWriteMW COMMAND otbIOMWTestDriver otbMWImageIOTestCanWrite - ${TEMP}/QB_Toulouse_Ortho_PAN.mw) - diff --git a/Modules/IO/IOMW/test/otbIOMWTestDriver.cxx b/Modules/IO/IOMW/test/otbIOMWTestDriver.cxx deleted file mode 100644 index acf037c4d46536359786adafdf5f4c63f5136fa2..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/test/otbIOMWTestDriver.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "otbTestMain.h" -void RegisterTests() -{ - REGISTER_TEST(otbMWImageIOTestCanRead); - REGISTER_TEST(otbMWImageIOTestCanWrite); -} diff --git a/Modules/IO/IOMW/test/otbMWImageIOTestCanRead.cxx b/Modules/IO/IOMW/test/otbMWImageIOTestCanRead.cxx deleted file mode 100644 index 40327bd886bf42fbba154397c6450c776d121a52..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/test/otbMWImageIOTestCanRead.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - - - -#include "otbMWImageIO.h" -#include "itkMacro.h" -#include <iostream> - -int otbMWImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) -{ - otb::MWImageIO::Pointer lMWImageIO = otb::MWImageIO::New(); - bool lCanRead = lMWImageIO->CanReadFile(argv[1]); - if (lCanRead == false) - { - std::cerr << "Error otb::MWImageIO : impossible to read MW image " << argv[1] << "." << std::endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/Modules/IO/IOMW/test/otbMWImageIOTestCanWrite.cxx b/Modules/IO/IOMW/test/otbMWImageIOTestCanWrite.cxx deleted file mode 100644 index 1a3b87b1f18fb14b4caad2fa4efbbf436683d718..0000000000000000000000000000000000000000 --- a/Modules/IO/IOMW/test/otbMWImageIOTestCanWrite.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - - - -#include "otbMWImageIO.h" -#include "itkMacro.h" -#include <iostream> - -int otbMWImageIOTestCanWrite(int itkNotUsed(argc), char* argv[]) -{ - otb::MWImageIO::Pointer lMWImageIO = otb::MWImageIO::New(); - bool lCanRead = lMWImageIO->CanWriteFile(argv[1]); - if (lCanRead == false) - { - std::cerr << "Error image " << argv[1] << " is not a MW image." << std::endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -} diff --git a/Modules/IO/ImageIO/otb-module.cmake b/Modules/IO/ImageIO/otb-module.cmake index 70df4300da2b6c482f97cf72b29f1d4a44686cca..ba47d112c0ddce2259de8ea9e0ede9b2190ebe73 100644 --- a/Modules/IO/ImageIO/otb-module.cmake +++ b/Modules/IO/ImageIO/otb-module.cmake @@ -10,7 +10,6 @@ otb_module(OTBImageIO OTBIOGDAL OTBIOLUM OTBIOMSTAR - OTBIOMW OTBIOONERA OTBIORAD OTBIOTileMap diff --git a/Modules/IO/ImageIO/src/CMakeLists.txt b/Modules/IO/ImageIO/src/CMakeLists.txt index 6c3889d4e4933d72f66878896cfa36388dcb8c68..4d0a1eca9907a6b2f78b215d3d9d938fff1890dc 100644 --- a/Modules/IO/ImageIO/src/CMakeLists.txt +++ b/Modules/IO/ImageIO/src/CMakeLists.txt @@ -8,7 +8,6 @@ target_link_libraries(OTBImageIO ${OTBIOONERA_LIBRARIES} ${OTBIOLUM_LIBRARIES} ${OTBImageBase_LIBRARIES} - ${OTBIOMW_LIBRARIES} ${OTBIOMSTAR_LIBRARIES} ${OTBIOBSQ_LIBRARIES} ${OTBIOGDAL_LIBRARIES} diff --git a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx index 721e47228a43fe1960fbc8bec21822b9709242c3..403de421eab5692f689e6f669548a723c35976e6 100644 --- a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx +++ b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx @@ -29,7 +29,6 @@ #include "otbLUMImageIOFactory.h" #include "otbBSQImageIOFactory.h" #include "otbRADImageIOFactory.h" -#include "otbMWImageIOFactory.h" #include "otbTileMapImageIOFactory.h" @@ -98,7 +97,6 @@ ImageIOFactory::RegisterBuiltInFactories() itk::ObjectFactoryBase::RegisterFactory(LUMImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(TileMapImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(GDALImageIOFactory::New()); - itk::ObjectFactoryBase::RegisterFactory(MWImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(ONERAImageIOFactory::New()); itk::ObjectFactoryBase::RegisterFactory(MSTARImageIOFactory::New());