Commit c36b6060 authored by Cyrille Valladeau's avatar Cyrille Valladeau

MRG

parents 628b89d6 2375a936
......@@ -15,6 +15,7 @@ SET(CMAKE_MODULE_PATH
INCLUDE_REGULAR_EXPRESSION("^(otb|itk|vtk|vnl|vcl|vxl|f2c|netlib|ce|itpack|DICOM|meta|png|dbh|tif|jpeg|zlib).*$")
SOURCE_GROUP("XML Files" REGULAR_EXPRESSION "[.]xml$")
INCLUDE(CMakeDependentOption)
# On Visual Studio 8 MS deprecated C. This removes all 1.276E1265 security
# warnings
......@@ -286,13 +287,18 @@ IF(OTB_USE_VISU_GUI)
#-------------------------------
# FLTK Library
#-------------------------------
OPTION(OTB_USE_EXTERNAL_FLTK "Use an outside build of FLTK." OFF)
#OPTION(OTB_USE_EXTERNAL_FLTK "Use an outside build of FLTK." OFF)
FIND_PACKAGE(FLTK)
IF(FLTK_FOUND)
SET(OTB_USE_EXTERNAL_FLTK ON)
ELSE(FLTK_FOUND)
SET(OTB_USE_EXTERNAL_FLTK OFF)
ENDIF(FLTK_FOUND)
CMAKE_DEPENDENT_OPTION(OTB_USE_EXTERNAL_FLTK "Use an outside build of FLTK." ON
"FLTK_FOUND" OFF)
# IF(FLTK_FOUND)
# SET(OTB_USE_EXTERNAL_FLTK ON)
# ELSE(FLTK_FOUND)
# SET(OTB_USE_EXTERNAL_FLTK OFF)
# ENDIF(FLTK_FOUND)
# Option for internal/external FLTK
MARK_AS_ADVANCED(OTB_USE_EXTERNAL_FLTK)
......@@ -610,23 +616,26 @@ ENDIF(OTB_USE_EXTERNAL_GDAL)
#Experimental
FIND_PACKAGE(Gettext)
IF(GETTEXT_FOUND)
SET(OTB_I18N 1)
SET(OTB_LANG $ENV{LANG} CACHE STRING "OTB internationalization (Experimental)")#might want to get the Locale from the system here
SET(OTB_LANG_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/I18n)
SUBDIRS(I18n)
FIND_PATH(GETTEXT_INCLUDE_DIR
libintl.h
DOC "Path to gettext include directory (where libintl.h can be found)")
MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR)
IF(GETTEXT_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
ENDIF(GETTEXT_INCLUDE_DIR)
FIND_LIBRARY(GETTEXT_LIBRARY gettextlib DOC "GetText library")
IF(APPLE OR WIN32)
FIND_LIBRARY(GETTEXT_INTL_LIBRARY intl DOC "GetText intl library")
ENDIF(APPLE OR WIN32)
IF(GETTEXT_LIBRARY)
SET(OTB_I18N 1)
SET(OTB_LANG $ENV{LANG} CACHE STRING "OTB internationalization (Experimental)")#might want to get the Locale from the system here
SET(OTB_LANG_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/I18n)
ADD_SUBDIRECTORY(I18n)
FIND_PATH(GETTEXT_INCLUDE_DIR
libintl.h
DOC "Path to gettext include directory (where libintl.h can be found)")
MARK_AS_ADVANCED(GETTEXT_INCLUDE_DIR)
IF(GETTEXT_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
ENDIF(GETTEXT_INCLUDE_DIR)
ENDIF(GETTEXT_LIBRARY)
ELSE(GETTEXT_FOUND)
SET(OTB_I18N 0)
MESSAGE(STATUS
......
......@@ -22,12 +22,12 @@ IF(OTB_USE_PQXX)
TARGET_LINK_LIBRARIES(OTBCommon pq pqxx)
ENDIF(OTB_USE_PQXX)
IF(GETTEXT_FOUND)
IF(OTB_I18N)
TARGET_LINK_LIBRARIES(OTBCommon ${GETTEXT_LIBRARY})
IF(APPLE OR WIN32)
TARGET_LINK_LIBRARIES(OTBCommon ${GETTEXT_INTL_LIBRARY})
ENDIF(APPLE OR WIN32)
ENDIF(GETTEXT_FOUND)
ENDIF(OTB_I18N)
IF(OTB_LIBRARY_PROPERTIES)
SET_TARGET_PROPERTIES(OTBCommon PROPERTIES ${OTB_LIBRARY_PROPERTIES})
......
......@@ -16,6 +16,7 @@
=========================================================================*/
#include "otbConfigurationFile.h"
#include "otbMacro.h"
namespace otb
{
......@@ -25,6 +26,8 @@ ConfigurationFile::Pointer ConfigurationFile::Instance = NULL;
ConfigurationFile
::ConfigurationFile()
{
m_OTBConfig = NULL;
std::string OTBBinDir(OTB_CONFIG);
try
{
......@@ -32,7 +35,7 @@ ConfigurationFile
}
catch (ConfigFile::file_not_found& e)
{
itkExceptionMacro(<< "Error - File '" << e.filename << "' not found.");
otbMsgDebugMacro(<< "Error - File '" << e.filename << "' not found.");
}
}
......
......@@ -57,7 +57,13 @@ namespace otb
/** Get parameter*/
template<typename T> T GetParameter(const std::string & key) const {
try
if(m_OTBConfig == NULL)
{
itkExceptionMacro(<<"Configuration file not found.");
}
try
{
return m_OTBConfig->read<T>( key );
}
......
......@@ -42,10 +42,10 @@ class ITK_EXPORT ObjectListToObjectListFilter : public otb::ObjectListSource<TOu
{
public:
/** Standard class typedefs. */
typedef ObjectListToObjectListFilter Self;
typedef ObjectListToObjectListFilter Self;
typedef otb::ObjectListSource<TOutputList> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......@@ -54,22 +54,19 @@ public:
itkTypeMacro(ObjectListToObjectListFilter, ObjectListSource);
/** Some typedefs. */
typedef TInputList InputListType;
typedef TOutputList OutputListType;
typedef typename TInputList::ConstPointer InputListPointer;
typedef typename TOutputList::Pointer OutputListPointer;
typedef typename TInputList::ConstIterator InputListIterator;
typedef typename InputListType::ObjectType InputObjectType;
typedef TInputList InputListType;
typedef TOutputList OutputListType;
typedef typename TInputList::ConstPointer InputListPointer;
typedef typename TOutputList::Pointer OutputListPointer;
typedef typename TInputList::ConstIterator InputListIterator;
typedef typename InputListType::ObjectType InputObjectType;
typedef typename OutputListType::ObjectType OutputObjectType;
typedef itk::DataObject::Pointer DataObjectPointer;
typedef std::vector<OutputListPointer> OutputListForThreadType;
typedef itk::DataObject::Pointer DataObjectPointer;
virtual void SetInput( const InputListType *input);
const InputListType * GetInput(void);
protected:
/** Constructor */
ObjectListToObjectListFilter();
......@@ -82,11 +79,14 @@ protected:
/** Multi-threading implementation */
typedef std::vector<OutputListPointer> OutputListForThreadType;
virtual void BeforeThreadedGenerateData();
virtual void AfterThreadedGenerateData() {};
virtual int SplitRequestedRegion(int threadId, int threadCount, unsigned int requestedElements, unsigned int& startIndex, unsigned int& stopIndex);
virtual int SplitRequestedRegion(int threadId, int threadCount, unsigned int requestedElements,
unsigned int& startIndex, unsigned int& stopIndex);
/** startIndex and stopIndex represent the indices of the Objects
* to examine in thread threadId */
......
......@@ -114,7 +114,6 @@ unsigned long StreamingTraits<TImage>
{
typedef otb::ConfigurationFile ConfigurationType;
ConfigurationType::Pointer conf = ConfigurationType::GetInstance();
std::string lang = conf->GetParameter<std::string>("OTB_LANG");
std::streamoff streamMaxSizeBufferForStreamingBytes;
std::streamoff streamImageSizeToActivateStreamingBytes;
try
......
......@@ -24,7 +24,7 @@ namespace otb
{
/** \class ImageFileReader
* \brief Ressource to read an image from a file.
* \brief Resource to read an image from a file.
*
* \sa ImageSeriesReader
* \sa ImageIOBase
......@@ -37,9 +37,9 @@ class ITK_EXPORT ImageFileReader : public itk::ImageFileReader<TOutputImage>
{
public:
/** Standard class typedefs. */
typedef ImageFileReader Self;
typedef ImageFileReader Self;
typedef itk::ImageFileReader<TOutputImage> Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<Self> Pointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
......@@ -59,8 +59,7 @@ public:
/** The pixel type of the output image. */
//typedef typename TOutputImage::InternalPixelType OutputImagePixelType;
/** Prepare l'allocation de l'image output lors du premier appel de traitement
* pipeline. */
/** Prepare image allocation at the first call of the pipeline processing */
virtual void GenerateOutputInformation(void);
/** Does the real work. */
......
......@@ -170,7 +170,8 @@ ImageFileReader<TOutputImage>
ImageRegionType region = output->GetBufferedRegion();
// Adapte the image size with the region
std::streamoff nbBytes = (this->m_ImageIO->GetImageSizeInBytes() / this->m_ImageIO->GetImageSizeInPixels()) * static_cast<std::streamoff>(region.GetNumberOfPixels());
std::streamoff nbBytes = (this->m_ImageIO->GetImageSizeInBytes() / this->m_ImageIO->GetImageSizeInPixels())
* static_cast<std::streamoff>(region.GetNumberOfPixels());
char * loadBuffer = new char[nbBytes];
......@@ -339,12 +340,10 @@ ImageFileReader<TOutputImage>
ossimKeywordlist geom_kwl, tmp_kwl, tmp_kwl2;// = new ossimKeywordlist();
// Add the radar factory
ossimImageHandlerRegistry::instance()->addFactory(ossimImageHandlerSarFactory::instance());
ossimImageHandler* handler = ossimImageHandlerRegistry::instance()
->open(ossimFilename(lFileNameOssimKeywordlist.c_str()));
......@@ -371,14 +370,14 @@ ImageFileReader<TOutputImage>
// Add the plugins factory
ossimProjectionFactoryRegistry::instance()->registerFactory(ossimplugins::ossimPluginProjectionFactory::instance());
ossimProjection * projection = ossimProjectionFactoryRegistry::instance()
->createProjection(ossimFilename(lFileNameOssimKeywordlist.c_str()),0);
->createProjection(ossimFilename(lFileNameOssimKeywordlist.c_str()), 0);
if (!projection)
{
otbMsgDevMacro( <<"OSSIM Instanciate projection FAILED ! ");
otbMsgDevMacro( <<"OSSIM Instantiate projection FAILED ! ");
}
else
{
otbMsgDevMacro( <<"OSSIM Instanciate projection SUCCESS ! ");
otbMsgDevMacro( <<"OSSIM Instantiate projection SUCCESS ! ");
hasMetaData = projection->saveState(geom_kwl);
// Free memory
delete projection;
......@@ -399,7 +398,7 @@ ImageFileReader<TOutputImage>
ImageKeywordlist otb_kwl;
otb_kwl.SetKeywordlist( geom_kwl );
// Update itk MetaData Dictionnary
// Update itk MetaData Dictionary
itk::MetaDataDictionary& dict = this->m_ImageIO->GetMetaDataDictionary();
......@@ -453,7 +452,7 @@ ImageFileReader<TOutputImage>
}
// Test if the file can be open for reading access.
//Only if m_FileName speciy a filname (not a dirname)
//Only if m_FileName specify a filename (not a dirname)
if ( System::IsAFileName( this->m_FileName ) == true )
{
std::ifstream readTester;
......@@ -481,7 +480,7 @@ ImageFileReader<TOutputImage>
{
std::vector<std::string> listFileSearch;
listFileSearch.push_back("DAT_01.001");
listFileSearch.push_back("dat_01.001");// RADARSAT ou SAR_ERS2
listFileSearch.push_back("dat_01.001");// RADARSAT or SAR_ERS2
listFileSearch.push_back("IMAGERY.TIF");
listFileSearch.push_back("imagery.tif");//For format SPOT5TIF
// Not recognised as a supported file format by GDAL.
......
......@@ -96,10 +96,10 @@ int main( int argc, char* argv[] )
// Software Guide : EndLatex
// Software Guide : BeginCodeSnippet
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef otb::Image<RGBPixelType, 2> ImageType;
typedef itk::RGBPixel<unsigned char> RGBPixelType;
typedef otb::Image<RGBPixelType, 2> ImageType;
typedef otb::ImageFileReader<ImageType> ReaderType;
typedef otb::TileMapImageIO ImageIOType;
typedef otb::TileMapImageIO ImageIOType;
ImageIOType::Pointer tileIO = ImageIOType::New();
ReaderType::Pointer readerTile = ReaderType::New();
......@@ -117,7 +117,7 @@ int main( int argc, char* argv[] )
// that's why we don't want to do an update before extracting a specific
// area.
//
// The coordinates are refered with an origin at the North Pole and the
// The coordinates are referred with an origin at the North Pole and the
// change date meridian in Mercator projection. So we need to translate the latitude
// and the longitude in this funny coordinate system:
//
......
......@@ -40,18 +40,6 @@ public:
virtual bool open();
virtual double getNullPixelValue(ossim_uint32 band=0)const;
virtual double getMinPixelValue(ossim_uint32 band=0)const;
virtual double getMaxPixelValue(ossim_uint32 band=0)const;
virtual ossimScalarType getOutputScalarType() const;
bool getAcquisitionDate(ossimDate& date)const;
ossimString getSatelliteName()const;
ossimFilename getBandFilename(ossim_uint32 idx)const;
//! Returns the image geometry object associated with this tile source or NULL if non defined.
//! The geometry contains full-to-local image transform as well as projection (image-to-world)
......@@ -62,28 +50,12 @@ public:
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix = NULL);
/**
* @brief Gets a property for matching name.
* @param name The name of the property to get.
* @return Returns property matching "name".
*/
virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
/**
* @brief Gets a list of property names available.
* @param propertyNames The list to push back names to.
*/
virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
protected:
virtual ~ossimTileMapTileSource();
private:
void openHeader(const ossimFilename& file);
ossimRefPtr<ossimFfL7> theFfHdr;
TYPE_DATA
};
......
......@@ -46,8 +46,6 @@ public:
ossimTileMapModel(const ossimKeywordlist& geom_kwl);
ossimTileMapModel(const ossimTileMapModel& rhs);
virtual ~ossimTileMapModel();
enum ProjectionType
{
UNKNOWN_PROJECTION = 0,
......@@ -141,6 +139,8 @@ public:
protected:
virtual ~ossimTileMapModel();
/*!
* Initializes the model given a fast format header.
*/
......
......@@ -16,8 +16,6 @@
#include <ossim/base/ossimTrace.h>
#include <ossim/base/ossimNotifyContext.h>
#include <ossim/base/ossimKeywordNames.h>
#include <ossim/support_data/ossimFfL7.h>
#include <ossim/support_data/ossimFfL5.h>
#include <ossim/projection/ossimTileMapModel.h>
RTTI_DEF1_INST(ossimTileMapTileSource,
......@@ -32,8 +30,7 @@ static ossimTrace traceDebug("ossimTileMapTileSource:debug");
//*******************************************************************
ossimTileMapTileSource::ossimTileMapTileSource()
:
ossimGeneralRasterTileSource(),
theFfHdr(NULL)
ossimGeneralRasterTileSource()
{
}
......@@ -43,8 +40,7 @@ ossimTileMapTileSource::ossimTileMapTileSource()
ossimTileMapTileSource::ossimTileMapTileSource(const ossimKeywordlist& kwl,
const char* prefix)
:
ossimGeneralRasterTileSource(),
theFfHdr(NULL)
ossimGeneralRasterTileSource()
{
if (loadState(kwl, prefix) == false)
{
......@@ -57,7 +53,7 @@ ossimTileMapTileSource::ossimTileMapTileSource(const ossimKeywordlist& kwl,
//*******************************************************************
ossimTileMapTileSource::~ossimTileMapTileSource()
{
theFfHdr = NULL;
// theFfHdr = NULL;
}
bool ossimTileMapTileSource::open()
......@@ -76,36 +72,6 @@ bool ossimTileMapTileSource::open()
return false;
}
void ossimTileMapTileSource::openHeader(const ossimFilename& file)
{
//***
// TileMap file name example: l71024031_03119990929_hpn.fst
// Three header header file type substrings:
// HPN = Pan
// HRF = VNIR/SWIR (visible near infrared/shortwave infrared)
// HTM = Thermal
//***
ossimFilename hdr = file.file();
hdr.downcase();
if ( hdr.contains("hpn") || hdr.contains("hrf") || hdr.contains("htm") )
{
theFfHdr = new ossimFfL7(file.c_str());
} else if (hdr.contains("header.dat"))
{
theFfHdr = new ossimFfL5(file.c_str());
} else {
theFfHdr = NULL;
return;
}
if (theFfHdr->getErrorStatus() != ossimErrorCodes::OSSIM_OK)
{
theFfHdr = 0;
}
return;
}
ossimImageGeometry* ossimTileMapTileSource::getImageGeometry()
{
......@@ -113,10 +79,10 @@ ossimImageGeometry* ossimTileMapTileSource::getImageGeometry()
if (result->getProjection())
return theGeometry.get();
if (!theFfHdr) return result;
// if (!theFfHdr) return result;
// Make a model
ossimTileMapModel* model = new ossimTileMapModel (*theFfHdr);
ossimTileMapModel* model = new ossimTileMapModel ();
if (model->getErrorStatus() != ossimErrorCodes::OSSIM_OK)
return false;
......@@ -134,33 +100,6 @@ bool ossimTileMapTileSource::loadState(const ossimKeywordlist& kwl,
}
ossimRefPtr<ossimProperty> ossimTileMapTileSource::getProperty(
const ossimString& name)const
{
ossimRefPtr<ossimProperty> result = 0;
if (theFfHdr.valid())
{
result = theFfHdr->getProperty(name);
}
if ( result.valid() == false )
{
result = ossimGeneralRasterTileSource::getProperty(name);
}
return result;
}
void ossimTileMapTileSource::getPropertyNames(
std::vector<ossimString>& propertyNames)const
{
if (theFfHdr.valid())
{
theFfHdr->getPropertyNames(propertyNames);
}
ossimGeneralRasterTileSource::getPropertyNames(propertyNames);
}
ossimString ossimTileMapTileSource::getShortName() const
{
......@@ -177,76 +116,5 @@ ossimString ossimTileMapTileSource::className() const
return ossimString("ossimTileMapTileSource");
}
double ossimTileMapTileSource::getNullPixelValue(ossim_uint32)const
{
return 0.0;
}
double ossimTileMapTileSource::getMinPixelValue(ossim_uint32)const
{
return 1.0;
}
double ossimTileMapTileSource::getMaxPixelValue(ossim_uint32)const
{
return 255.0;
}
ossimScalarType ossimTileMapTileSource::getOutputScalarType() const
{
return OSSIM_UINT8;
}
bool ossimTileMapTileSource::getAcquisitionDate(ossimDate& date)const
{
if(!theFfHdr) return false;
theFfHdr->getAcquisitionDate(date);
return true;
}
ossimString ossimTileMapTileSource::getSatelliteName()const
{
if(!theFfHdr) return "";
return theFfHdr->getSatelliteName();
}
ossimFilename ossimTileMapTileSource::getBandFilename(ossim_uint32 idx)const
{
ossim_uint32 maxIdx = getNumberOfInputBands();
if(!theFfHdr||(idx > maxIdx))
{
return "";
}
ossimFilename path = getFilename().path();
ossimString filename = theFfHdr->getBandFilename(idx);
filename = filename.trim();
ossimFilename file = path.dirCat(filename);
if (file.exists())
{
return file;
}
// Try downcased name.
file = path.dirCat(filename.downcase());
if (file.exists())
{
return file;
}
// Try upcase name.
file = path.dirCat(filename.upcase());
if (file.exists())
{
return file;
}
return ossimFilename();
}
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