Commit b0632fcd authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: add export macros for ImageFileWriter & ImageFileReader, add complex

parent 1c476443
......@@ -32,6 +32,7 @@
#include "otbImageIOBase.h"
#include "itkExceptionObject.h"
#include "itkImageRegion.h"
#include "OTBImageIOExport.h"
#include "otbDefaultConvertPixelTraits.h"
#include "otbImageKeywordlist.h"
......@@ -89,7 +90,7 @@ public:
template <class TOutputImage,
class ConvertPixelTraits=DefaultConvertPixelTraits<
typename TOutputImage::IOPixelType > >
class ITK_EXPORT ImageFileReader : public itk::ImageSource<TOutputImage>
class OTBImageIO_EXPORT_TEMPLATE ImageFileReader : public itk::ImageSource<TOutputImage>
{
public:
/** Standard class typedefs. */
......@@ -214,20 +215,36 @@ private:
#include "otbImage.h"
#include "otbVectorImage.h"
#include <complex>
namespace otb {
// Prevent implicit instanciation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class ImageFileReader<Image<unsigned int, 2>>;
extern template class ImageFileReader<Image<int, 2>>;
extern template class ImageFileReader<Image<unsigned char, 2>>;
extern template class ImageFileReader<Image<char, 2>>;
extern template class ImageFileReader<Image<unsigned short, 2>>;
extern template class ImageFileReader<Image<short, 2>>;
extern template class ImageFileReader<Image<float, 2>>;
extern template class ImageFileReader<Image<double, 2>>;
// TODO add vector image
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<unsigned short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<float, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<double, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<int>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<short>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<float>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<Image<std::complex<double>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<unsigned int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<unsigned char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<unsigned short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<float, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<double, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<int>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<short>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<float>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileReader<VectorImage<std::complex<double>, 2>>;
}
......
......@@ -27,6 +27,7 @@
#include "otbExtendedFilenameToWriterOptions.h"
#include "itkFastMutexLock.h"
#include <string>
#include "OTBImageIOExport.h"
namespace otb
{
......@@ -61,7 +62,7 @@ namespace otb
* \ingroup OTBImageIO
*/
template <class TInputImage>
class ITK_EXPORT ImageFileWriter : public itk::ProcessObject
class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter : public itk::ProcessObject
{
public:
/** Standard class typedefs. */
......@@ -292,20 +293,36 @@ private:
#include "otbImage.h"
#include "otbVectorImage.h"
#include <complex>
namespace otb {
// Prevent implicit instanciation of common types to improve build performance
// Explicit instanciations are provided in the .cxx
extern template class ImageFileWriter<Image<unsigned int, 2>>;
extern template class ImageFileWriter<Image<int, 2>>;
extern template class ImageFileWriter<Image<unsigned char, 2>>;
extern template class ImageFileWriter<Image<char, 2>>;
extern template class ImageFileWriter<Image<unsigned short, 2>>;
extern template class ImageFileWriter<Image<short, 2>>;
extern template class ImageFileWriter<Image<float, 2>>;
extern template class ImageFileWriter<Image<double, 2>>;
// TODO add vector image
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<unsigned short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<float, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<double, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<int>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<short>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<float>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<Image<std::complex<double>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<unsigned int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<int, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<unsigned char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<char, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<unsigned short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<short, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<float, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<double, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<int>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<short>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<float>, 2>>;
extern template class OTBImageIO_EXPORT_TEMPLATE ImageFileWriter<VectorImage<std::complex<double>, 2>>;
}
......
......@@ -23,13 +23,29 @@
namespace otb {
// Explicit instanciation of common types
template class ImageFileReader<Image<unsigned int, 2>>;
template class ImageFileReader<Image<int, 2>>;
template class ImageFileReader<Image<unsigned char, 2>>;
template class ImageFileReader<Image<char, 2>>;
template class ImageFileReader<Image<unsigned short, 2>>;
template class ImageFileReader<Image<short, 2>>;
template class ImageFileReader<Image<float, 2>>;
template class ImageFileReader<Image<double, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<unsigned short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<float, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<double, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<int>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<short>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<float>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<Image<std::complex<double>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<unsigned int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<unsigned char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<unsigned short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<float, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<double, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<int>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<short>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<float>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileReader<VectorImage<std::complex<double>, 2>>;
}
......@@ -23,13 +23,29 @@
namespace otb {
// Explicit instanciation of common types
template class ImageFileWriter<Image<unsigned int, 2>>;
template class ImageFileWriter<Image<int, 2>>;
template class ImageFileWriter<Image<unsigned char, 2>>;
template class ImageFileWriter<Image<char, 2>>;
template class ImageFileWriter<Image<unsigned short, 2>>;
template class ImageFileWriter<Image<short, 2>>;
template class ImageFileWriter<Image<float, 2>>;
template class ImageFileWriter<Image<double, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<unsigned short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<float, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<double, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<int>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<short>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<float>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<Image<std::complex<double>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<unsigned int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<int, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<unsigned char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<char, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<unsigned short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<short, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<float, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<double, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<int>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<short>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<float>, 2>>;
template class OTBImageIO_EXPORT_EXPLICIT_TEMPLATE ImageFileWriter<VectorImage<std::complex<double>, 2>>;
}
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