diff --git a/Code/IO/otbDefaultImageMetadataInterface.h b/Code/IO/otbDefaultImageMetadataInterface.h index 33d56ae6df939ef3f793f02c42bed70e9ce57ba3..4c50d84104efd69e28934607090e831f2b9ea5ea 100644 --- a/Code/IO/otbDefaultImageMetadataInterface.h +++ b/Code/IO/otbDefaultImageMetadataInterface.h @@ -130,6 +130,19 @@ public: { itkExceptionMacro("GetSatElevation not implemented in DefaultImageMetadataInterface, no captor type found"); }; + + + /** Get the first wavelength for the spectral band definition */ + VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & dict ) const + { + itkExceptionMacro("GetFirstWavelengths not implemented in DefaultImageMetadataInterface, no captor type found"); + }; + + /** Get the last wavelength for the spectral band definition */ + VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & dict ) const + { + itkExceptionMacro("GetLastWavelengths not implemented in DefaultImageMetadataInterface, no captor type found"); + }; bool CanRead( const MetaDataDictionaryType & dict ) const { diff --git a/Code/IO/otbIkonosImageMetadataInterface.cxx b/Code/IO/otbIkonosImageMetadataInterface.cxx index 49792cd1826a4a586a1f6d12c33fc9a3be0e04cb..a11002f6715de88ebbd5e6f221cc464395273809 100755 --- a/Code/IO/otbIkonosImageMetadataInterface.cxx +++ b/Code/IO/otbIkonosImageMetadataInterface.cxx @@ -522,4 +522,93 @@ IkonosImageMetadataInterface::GetSatAzimuth( const MetaDataDictionaryType & dict } +IkonosImageMetadataInterface::VariableLengthVectorType +IkonosImageMetadataInterface +::GetFirstWavelengths( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no Ikonos Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + std::string key= "support_data.number_bands"; + int nbBands = ossimString(kwl.find(key.c_str())).toInt(); + + // Panchromatic case + if(nbBands==1) + { + wavel.SetSize(1); + wavel.Fill(0.526); + } + else if(nbBands==4) + { + wavel.SetSize(4); + wavel[0] = 0.445; + wavel[1] = 0.506; + wavel[2] = 0.632; + wavel[3] = 0.757; + } + else + itkExceptionMacro(<<"Invalid number of bands..."); + + return wavel; +} + + +IkonosImageMetadataInterface::VariableLengthVectorType +IkonosImageMetadataInterface +::GetLastWavelengths( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no Ikonos Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + std::string key= "support_data.number_bands"; + int nbBands = ossimString(kwl.find(key.c_str())).toInt(); + + // Panchromatic case + if(nbBands==1) + { + wavel.SetSize(1); + wavel.Fill(0.929); + } + else if(nbBands==4) + { + wavel.SetSize(4); + wavel[0] = 0.516; + wavel[1] = 0.595; + wavel[2] = 0.698; + wavel[3] = 0.853; + } + else + itkExceptionMacro(<<"Invalid number of bands..."); + + return wavel; +} + } // end namespace otb diff --git a/Code/IO/otbIkonosImageMetadataInterface.h b/Code/IO/otbIkonosImageMetadataInterface.h index 161d9c7384444f04f8ddc154c15cdc6f052d9f06..a8d091570dff707d4e03a38b4f21d7df5136fa3b 100644 --- a/Code/IO/otbIkonosImageMetadataInterface.h +++ b/Code/IO/otbIkonosImageMetadataInterface.h @@ -93,6 +93,12 @@ public: /** Get the sat azimuth from the ossim metadata */ double GetSatAzimuth( const MetaDataDictionaryType & dict ) const; + /** Get the first wavelength for the spectral band definition */ + VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & dict ) const; + + /** Get the last wavelength for the spectral band definition */ + VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & dict ) const; + bool CanRead( const MetaDataDictionaryType & dict) const; diff --git a/Code/IO/otbImageMetadataInterfaceBase.h b/Code/IO/otbImageMetadataInterfaceBase.h index 3a95fc0e97ebeda54bb9da2b8471fe0dd24d5bbb..3ddc902354afbc343fec14ff64ac0b8e5917766d 100644 --- a/Code/IO/otbImageMetadataInterfaceBase.h +++ b/Code/IO/otbImageMetadataInterfaceBase.h @@ -194,6 +194,14 @@ public: virtual double GetSatAzimuth( const MetaDataDictionaryType & dict ) const =0; otbMetadataGetMacro(SatAzimuth, double); + /** Get the first wavelength for the spectral band definition */ + virtual VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & dict ) const =0; + otbMetadataGetMacro(FirstWavelengths, VariableLengthVectorType); + + /** Get the last wavelength for the spectral band definition */ + virtual VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & dict ) const =0; + otbMetadataGetMacro(LastWavelengths, VariableLengthVectorType); + virtual bool CanRead( const MetaDataDictionaryType & dict ) const =0; virtual void PrintSelf(std::ostream& os, itk::Indent indent, const MetaDataDictionaryType & dict) const; diff --git a/Code/IO/otbQuickBirdImageMetadataInterface.cxx b/Code/IO/otbQuickBirdImageMetadataInterface.cxx index 26d74ae29f2b8315d032714d083e4667381dd09b..b5dd89f1d68ac794d60a305ed467d9e1fb996ea2 100755 --- a/Code/IO/otbQuickBirdImageMetadataInterface.cxx +++ b/Code/IO/otbQuickBirdImageMetadataInterface.cxx @@ -625,6 +625,101 @@ QuickBirdImageMetadataInterface::GetSatAzimuth( const MetaDataDictionaryType & d return keywordString.toDouble(); } +QuickBirdImageMetadataInterface::VariableLengthVectorType +QuickBirdImageMetadataInterface +::GetFirstWavelengths( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no QuickBird Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + std::string key = "support_data.band_id"; + ossimString keywordStringBId = kwl.find(key.c_str()); + + if (keywordStringBId != ossimString("P") && keywordStringBId != ossimString("Multi")) + { + itkExceptionMacro(<<"Invalid bandID "<<keywordStringBId); + } + + // Panchromatic case + if (keywordStringBId == ossimString("P") ) + { + wavel.SetSize(1); + wavel.Fill(0.450); + } + else + { + wavel.SetSize(4); + wavel[0] = 0.450; + wavel[1] = 0.520; + wavel[2] = 0.630; + wavel[3] = 0.760; + } + + return wavel; +} + + +QuickBirdImageMetadataInterface::VariableLengthVectorType +QuickBirdImageMetadataInterface +::GetLastWavelengths( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no QuickBird Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + std::string key = "support_data.band_id"; + ossimString keywordStringBId = kwl.find(key.c_str()); + + if (keywordStringBId != ossimString("P") && keywordStringBId != ossimString("Multi")) + { + itkExceptionMacro(<<"Invalid bandID "<<keywordStringBId); + } + + // Panchromatic case + if (keywordStringBId == ossimString("P") ) + { + wavel.SetSize(1); + wavel.Fill(0.900); + } + else + { + wavel.SetSize(4); + wavel[0] = 0.520; + wavel[1] = 0.600; + wavel[2] = 0.690; + wavel[3] = 0.900; + } + + return wavel; +} + } // end namespace otb diff --git a/Code/IO/otbQuickBirdImageMetadataInterface.h b/Code/IO/otbQuickBirdImageMetadataInterface.h index 0c9000f92f457e369731d6d92e2b7dd7fb6e12e7..73c2c757a5d2be1a36dc6c21f04295962e0a12f5 100644 --- a/Code/IO/otbQuickBirdImageMetadataInterface.h +++ b/Code/IO/otbQuickBirdImageMetadataInterface.h @@ -91,6 +91,12 @@ public: /** Get the sat azimuth from the ossim metadata */ double GetSatAzimuth( const MetaDataDictionaryType & dict ) const; + + /** Get the first wavelength for the spectral band definition */ + VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & dict ) const; + + /** Get the last wavelength for the spectral band definition */ + VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & dict ) const; bool CanRead( const MetaDataDictionaryType & dict) const; diff --git a/Code/IO/otbSpotImageMetadataInterface.cxx b/Code/IO/otbSpotImageMetadataInterface.cxx index 2d03f6fa3716a5e5aaf4b32ac0cf349754ab4262..7b930df34ee285b20473d2993a54624b0b137ce9 100755 --- a/Code/IO/otbSpotImageMetadataInterface.cxx +++ b/Code/IO/otbSpotImageMetadataInterface.cxx @@ -532,5 +532,107 @@ SpotImageMetadataInterface::GetSatAzimuth( const MetaDataDictionaryType & dict ) return satAz; } +SpotImageMetadataInterface::VariableLengthVectorType +SpotImageMetadataInterface +::GetFirstWavelengths( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no Spot Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + std::string key= "support_data.number_bands"; + int nbBands = ossimString(kwl.find(key.c_str())).toInt(); + std::string sensorId = this->GetSensorID(dict); + + // Panchromatic case + if(nbBands==1) + { + wavel.SetSize(1); + if(sensorId == "SPOT4") + wavel.Fill(0.610); + else if(sensorId == "SPOT5") + wavel.Fill(0.480); + else + itkExceptionMacro(<<"Invalid Spot Sensor ID"); + } + else if(nbBands>1 && nbBands<5) + { + wavel.SetSize(4); + wavel[0] = 0.500; + wavel[1] = 0.610; + wavel[2] = 0.780; + wavel[3] = 1.580; + } + else + itkExceptionMacro(<<"Invalid number of bands..."); + + return wavel; +} + + +SpotImageMetadataInterface::VariableLengthVectorType +SpotImageMetadataInterface +::GetLastWavelengths( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no Spot Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + std::string key= "support_data.number_bands"; + int nbBands = ossimString(kwl.find(key.c_str())).toInt(); + std::string sensorId = this->GetSensorID(dict); + + // Panchromatic case + if(nbBands==1) + { + wavel.SetSize(1); + if(sensorId == "SPOT4") + wavel.Fill(0.680); + else if(sensorId == "SPOT5") + wavel.Fill(0.710); + else + itkExceptionMacro(<<"Invalid Spot Sensor ID"); + } + else if(nbBands>1 && nbBands<5) + { + wavel.SetSize(4); + wavel[0] = 0.590; + wavel[1] = 0.680; + wavel[2] = 0.890; + wavel[3] = 1.750; + } + else + itkExceptionMacro(<<"Invalid number of bands..."); + + return wavel; +} + } // end namespace otb diff --git a/Code/IO/otbSpotImageMetadataInterface.h b/Code/IO/otbSpotImageMetadataInterface.h index f73e31e713543d4604c4875d127cccdbc0f7935e..4d6b9672e1b3e685dccf1f52976690dc735f2b9f 100644 --- a/Code/IO/otbSpotImageMetadataInterface.h +++ b/Code/IO/otbSpotImageMetadataInterface.h @@ -93,6 +93,12 @@ public: /** Get the sat azimuth from the ossim metadata */ double GetSatAzimuth( const MetaDataDictionaryType & dict ) const; + /** Get the first wavelength for the spectral band definition */ + VariableLengthVectorType GetFirstWavelengths( const MetaDataDictionaryType & dict ) const; + + /** Get the last wavelength for the spectral band definition */ + VariableLengthVectorType GetLastWavelengths( const MetaDataDictionaryType & dict ) const; + bool CanRead( const MetaDataDictionaryType & dict) const; diff --git a/Code/Learning/otbSOMWithMissingValue.txx b/Code/Learning/otbSOMWithMissingValue.txx index 57d8cd449d30e38b5e1db87e91426ab4440347bd..080c0080d875bc19bab231f836e2615a84a36823 100644 --- a/Code/Learning/otbSOMWithMissingValue.txx +++ b/Code/Learning/otbSOMWithMissingValue.txx @@ -9,11 +9,11 @@ Version: $Revision$ Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. See OTBCopyright.txt for details. -Copyright (c) Institut Telecom ; Telecom bretagne. All rights reserved. +Copyright (c) Institut Telecom ; Telecom bretagne. All rights reserved. See ITCopyright.txt for details. -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +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. =========================================================================*/ @@ -33,21 +33,19 @@ PURPOSE. See the above copyright notices for more information. namespace otb { /** - * Update the output map with a new sample by including the case when some + * Update the output map with a new sample by including the case when some * components of this new sample may be missing. * \param sample The new sample to learn, * \param beta The learning coefficient, * \param radius The radius of the nieghbourhood. */ template < class TListSample, class TMap, - class TSOMLearningBehaviorFunctor, + class TSOMLearningBehaviorFunctor, class TSOMNeighborhoodBehaviorFunctor > void SOMWithMissingValue< TListSample, TMap, TSOMLearningBehaviorFunctor, TSOMNeighborhoodBehaviorFunctor > ::UpdateMap( const NeuronType& sample, double beta, SizeType& radius ) { - int i,j; - // output map pointer MapPointerType map = this->GetOutput(0); @@ -61,7 +59,7 @@ SOMWithMissingValue< TListSample, TMap, TSOMLearningBehaviorFunctor, TSOMNeighbo typename MapType::RegionType mapRegion = map->GetLargestPossibleRegion(); NeighborhoodIteratorType it ( radius, map, mapRegion ); - // Here, the periodic update is achieved 'by hand' since + // Here, the periodic update is achieved 'by hand' since // PeriodicBoundaryCondition does not allow to modifiy // VectorImage contents SizeType mapSize = mapRegion.GetSize(); @@ -70,22 +68,22 @@ SOMWithMissingValue< TListSample, TMap, TSOMLearningBehaviorFunctor, TSOMNeighbo // Iterate over the neighborhood ot the winner neuron it.SetLocation( position ); - for ( i = 0; i < it.Size(); i++ ) + for (unsigned int i = 0; i < it.Size(); i++ ) { typename NeighborhoodIteratorType::OffsetType offset = it.GetOffset(i); - + // The neighborhood is of elliptic shape double theDistance = itk::NumericTraits< double >::Zero; - for ( j = 0; j < MapType::ImageDimension; j++ ) + for (int j = 0; j < MapType::ImageDimension; j++ ) theDistance += pow( static_cast<double>( offset[j] ), 2.0 ) / pow( static_cast<double>( radius[j] ), 2.0 ); if ( theDistance <= 1.0 ) { - for ( j = 0; j < MapType::ImageDimension; j++ ) + for (int j = 0; j < MapType::ImageDimension; j++ ) { int pos = offset[j] + position[j]; - positionToUpdate[j] = ( pos >= 0 ) ? + positionToUpdate[j] = ( pos >= 0 ) ? pos % mapSize[j] : ( mapSize[j] - ( (-pos) % mapSize[j] ) ) % mapSize[j]; } @@ -94,7 +92,7 @@ SOMWithMissingValue< TListSample, TMap, TSOMLearningBehaviorFunctor, TSOMNeighbo NeuronType newNeuron ( tempNeuron ); double tempBeta = beta / ( 1.0 + theDistance ); - for( j = 0; j < newNeuron.Size(); j++ ) + for(unsigned int j = 0; j < newNeuron.Size(); j++ ) { if ( !DistanceType::IsMissingValue( sample[j] ) ) newNeuron[j] += static_cast<typename NeuronType::ValueType>( diff --git a/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx b/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx index 3ef2a925efca017035ac80da24b92c180d16464c..e99d56c0c3c35af0e168f181271670796d1e5d2c 100644 --- a/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx +++ b/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx @@ -18,6 +18,12 @@ PURPOSE. See the above copyright notices for more information. #include "otbAtmosphericCorrectionParameters.h" +#include "otbAeronetFileReader.h" +#include <fstream> +#include <iostream> + + + namespace otb { /*********************** FilterFunctionValues **************************/ @@ -26,6 +32,7 @@ FilterFunctionValues { m_MinSpectralValue = 0; m_MaxSpectralValue = 0; + m_UserStep = 0.0025; m_FilterFunctionValues.clear(); } @@ -59,9 +66,56 @@ FilterFunctionValues AtmosphericCorrectionParameters ::AtmosphericCorrectionParameters() { - m_AerosolModel = CONTINENTAL; + m_SolarZenithalAngle = 361.; + m_SolarAzimutalAngle = 361.; + m_ViewingZenithalAngle = 361.; + m_ViewingAzimutalAngle = 361.; + m_Month = 0; + m_Day = 0; + m_AtmosphericPressure = 1030.; + m_WaterVaporAmount = 2.5; + m_OzoneAmount = 0.28; + m_AerosolModel = CONTINENTAL; + m_AerosolOptical = 0.2; } +/** Get data from aeronet file*/ +void +AtmosphericCorrectionParameters +::UpdateAeronetData( std::string file, int year, int month, int day, int hour, int minute, double epsi ) +{ + if(file == "") + itkExceptionMacro(<<"No Aeronet filename specified."); + + AeronetFileReader::Pointer reader = AeronetFileReader::New(); + reader->SetFileName(file); + reader->SetDay(day); + reader->SetMonth(month); + reader->SetYear(year); + reader->SetHour(hour); + reader->SetMinute(minute); + reader->SetEpsilon(epsi); + std::cout<<day<<std::endl; + std::cout<<month<<std::endl; + std::cout<<year<<std::endl; + std::cout<<hour<<std::endl; + std::cout<<minute<<std::endl; + std::cout<<epsi<<std::endl; + + std::cout<<reader->GetDay()<<std::endl; + std::cout<<reader->GetMonth()<<std::endl; + std::cout<<reader->GetYear()<<std::endl; + std::cout<<reader->GetHour()<<std::endl; + std::cout<<reader->GetMinute()<<std::endl; + std::cout<<reader->GetEpsilon()<<std::endl; + + reader->Update(); + + m_AerosolOptical = reader->GetOutput()->GetAerosolOpticalThickness(); + m_WaterVaporAmount = reader->GetOutput()->GetWater(); +} + + /**PrintSelf method */ void AtmosphericCorrectionParameters diff --git a/Code/Radiometry/otbAtmosphericCorrectionParameters.h b/Code/Radiometry/otbAtmosphericCorrectionParameters.h index 79fff9db12cfc4d20c3b6fca44059271247b7269..353bbe6cc4a77597861fa0b2bb9411a24976e5c5 100644 --- a/Code/Radiometry/otbAtmosphericCorrectionParameters.h +++ b/Code/Radiometry/otbAtmosphericCorrectionParameters.h @@ -90,6 +90,7 @@ public: /** Get user step between each wavelenght spectral band values. */ itkGetMacro(UserStep,WavelenghtSpectralBandType); + protected: /** Constructor */ FilterFunctionValues(); @@ -103,8 +104,7 @@ protected: private: FilterFunctionValues(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented - - + /** Vector that contains the filter function value. */ ValuesVectorType m_FilterFunctionValues; /** Vector that contains the filter function value in 6S format (step of 0.0025µm). @@ -242,6 +242,22 @@ public: return &m_WavelenghtSpectralBand; }; + /** Read the aeronet data and extract aerosol optical and water vapor amount. */ + void UpdateAeronetData( std::string file, int year, int month, int day, int hour, int minute, double epsi ); + void UpdateAeronetData( std::string file, int year, int month, int day, int hour, int minute ) + { + this->UpdateAeronetData( file, year, month, day, hour, minute, 0.4 ); + }; + void UpdateAeronetData( std::string file, int year, int hour, int minute, double epsi ) + { + this->UpdateAeronetData( file, year, m_Month, m_Day, hour, minute, epsi ); + }; + void UpdateAeronetData( std::string file, int year, int hour, int minute ) + { + this->UpdateAeronetData( file, year, m_Month, m_Day, hour, minute, 0.4 ); + }; + + /** Constructor */ AtmosphericCorrectionParameters(); /** Destructor */ @@ -278,10 +294,8 @@ private: AerosolModelType m_AerosolModel; /** The Aerosol optical (radiative impact of aerosol for the reference wavelenght 550-nm) */ double m_AerosolOptical; - /** Wavelenght for the each spectral band definition */ WavelenghtSpectralBandVectorType m_WavelenghtSpectralBand; - }; } // end namespace otb diff --git a/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx b/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx index 8fc75cc5c71d32d1239b446a6830baeb22950567..05ee358b6fcca626f72d957f47b943f88c3abca0 100644 --- a/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx +++ b/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx @@ -155,10 +155,10 @@ AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms double upwardDirectTransmittance(0.); double upwardDiffuseTransmittanceForRayleigh(0.); double upwardDiffuseTransmittanceForAerosol(0.); - + for (unsigned int i=0; i<NbBand; ++i) { - atmosphericReflectance = 0.; + atmosphericReflectance = 0.; atmosphericSphericalAlbedo = 0.; totalGaseousTransmission = 0.; downwardTransmittance = 0.; diff --git a/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx b/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx index e3540908cf148ff780c28b0cdf69e26dced2754d..9f615440d749dee14e6052ced9f87b7060e61ebe 100644 --- a/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx +++ b/Code/Radiometry/otbAtmosphericRadiativeTerms.cxx @@ -505,6 +505,15 @@ AtmosphericRadiativeTerms { os << indent << "Channel "<< i << " : "<< std::endl; //ValueType::(os,indent); + os << indent << "Intrinsic Atmospheric Reflectance : " << m_Values[i]->GetIntrinsicAtmosphericReflectance() << std::endl; + os << indent << "Shperical Albedo of the Atmosphere : " << m_Values[i]->GetSphericalAlbedo() << std::endl; + os << indent << "Total Gaseous Transmission : " << m_Values[i]->GetTotalGaseousTransmission() << std::endl; + os << indent << "Downward Transmittance of the Atmospher : " << m_Values[i]->GetDownwardTransmittance() << std::endl; + os << indent << "Upward Transmittance of the Atmospher : " << m_Values[i]->GetUpwardTransmittance() << std::endl; + os << indent << "Upward diffuse transmittance : " << m_Values[i]->GetUpwardDiffuseTransmittance() << std::endl; + os << indent << "Upward direct transmittance : " << m_Values[i]->GetUpwardDirectTransmittance() << std::endl; + os << indent << "Upward diffuse transmittance for rayleigh: " << m_Values[i]->GetUpwardDiffuseTransmittanceForRayleigh() << std::endl; + os << indent << "Upward diffuse transmittance for aerosols: " << m_Values[i]->GetUpwardDiffuseTransmittanceForAerosol() << std::endl; } } diff --git a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h index 251cd9393fac69c4de53830e18b71e835d492ee8..8111427e48ad6d231c6e872443d1b723a2a73d67 100644 --- a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h +++ b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h @@ -23,9 +23,11 @@ #define __otbReflectanceToSurfaceReflectanceImageFilter_h -#include "otbAtmosphericRadiativeTerms.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbAtmosphericRadiativeTerms.h" +#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" +#include "itkMetaDataDictionary.h" namespace otb { @@ -144,64 +146,90 @@ public: itkTypeMacro(ReflectanceToSurfaceReflectanceImageFilter, UnaryImageFunctorWithVectorImageFilter); /** Supported images definition. */ - typedef typename InputImageType::PixelType InputPixelType; - typedef typename InputImageType::InternalPixelType InputInternalPixelType; - typedef typename InputImageType::RegionType InputImageRegionType; - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; - typedef typename OutputImageType::RegionType OutputImageRegionType; - - typedef AtmosphericRadiativeTerms::Pointer AtmosphericRadiativeTermsPointerType; + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms Parameters2RadiativeTermsType; + typedef Parameters2RadiativeTermsType::Pointer Parameters2RadiativeTermsPointerType; + typedef AtmosphericCorrectionParameters::Pointer CorrectionParametersPointerType; + typedef AtmosphericRadiativeTerms::Pointer AtmosphericRadiativeTermsPointerType; + + typedef FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::ValuesVectorType CoefVectorType; + typedef std::vector<CoefVectorType> FilterFunctionCoefVectorType; + + typedef itk::MetaDataDictionary MetaDataDictionaryType; /** Get/Set Atmospheric Radiative Terms. */ void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmo) { m_AtmosphericRadiativeTerms = atmo; this->SetNthInput(1, m_AtmosphericRadiativeTerms); + m_IsSetAtmosphericRadiativeTerms = true; this->Modified(); } - AtmosphericRadiativeTermsPointerType GetAtmosphericRadiativeTerms() + + /** Get/Set Atmospheric Correction Parameters. */ + itkGetConstObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTerms); + itkGetObjectMacro(CorrectionParameters, AtmosphericCorrectionParameters); + + /** Get/Set Aeronet file name. */ + itkSetMacro(AeronetFileName, std::string); + itkGetMacro(AeronetFileName, std::string); + + /** Get/Set Aeronet file name. */ + itkSetMacro(FilterFunctionValuesFileName, std::string); + itkGetMacro(FilterFunctionValuesFileName, std::string); + + /** Get/Set Filter function coef. */ + void SetFilterFunctionCoef( FilterFunctionCoefVectorType vect ) + { + m_FilterFunctionCoef = vect; + this->Modified(); + } + FilterFunctionCoefVectorType GetFilterFunctionCoef() { - return m_AtmosphericRadiativeTerms; + return m_FilterFunctionCoef; } - protected: /** Constructor */ - ReflectanceToSurfaceReflectanceImageFilter() - { - m_AtmosphericRadiativeTerms = AtmosphericRadiativeTerms::New(); - }; + ReflectanceToSurfaceReflectanceImageFilter(); /** Destructor */ virtual ~ReflectanceToSurfaceReflectanceImageFilter() {}; - /** Initialize the functor vector */ - void BeforeThreadedGenerateData () - { - this->GetFunctorVector().clear(); - for (unsigned int i = 0;i<this->GetInput()->GetNumberOfComponentsPerPixel();++i) - { - double coef; - double res; - coef = static_cast<double>(m_AtmosphericRadiativeTerms->GetTotalGaseousTransmission(i) - * m_AtmosphericRadiativeTerms->GetDownwardTransmittance(i) - * m_AtmosphericRadiativeTerms->GetUpwardTransmittance(i) ); - coef = 1. / coef; - res = -m_AtmosphericRadiativeTerms->GetIntrinsicAtmosphericReflectance(i) * coef; - - FunctorType functor; - functor.SetCoefficient(coef); - functor.SetResidu(res); - functor.SetSphericalAlbedo(static_cast<double>(m_AtmosphericRadiativeTerms->GetSphericalAlbedo(i))); - - this->GetFunctorVector().push_back(functor); - } - } + /** If empty, fill AtmosphericRadiativeTerms using image metadata*/ + void UpdateAtmosphericRadiativeTerms( const MetaDataDictionaryType dict ); + /** Read the aeronet data and extract aerosol optical and water vapor amount. */ + void UpdateAeronetData( const MetaDataDictionaryType dict ); + + /** Initialize the functor vector */ + void BeforeThreadedGenerateData(); + + private: AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; + CorrectionParametersPointerType m_CorrectionParameters; + bool m_IsSetAtmosphericRadiativeTerms; + /** Path to an Aeronet data file, allows to compute aerosol optical and water vapor amounts. */ + std::string m_AeronetFileName; + /** Path to an filter function values file. */ + std::string m_FilterFunctionValuesFileName; + /** Contains the filter function values (each element is a vector and represnts the values for each channel) */ + FilterFunctionCoefVectorType m_FilterFunctionCoef; + /** BeforeThreadedGenerateData executed once or not */ + bool m_BeforeDone; }; } // end namespace otb +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbReflectanceToSurfaceReflectanceImageFilter.txx" +#endif + #endif diff --git a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx new file mode 100644 index 0000000000000000000000000000000000000000..dfd308f36017fd52aa28e06c9fa58e8fbfa79324 --- /dev/null +++ b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx @@ -0,0 +1,152 @@ +/*========================================================================= + + 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 __otbReflectanceToSurfaceReflectanceImageFilter_txx +#define __otbReflectanceToSurfaceReflectanceImageFilter_txx + +#include "otbReflectanceToSurfaceReflectanceImageFilter.h" +#include "otbImageMetadataInterfaceFactory.h" +#include "otbImageMetadataInterfaceBase.h" +#include "otbAeronetFileReader.h" + +namespace otb +{ + +/** + * Constructor + */ +template <class TInputImage, class TOutputImage> +ReflectanceToSurfaceReflectanceImageFilter<TInputImage,TOutputImage> +::ReflectanceToSurfaceReflectanceImageFilter() +{ + m_AtmosphericRadiativeTerms = AtmosphericRadiativeTerms::New(); + m_CorrectionParameters = AtmosphericCorrectionParameters::New(); + m_IsSetAtmosphericRadiativeTerms = false; + m_BeforeDone = false; + m_AeronetFileName = ""; + m_FilterFunctionValuesFileName = ""; + m_FilterFunctionCoef.clear(); +} + + +template <class TInputImage, class TOutputImage> +void +ReflectanceToSurfaceReflectanceImageFilter<TInputImage,TOutputImage> +::UpdateAtmosphericRadiativeTerms( const MetaDataDictionaryType dict ) +{ + ImageMetadataInterfaceBase::Pointer imageMetadataInterface = ImageMetadataInterfaceFactory::CreateIMI(dict); + + if ((m_CorrectionParameters->GetDay() == 0)) + { + m_CorrectionParameters->SetDay(imageMetadataInterface->GetDay(dict)); + } + + if ((m_CorrectionParameters->GetMonth() == 0)) + { + m_CorrectionParameters->SetMonth(imageMetadataInterface->GetMonth(dict)); + } + + if ((m_CorrectionParameters->GetSolarZenithalAngle() == 361.)) + { + m_CorrectionParameters->SetSolarZenithalAngle(90. - imageMetadataInterface->GetSunElevation(dict)); + } + + if ((m_CorrectionParameters->GetSolarAzimutalAngle() == 361.)) + { + m_CorrectionParameters->SetSolarAzimutalAngle(imageMetadataInterface->GetSunAzimuth(dict)); + } + + if ((m_CorrectionParameters->GetViewingZenithalAngle() == 361.)) + { + m_CorrectionParameters->SetViewingZenithalAngle(90. - imageMetadataInterface->GetSatElevation(dict)); + } + + if ((m_CorrectionParameters->GetViewingAzimutalAngle() == 361.)) + { + m_CorrectionParameters->SetViewingAzimutalAngle(imageMetadataInterface->GetSatAzimuth(dict)); + } + + if(m_AeronetFileName != "") + m_CorrectionParameters->UpdateAeronetData( m_AeronetFileName, + imageMetadataInterface->GetYear(dict), + imageMetadataInterface->GetHour(dict), + imageMetadataInterface->GetMinute(dict) ); + + Parameters2RadiativeTermsPointerType param2Terms = Parameters2RadiativeTermsType::New(); + + if( m_FilterFunctionCoef.size() != this->GetInput()->GetNumberOfComponentsPerPixel() ) + itkExceptionMacro(<<"Filter Function and image channels mismatch."); + + for(unsigned int i=0; i<this->GetInput()->GetNumberOfComponentsPerPixel(); i++) + { + FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); + functionValues->SetFilterFunctionValues(m_FilterFunctionCoef[i]); + functionValues->SetMinSpectralValue(imageMetadataInterface->GetFirstWavelengths(dict)[i]); + functionValues->SetMaxSpectralValue(imageMetadataInterface->GetLastWavelengths(dict)[i]); + + m_CorrectionParameters->SetWavelenghtSpectralBandWithIndex(i, functionValues); + } + + param2Terms->SetInput(m_CorrectionParameters); + param2Terms->Update(); + + m_AtmosphericRadiativeTerms = param2Terms->GetOutput(); +} + + +template <class TInputImage, class TOutputImage> +void +ReflectanceToSurfaceReflectanceImageFilter<TInputImage,TOutputImage> +::BeforeThreadedGenerateData() +{ + if(m_BeforeDone == true) + return; + + std::cout<<"BeforeThreadedGenerateData "<<this->GetNumberOfThreads()<<std::endl; + if(m_IsSetAtmosphericRadiativeTerms==false) + this->UpdateAtmosphericRadiativeTerms(this->GetInput()->GetMetaDataDictionary()); + + std::cout<<"m_CorrectionParameters: "<<std::endl; + std::cout<<m_CorrectionParameters<<std::endl; + std::cout<<"m_AtmosphericRadiativeTerms: "<<std::endl; + std::cout<<m_AtmosphericRadiativeTerms<<std::endl; + + this->GetFunctorVector().clear(); + for (unsigned int i = 0;i<this->GetInput()->GetNumberOfComponentsPerPixel();++i) + { + double coef; + double res; + coef = static_cast<double>(m_AtmosphericRadiativeTerms->GetTotalGaseousTransmission(i) + * m_AtmosphericRadiativeTerms->GetDownwardTransmittance(i) + * m_AtmosphericRadiativeTerms->GetUpwardTransmittance(i) ); + coef = 1. / coef; + res = -m_AtmosphericRadiativeTerms->GetIntrinsicAtmosphericReflectance(i) * coef; + + FunctorType functor; + functor.SetCoefficient(coef); + functor.SetResidu(res); + functor.SetSphericalAlbedo(static_cast<double>(m_AtmosphericRadiativeTerms->GetSphericalAlbedo(i))); + + this->GetFunctorVector().push_back(functor); + } + m_BeforeDone = true; + std::cout<<"BeforeThreadedGenerateData FIN"<<std::endl; +} + +} + +#endif diff --git a/Code/Visualization/otbImageLayer.h b/Code/Visualization/otbImageLayer.h index f7f5a0afaad77d567ecd734c003f604b6a5eb158..2448e08e98c8fbdd21e9d764a58d0c10ba7e8efa 100644 --- a/Code/Visualization/otbImageLayer.h +++ b/Code/Visualization/otbImageLayer.h @@ -179,6 +179,22 @@ public: /** Get the pixel location */ virtual PointType GetPixelLocation(const IndexType & index); + /** Get the list sample used by the rendering function */ + virtual ListSamplePointerType GetListSample() + { +// this->UpdateListSample();//FIXME condition to IsModified + return m_ListSample; + } + + /** Set the list sample used by the rendering function */ + virtual void SetListSample(ListSamplePointerType listSample) + { + m_ListSample = listSample; + m_ListSampleProvided = true; + m_RenderingFunction->SetListSample(m_ListSample); + } + + protected: /** Constructor */ ImageLayer(); @@ -190,12 +206,6 @@ protected: /** Update the histogram */ virtual void UpdateListSample(); - virtual ListSamplePointerType GetListSample() - { -// this->UpdateListSample();//FIXME condition to IsModified - return m_ListSample; - } - /** Update the images */ virtual void RenderImages(); @@ -219,6 +229,7 @@ private: /** List sample used to compute the histogram by the rendering function*/ ListSamplePointerType m_ListSample; + bool m_ListSampleProvided;//To remember if the list sample was provided manually by the user /** Rendering function */ RenderingFunctionPointerType m_RenderingFunction; diff --git a/Code/Visualization/otbImageLayer.txx b/Code/Visualization/otbImageLayer.txx index 2f3e5f1c068346ccfd19b67e0f1d81c8cb359d04..6e55f08a53fdc49f41d57884a071a58a3227f7e1 100644 --- a/Code/Visualization/otbImageLayer.txx +++ b/Code/Visualization/otbImageLayer.txx @@ -31,7 +31,7 @@ namespace otb template <class TImage, class TOutputImage> ImageLayer<TImage,TOutputImage> -::ImageLayer() : m_Quicklook(), m_Image(), m_ListSample(), m_RenderingFunction(), +::ImageLayer() : m_Quicklook(), m_Image(), m_ListSample(), m_ListSampleProvided(false), m_RenderingFunction(), m_QuicklookRenderingFilter(), m_ExtractRenderingFilter(), m_ScaledExtractRenderingFilter(), m_ExtractFilter(), m_ScaledExtractFilter() { @@ -153,57 +153,60 @@ void ImageLayer<TImage,TOutputImage> ::UpdateListSample() { -// otbMsgDevMacro(<<"ImageLayer::UpdateListSample():"<<" ("<<this->GetName()<<")"<< " Entering method"); - // Declare the source of the histogram - ImagePointerType histogramSource; + if(!m_ListSampleProvided) + { + // otbMsgDevMacro(<<"ImageLayer::UpdateListSample():"<<" ("<<this->GetName()<<")"<< " Entering method"); + // Declare the source of the histogram + ImagePointerType histogramSource; - // if there is a quicklook, use it for histogram generation - if(m_Quicklook.IsNotNull()) - { - histogramSource = m_Quicklook; - } - else - { - // Else use the full image (update the data) - // REVIEW: Not sure the region is right here. Should be the - // largest ? - // REPLY: might be... didn't change anything - // - histogramSource = m_Image; - histogramSource->SetRequestedRegion(this->GetExtractRegion()); - } + // if there is a quicklook, use it for histogram generation + if(m_Quicklook.IsNotNull()) + { + histogramSource = m_Quicklook; + } + else + { + // Else use the full image (update the data) + // REVIEW: Not sure the region is right here. Should be the + // largest ? + // REPLY: might be... didn't change anything + // + histogramSource = m_Image; + histogramSource->SetRequestedRegion(this->GetExtractRegion()); + } - // Check if we need to generate the histogram again - if( m_ListSample.IsNull() || m_ListSample->Size() == 0 || (histogramSource->GetUpdateMTime() < histogramSource->GetPipelineMTime()) ) - { - otbMsgDevMacro(<<"ImageLayer::UpdateListSample():"<<" ("<<this->GetName()<<")"<< " Regenerating histogram due to pippeline update."); + // Check if we need to generate the histogram again + if( m_ListSample.IsNull() || m_ListSample->Size() == 0 || (histogramSource->GetUpdateMTime() < histogramSource->GetPipelineMTime()) ) + { + otbMsgDevMacro(<<"ImageLayer::UpdateListSample():"<<" ("<<this->GetName()<<")"<< " Regenerating histogram due to pippeline update."); - // Update the histogram source - histogramSource->Update(); + // Update the histogram source + histogramSource->Update(); - // Iterate on the image - itk::ImageRegionConstIterator<ImageType> it(histogramSource,histogramSource->GetBufferedRegion()); + // Iterate on the image + itk::ImageRegionConstIterator<ImageType> it(histogramSource,histogramSource->GetBufferedRegion()); - // declare a list to store the samples - m_ListSample->Clear(); + // declare a list to store the samples + m_ListSample->Clear(); - unsigned int sampleSize = VisualizationPixelTraits::PixelSize(it.Get()); - m_ListSample->SetMeasurementVectorSize(sampleSize); + unsigned int sampleSize = VisualizationPixelTraits::PixelSize(it.Get()); + m_ListSample->SetMeasurementVectorSize(sampleSize); - // Fill the samples list - it.GoToBegin(); - while(!it.IsAtEnd()) - { - SampleType sample(sampleSize); - VisualizationPixelTraits::Convert( it.Get(), sample ); - m_ListSample->PushBack(sample); - ++it; - } - otbMsgDevMacro(<<"ImageLayer::UpdateListSample()"<<" ("<<this->GetName()<<")"<< " Sample list generated ("<<m_ListSample->Size()<<" samples, "<< sampleSize <<" bands)"); + // Fill the samples list + it.GoToBegin(); + while(!it.IsAtEnd()) + { + SampleType sample(sampleSize); + VisualizationPixelTraits::Convert( it.Get(), sample ); + m_ListSample->PushBack(sample); + ++it; + } + otbMsgDevMacro(<<"ImageLayer::UpdateListSample()"<<" ("<<this->GetName()<<")"<< " Sample list generated ("<<m_ListSample->Size()<<" samples, "<< sampleSize <<" bands)"); - m_RenderingFunction->SetListSample(m_ListSample); + m_RenderingFunction->SetListSample(m_ListSample); - } + } + } } diff --git a/Code/Visualization/otbImageLayerRenderingModel.h b/Code/Visualization/otbImageLayerRenderingModel.h index 7a7654acb877979a14ee86ee7b4c50a58635fdf4..cb040493996a70c9d99ff372f4df0010f071d3c1 100644 --- a/Code/Visualization/otbImageLayerRenderingModel.h +++ b/Code/Visualization/otbImageLayerRenderingModel.h @@ -40,14 +40,15 @@ namespace otb * \ingroup Visualization */ -template <class TOutputImage = otb::Image<itk::RGBAPixel<unsigned char>,2 > > +template <class TOutputImage = otb::Image<itk::RGBAPixel<unsigned char>,2 >, + class TLayer = otb::ImageLayerBase<TOutputImage> > class ImageLayerRenderingModel - : public MVCModelBase<ImageLayerRenderingModelListener>, public LayerBasedModel< ImageLayerBase<TOutputImage> > + : public MVCModelBase<ImageLayerRenderingModelListener>, public LayerBasedModel< TLayer > { public: /** Standard class typedefs */ typedef ImageLayerRenderingModel Self; - typedef LayerBasedModel< ImageLayerBase <TOutputImage> > Superclass; + typedef LayerBasedModel<TLayer> Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; diff --git a/Code/Visualization/otbImageLayerRenderingModel.txx b/Code/Visualization/otbImageLayerRenderingModel.txx index ceeca9568648ee5212d7c5b92719b70b595d2a93..f00ff1103f5553e662162604bdfd3397d00c37b6 100644 --- a/Code/Visualization/otbImageLayerRenderingModel.txx +++ b/Code/Visualization/otbImageLayerRenderingModel.txx @@ -25,8 +25,8 @@ namespace otb { -template <class TOutputImage> -ImageLayerRenderingModel<TOutputImage> +template <class TOutputImage, class TLayer> +ImageLayerRenderingModel<TOutputImage, TLayer> ::ImageLayerRenderingModel() : m_Name("Default"), m_RasterizedQuicklook(), m_HasQuicklook(false),m_RasterizedExtract(),m_HasExtract(false), m_ExtractRegion(), m_RasterizedScaledExtract(), m_HasScaledExtract(false), @@ -40,14 +40,14 @@ ImageLayerRenderingModel<TOutputImage> m_ScaledExtractBlendingFilterList = BlendingFilterListType::New(); } -template <class TOutputImage> -ImageLayerRenderingModel<TOutputImage> +template <class TOutputImage, class TLayer> +ImageLayerRenderingModel<TOutputImage, TLayer> ::~ImageLayerRenderingModel() {} -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::Update() { // Multiple concurrent update guards @@ -65,9 +65,9 @@ ImageLayerRenderingModel<TOutputImage> } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::Init() { m_QuicklookBlendingFilterList = BlendingFilterListType::New(); @@ -80,9 +80,9 @@ ImageLayerRenderingModel<TOutputImage> -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::RenderVisibleLayers() { // Render all visible layers @@ -105,9 +105,9 @@ ImageLayerRenderingModel<TOutputImage> } } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::RasterizeVisibleLayers() { // If there are no layer to render @@ -240,9 +240,9 @@ ImageLayerRenderingModel<TOutputImage> } } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::Notify(ListenerType * listener) { // Notify the listener @@ -251,9 +251,9 @@ ImageLayerRenderingModel<TOutputImage> } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::SetScaledExtractRegionCenter(const IndexType & index) { // Set the center of the scaled extract region @@ -263,9 +263,9 @@ ImageLayerRenderingModel<TOutputImage> m_ScaledExtractRegion.SetIndex(newIndex); } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::SetExtractRegionCenter(const IndexType & index) { // Set the center of the extract region @@ -281,9 +281,9 @@ ImageLayerRenderingModel<TOutputImage> } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::SetExtractRegionByIndex( const IndexType & startIndex, const IndexType & stopIndex ) { RegionType lImageRegion; @@ -307,9 +307,9 @@ ImageLayerRenderingModel<TOutputImage> } } -template <class TOutputImage> +template <class TOutputImage, class TLayer> unsigned int -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::GetSubsamplingRate() { if(this->GetNumberOfLayers() < 1) @@ -323,10 +323,10 @@ ImageLayerRenderingModel<TOutputImage> return baseLayer->GetQuicklookSubsamplingRate(); } -template <class TOutputImage> -typename ImageLayerRenderingModel<TOutputImage> +template <class TOutputImage, class TLayer> +typename ImageLayerRenderingModel<TOutputImage, TLayer> ::RegionType -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::ConstrainRegion(const RegionType & small, const RegionType & big) { RegionType resp = small; @@ -365,9 +365,9 @@ ImageLayerRenderingModel<TOutputImage> return resp; } -template <class TOutputImage> +template <class TOutputImage, class TLayer> void -ImageLayerRenderingModel<TOutputImage> +ImageLayerRenderingModel<TOutputImage, TLayer> ::PrintSelf(std::ostream& os, itk::Indent indent) const { // Call superclass implementation diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index b3250947ec677a07bd31da22545eafb332a97b08..6d57d324ca2e591ecc78e3069d380151f0696eea 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -1357,58 +1357,6 @@ ADD_TEST(ioTvSpatialObjectDXFReader ${IO_TESTS11} # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTESTS12 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ------- metadatas OSSIM reading tests ------------------------ - -# --- Quickbird Metadata --- -IF(OTB_DATA_USE_LARGEINPUT) -ADD_TEST(ioTvOSSIMImageQuickbirdMetaDataReader ${IO_TESTS12} - --compare-n-ascii ${EPS} 2 ${BASELINE_FILES}/ioOSSIMImageQuickbirdMetaDataReader.txt - ${TEMP}/ioOSSIMImageQuickbirdMetaDataReader.txt - ${BASELINE_FILES}/ioOSSIMImageQuickbirdMetaDataReader.txt - ${TEMP}/ioOSSIMImageQuickbirdMetaDataReader.txt - otbOSSIMImageMetaDataReaderTest - ${LARGEDATA}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF - ${TEMP}/ioOSSIMImageQuickbirdMetaDataReader.txt - ${TEMP}/ioOSSIMImageQuickbirdMetaDataReader.txt - ) - -# --- Radarsat Metadata --- -ADD_TEST(ioTvOSSIMImageRadarsatMetaDataReader ${IO_TESTS12} - --compare-n-ascii ${EPS} 2 ${BASELINE_FILES}/ioOSSIMImageRadarsatMetaDataReader.txt - ${TEMP}/ioOSSIMImageRadarsatMetaDataReader.txt - ${BASELINE_FILES}/ioOSSIMImageRadarsatMetaDataReader.txt - ${TEMP}/ioOSSIMVectorImageRadarsatMetaDataReader.txt - otbOSSIMImageMetaDataReaderTest - ${LARGEDATA}/RADARSAT2/SCENE01/DAT_01.001 - ${TEMP}/ioOSSIMImageRadarsatMetaDataReader.txt - ${TEMP}/ioOSSIMVectorImageRadarsatMetaDataReader.txt - ) - -# --- ERS2 Metadata --- -ADD_TEST(ioTvOSSIMImageERS2MetaDataReader ${IO_TESTS12} - --compare-n-ascii ${EPS} 2 ${BASELINE_FILES}/ioOSSIMImageERS2MetaDataReader.txt - ${TEMP}/ioOSSIMImageERS2MetaDataReader.txt - ${BASELINE_FILES}/ioOSSIMImageERS2MetaDataReader.txt - ${TEMP}/ioOSSIMVectorImageERS2MetaDataReader.txt - otbOSSIMImageMetaDataReaderTest - ${LARGEDATA}/SAR_ERS2_SLCI_SCENE1/DAT_01.001 - ${TEMP}/ioOSSIMImageERS2MetaDataReader.txt - ${TEMP}/ioOSSIMVectorImageERS2MetaDataReader.txt - ) - -# --- SPOT4 Metadata --- -ADD_TEST(ioTvOSSIMImageSPOT5MetaDataReader ${IO_TESTS12} - --compare-n-ascii ${EPS} 2 ${BASELINE_FILES}/ioOSSIMImageSPOT5MetaDataReader.txt - ${TEMP}/ioOSSIMImageSPOT5MetaDataReader.txt - ${BASELINE_FILES}/ioOSSIMImageSPOT5MetaDataReader.txt - ${TEMP}/ioOSSIMVectorImageSPOT5MetaDataReader.txt - otbOSSIMImageMetaDataReaderTest - ${LARGEDATA}/SPOT5_SCENE01/IMAGERY.TIF - ${TEMP}/ioOSSIMImageSPOT5MetaDataReader.txt - ${TEMP}/ioOSSIMVectorImageSPOT5MetaDataReader.txt - ) -ENDIF(OTB_DATA_USE_LARGEINPUT) - # --- otb::DEMHandler --- ADD_TEST(ioTuDEMHandlerNew ${IO_TESTS12} otbDEMHandlerNew ) @@ -2041,8 +1989,6 @@ otbSpatialObjectDXFReader.cxx ) SET(BasicIO_SRCS12 otbIOTests12.cxx -#otbMultiToMonoChannelExtractROISAR.cxx -otbOSSIMImageMetaDataReaderTest.cxx otbDEMHandlerNew.cxx otbDEMHandlerTest.cxx otbDEMToImageGeneratorNew.cxx diff --git a/Testing/Code/IO/otbIOTests12.cxx b/Testing/Code/IO/otbIOTests12.cxx index 69f54463e7eedd71d18394219552697df20a4911..f861ad8a23c699ab1f90d986a3ce0638a78adc53 100644 --- a/Testing/Code/IO/otbIOTests12.cxx +++ b/Testing/Code/IO/otbIOTests12.cxx @@ -28,15 +28,14 @@ void RegisterTests() { - REGISTER_TEST(otbOSSIMImageMetaDataReaderTest); - REGISTER_TEST(otbDEMHandlerNew); - REGISTER_TEST(otbDEMHandlerTest); - REGISTER_TEST(otbDEMToImageGeneratorNew); - REGISTER_TEST(otbDEMToImageGeneratorTest); - REGISTER_TEST(otbOssimElevManagerTest); - REGISTER_TEST(otbOssimElevManagerTest2); - REGISTER_TEST(otbDEMToOrthoImageGeneratorNew); - REGISTER_TEST(otbDEMToOrthoImageGeneratorTest); - REGISTER_TEST(otbPrepareSRTMDirectoryNew); - REGISTER_TEST(otbPrepareSRTMDirectoryTest); +REGISTER_TEST(otbDEMHandlerNew); +REGISTER_TEST(otbDEMHandlerTest); +REGISTER_TEST(otbDEMToImageGeneratorNew); +REGISTER_TEST(otbDEMToImageGeneratorTest); +REGISTER_TEST(otbOssimElevManagerTest); +REGISTER_TEST(otbOssimElevManagerTest2); +REGISTER_TEST(otbDEMToOrthoImageGeneratorNew); +REGISTER_TEST(otbDEMToOrthoImageGeneratorTest); +REGISTER_TEST(otbPrepareSRTMDirectoryNew); +REGISTER_TEST(otbPrepareSRTMDirectoryTest); } diff --git a/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx b/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx deleted file mode 100644 index 5a465b908559681b5d37e8cdc7d9df85cf458f06..0000000000000000000000000000000000000000 --- a/Testing/Code/IO/otbOSSIMImageMetaDataReaderTest.cxx +++ /dev/null @@ -1,107 +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. - -=========================================================================*/ - -#if defined(_MSC_VER) -#pragma warning ( disable : 4786 ) -#endif - -#include "itkExceptionObject.h" -#include "itkBinaryMedianImageFilter.h" - -#include <iostream> - -#include "otbImage.h" -#include "otbVectorImage.h" - -#include "otbImageFileReader.h" -#include "otbImageKeywordlist.h" - -int otbOSSIMImageMetaDataReaderTest (int argc, char* argv[]) -{ - // Verify the number of parameters in the command line - const char * inputFilename = argv[1]; - const char * outputAsciiFilenameOtbImage = argv[2]; - const char * outputAsciiFilenameOtbVectorImage = argv[3]; - - typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image< InputPixelType, Dimension > InputImageType; - typedef otb::ImageFileReader< InputImageType > ImageReaderType; - - ImageReaderType::Pointer image_reader = ImageReaderType::New(); - image_reader->SetFileName( inputFilename ); - - typedef itk::BinaryMedianImageFilter<InputImageType,InputImageType> MedianFilterType; - MedianFilterType::Pointer image_medianFilter = MedianFilterType::New(); - - - image_medianFilter->SetInput(image_reader->GetOutput()); - image_medianFilter->GetOutput()->UpdateOutputInformation(); - - otb::ImageKeywordlist otb_tmp_image; - /* itk::ExposeMetaData< otb::ImageKeywordlist >(image_medianFilter->GetOutput()->GetMetaDataDictionary(), - otb::MetaDataKey::OSSIMKeywordlistKey, - otb_tmp_image);*/ - - otb_tmp_image = image_reader->GetOutput()->GetImageKeywordlist(); - - if(otb_tmp_image.GetSize()==0) - { - return EXIT_FAILURE; - } - - ossimKeywordlist ossim_kwl_image; - otb_tmp_image.convertToOSSIMKeywordlist(ossim_kwl_image); - - std::cout << " -> otbImage Ossim key word list copy : "<<ossim_kwl_image<<std::endl; - - std::ofstream file; - file.open(outputAsciiFilenameOtbImage); - file << "--- OSSIM KEYWORDLIST ---" << std::endl; - file << ossim_kwl_image; - file.close(); - - typedef otb::VectorImage< InputPixelType, Dimension > InputVectorImageType; - typedef otb::ImageFileReader< InputVectorImageType > VectorImageReaderType; - - VectorImageReaderType::Pointer vector_image_reader = VectorImageReaderType::New(); - vector_image_reader->SetFileName( inputFilename ); - vector_image_reader->GenerateOutputInformation (); - - /* itk::ExposeMetaData< otb::ImageKeywordlist >(vector_image_reader->GetOutput()->GetMetaDataDictionary(), - otb::MetaDataKey::OSSIMKeywordlistKey, - otb_tmp_vector_image);*/ - otb::ImageKeywordlist otb_tmp_vector_image; - otb_tmp_vector_image = vector_image_reader->GetOutput()->GetImageKeywordlist(); - - ossimKeywordlist ossim_kwl_vector_image; - otb_tmp_vector_image.convertToOSSIMKeywordlist(ossim_kwl_vector_image); - - std::cout << " -> otbVectorImage Ossim key word list copy : "<<ossim_kwl_vector_image<<std::endl; - - // std::ofstream file; - file.open(outputAsciiFilenameOtbVectorImage); - file << "--- OSSIM KEYWORDLIST ---" << std::endl; - file << ossim_kwl_vector_image; - file.close(); - - - return EXIT_SUCCESS; -} diff --git a/Testing/Code/MultiScale/CMakeLists.txt b/Testing/Code/MultiScale/CMakeLists.txt index d8c8508d96113b3f3642ba131ee734ce0755dd25..777cff7411ecae1d5fe6fecbc6edbfb8fee81ef8 100644 --- a/Testing/Code/MultiScale/CMakeLists.txt +++ b/Testing/Code/MultiScale/CMakeLists.txt @@ -8,7 +8,8 @@ SET(TEMP ${OTBTesting_BINARY_DIR}/Temporary) #Tolerance sur diff pixel image SET(TOL 0.0) -SET(EPSILON 0.00000001) +SET(EPSILON6 0.000001) +SET(EPSILON8 0.00000001) SET(MULTISCALE_TESTS1 ${CXX_TEST_PATH}/otbMultiScaleTests1) @@ -25,7 +26,7 @@ ADD_TEST(msTuMorphoPyrResamplerNew ${MULTISCALE_TESTS1} otbMorphologicalPyramidResamplerNew) ADD_TEST(msTvMorphoPyrResampler ${MULTISCALE_TESTS1} - --compare-n-images ${EPSILON} 2 + --compare-n-images ${EPSILON8} 2 ${BASELINE}/msPyrResampler_IKO_LesHalles_256_2.hdr ${TEMP}/msPyrResampler_IKO_LesHalles_256_2.hdr ${BASELINE}/msPyrResampler_IKO_LesHalles_full.hdr @@ -83,7 +84,7 @@ ADD_TEST(msTuMorphoPyrMRToMSConverterNew ${MULTISCALE_TESTS1} otbMorphologicalPyramidMRToMSConverterNew) ADD_TEST(msTvMorphoPyrMRToMSConverter ${MULTISCALE_TESTS1} - --compare-n-images ${EPSILON} 3 + --compare-n-images ${EPSILON8} 3 ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_sf_full.hdr ${TEMP}/msPyrMRToMS_IKO_Halles_4_2_sf_full.hdr ${BASELINE}/msPyrMRToMS_IKO_Halles_4_2_if_full.hdr @@ -359,13 +360,13 @@ ADD_TEST(msTvGeodesicMorphologyIterativeDecompositionImageFilter ${MULTISCALE_TE # ------- otb::WaveletOperator ---------- -ADD_TEST(msTuWaveletOperatorNew ${MULTISCALE_TESTS4} +ADD_TEST(msTuWaveletOperatorNew ${MULTISCALE_TESTS4} otbWaveletOperatorNew ) # Further tests ar skiped for the moment due to unexpected "Multiple Defined" errors... #IF(DESACTIVATED_FOR_NOW) -ADD_TEST(msTuWaveletOperator ${MULTISCALE_TESTS4} +ADD_TEST(msTuWaveletOperator ${MULTISCALE_TESTS4} otbWaveletOperator ) # ------- otb::WaveletFilterBankNew ---------- @@ -376,7 +377,7 @@ ADD_TEST(msTuWaveletInverseFilterBankNew ${MULTISCALE_TESTS4} otbWaveletInverseFilterBankNew) ADD_TEST(msTvWaveletFilterBank ${MULTISCALE_TESTS4} - --compare-image ${TOL} + --compare-image ${TOL} ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/ROI_IKO_PAN_LesHalles_FilterBank.tif otbWaveletFilterBank @@ -386,7 +387,7 @@ ADD_TEST(msTvWaveletFilterBank ${MULTISCALE_TESTS4} ) ADD_TEST(msTvWaveletMultiScaleFilterBank ${MULTISCALE_TESTS4} - --compare-image ${TOL} + --compare-image ${EPSILON6} ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/ROI_IKO_PAN_LesHalles_FilterBankMultiScale.tif otbWaveletFilterBank @@ -403,7 +404,7 @@ ADD_TEST(msTuWaveletInverseTransformNew ${MULTISCALE_TESTS4} otbWaveletInverseTransformNew) ADD_TEST(msTvWaveletTransform ${MULTISCALE_TESTS4} - --compare-image ${TOL} + --compare-image ${EPSILON6} ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/ROI_IKO_PAN_LesHalles_Wvlt.tif otbWaveletTransform @@ -413,7 +414,7 @@ ADD_TEST(msTvWaveletTransform ${MULTISCALE_TESTS4} ) ADD_TEST(msTvWaveletMultiScaleTransform ${MULTISCALE_TESTS4} - --compare-image ${TOL} + --compare-image ${TOL} ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/ROI_IKO_PAN_LesHalles_WvltMultiScale.tif otbWaveletTransform @@ -430,7 +431,7 @@ ADD_TEST(msTuWaveletPacketInverseTransformNew ${MULTISCALE_TESTS4} otbWaveletPacketInverseTransformNew) ADD_TEST(msTvWaveletPacketTransform ${MULTISCALE_TESTS4} - --compare-image ${TOL} + --compare-image ${EPSILON6} ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/ROI_IKO_PAN_LesHalles_WvltPacket.tif otbWaveletPacketTransform @@ -440,7 +441,7 @@ ADD_TEST(msTvWaveletPacketTransform ${MULTISCALE_TESTS4} ) ADD_TEST(msTvWaveletPacketMultiScaleTransform ${MULTISCALE_TESTS4} - --compare-image ${TOL} + --compare-image ${EPSILON6} ${INPUTDATA}/ROI_IKO_PAN_LesHalles.tif ${TEMP}/ROI_IKO_PAN_LesHalles_WvltPacketMultiScale.tif otbWaveletPacketTransform diff --git a/Testing/Code/Radiometry/CMakeLists.txt b/Testing/Code/Radiometry/CMakeLists.txt index 6f6c3f489d4a920f4fa5f7bc5920cafff7724071..71eba271af342892b6f74bb8c0824206ceb477c4 100644 --- a/Testing/Code/Radiometry/CMakeLists.txt +++ b/Testing/Code/Radiometry/CMakeLists.txt @@ -24,6 +24,7 @@ SET(RADIOMETRY_TESTS5 ${CXX_TEST_PATH}/otbRadiometryTests5) SET(RADIOMETRY_TESTS6 ${CXX_TEST_PATH}/otbRadiometryTests6) SET(RADIOMETRY_TESTS7 ${CXX_TEST_PATH}/otbRadiometryTests7) SET(RADIOMETRY_TESTS8 ${CXX_TEST_PATH}/otbRadiometryTests8) +SET(RADIOMETRY_TESTS9 ${CXX_TEST_PATH}/otbRadiometryTests9) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbRADIOMETRY_TESTS1 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1021,7 +1022,20 @@ ADD_TEST(raTvAeronet_ArcachonLevel10_ExtractData ${RADIOMETRY_TESTS8} ${TEMP}/raAeronetExtractData_ArcachonLevel10_16_08_2009_13_00_epsilon_1.txt ) +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbRADIOMETRY_TESTS9 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +IF(OTB_DATA_USE_LARGEINPUT) +ADD_TEST(raTvReflectanceToSurfaceReflectanceImageFilterQB ${RADIOMETRY_TESTS9} +# --compare-ascii ${EPSILON_10e6} ${BASELINE_FILES}/raAeronetExtractData_ArcachonLevel10_16_08_2009_13_00_epsilon_1.txt +# ${TEMP}/raAeronetExtractData_ArcachonLevel10_16_08_2009_13_00_epsilon_1.txt + otbReflectanceToSurfaceReflectanceImageFilterQB + ${LARGEINPUT}/TOULOUSE/QuickBird/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF + ${INPUTDATA}/AERONET/090101_091231_Seysses.lev15 + test.tif +) +ENDIF(OTB_DATA_USE_LARGEINPUT) @@ -1115,6 +1129,12 @@ otbAeronetExtractData.cxx otbAeronetExtractDataBadData.cxx ) + +SET(Radiometry_SRCS9 +otbRadiometryTests9.cxx +otbReflectanceToSurfaceReflectanceImageFilterQB.cxx +) + INCLUDE_DIRECTORIES(${OTB_SOURCE_DIR}/Testing/Code) OTB_ADD_EXECUTABLE(otbRadiometryTests1 "${Radiometry_SRCS1}" "OTBRadiometry;OTBIO;OTBTesting") @@ -1125,5 +1145,6 @@ OTB_ADD_EXECUTABLE(otbRadiometryTests5 "${Radiometry_SRCS5}" "OTBRadiometry;OTBI OTB_ADD_EXECUTABLE(otbRadiometryTests6 "${Radiometry_SRCS6}" "OTBRadiometry;OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbRadiometryTests7 "${Radiometry_SRCS7}" "OTBRadiometry;OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbRadiometryTests8 "${Radiometry_SRCS8}" "OTBRadiometry;OTBIO;OTBTesting") +OTB_ADD_EXECUTABLE(otbRadiometryTests9 "${Radiometry_SRCS9}" "OTBRadiometry;OTBIO;OTBTesting") ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING ) diff --git a/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx b/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx index f425d4b9ec5f3ab45bdec467c4a770982bd20285..e384a4736d008891eb9f0af7cf6a5334c739b38a 100644 --- a/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx +++ b/Testing/Code/Visualization/otbImageLayerRenderingModelSingleLayer.cxx @@ -134,7 +134,12 @@ int otbImageLayerRenderingModelSingleLayer( int argc, char * argv[] ) std::cout<<"Scaled extract saved."<<std::endl; // Layer manipulation test - model->GetLayerByName(layerName); + model->DeleteLayerByName(layerName); + model->AddLayer(generator->GetLayer()); + model->AddLayer(generator->GetLayer()); + model->DeleteLayer(0); + model->DeleteLayer(0); + model->ClearLayers(); return EXIT_SUCCESS; } diff --git a/Utilities/otbossim/CMakeLists.txt b/Utilities/otbossim/CMakeLists.txt index 8b81e58d72062fe1b5b47702a0b7168d186d061c..f66550abd22703f8ae7dda2fabf46a14cc5dd93a 100644 --- a/Utilities/otbossim/CMakeLists.txt +++ b/Utilities/otbossim/CMakeLists.txt @@ -23,8 +23,192 @@ CONFIGURE_FILE(${OTB_SOURCE_DIR}/Utilities/otbossim/include/ossim/ossimConfig.h. -SUBDIRS(include) +# SUBDIRS(include) # ADDED BY OTB DEVELOPPERS TO AVOID INTENSIVE RECOMPILATION IF(NOT OTB_DISABLE_UTILITIES_COMPILATION) -SUBDIRS(src) + + FILE(GLOB_RECURSE ossim_init_SRCS "src/ossim/init/*.cpp" "src/ossim/init/*.c") + FILE(GLOB_RECURSE ossim_base_SRCS "src/ossim/base/*.cpp" "src/ossim/base/*.c") + FILE(GLOB_RECURSE ossim_elevation_SRCS "src/ossim/elevation/*.cpp" "src/ossim/elevation/*.c") + FILE(GLOB_RECURSE ossim_font_SRCS "src/ossim/font/*.cpp" "src/ossim/font/*.c") + FILE(GLOB_RECURSE ossim_imaging_SRCS "src/ossim/imaging/*.cpp" "src/ossim/imaging/*.c") + FILE(GLOB_RECURSE ossim_matrix_SRCS "src/ossim/matrix/*.cpp" "src/ossim/matrix/*.c") + FILE(GLOB_RECURSE ossim_parallel_SRCS "src/ossim/parallel/*.cpp" "src/ossim/parallel/*.c") + FILE(GLOB_RECURSE ossim_projection_SRCS "src/ossim/projection/*.cpp" "src/ossim/projection/*.c") + FILE(GLOB_RECURSE ossim_support_data_SRCS "src/ossim/support_data/*.cpp" "src/ossim/support_data/*.c") + FILE(GLOB_RECURSE ossim_vec_SRCS "src/ossim/vec/*.cpp" "src/ossim/vec/*.c") + FILE(GLOB_RECURSE ossim_vpfutil_SRCS "src/ossim/vpfutil/*.cpp" "src/ossim/vpfutil/*.c") + FILE(GLOB_RECURSE ossim_plugin_SRCS "src/ossim/plugin/*.cpp" "src/ossim/plugin/*.c") + FILE(GLOB_RECURSE ossim_kbool_SRCS "src/ossim/kbool/*.cpp" "src/ossim/kbool/*.c") + FILE(GLOB_RECURSE ossim_dll_main_SRCS "src/ossim/dll_main/*.cpp") + + # Removing empty source file causing compilation warning on visual + REMOVE(ossim_support_data_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/support_data/ossimDemPoint.cpp") + REMOVE(ossim_plugin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/plugin/ossimSharedObjectBridge.cpp") + REMOVE(ossim_base_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/base/ossimFactoryBaseTemplate.cpp") + + # Removing sources not in use any more (switched to ossim plugins) + REMOVE(ossim_imaging_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/imaging/ErsSar/*") + REMOVE(ossim_imaging_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/src/ossim/imaging/RadarSat2/*") + + # Adjust the compiler flags to avoid problems with ossim code. + IF(CMAKE_COMPILER_IS_GNUCXX) + FOREACH(f ${ossim_base_SRCS} ${ossim_elevation_SRCS} ${ossim_font_SRCS} ${ossim_imaging_SRCS} ${ossim_matrix_SRCS} + ${ossim_parallel_SRCS} ${ossim_projection_SRCS} ${ossim_support_data_SRCS} + ${ossim_vec_SRCS} ${ossim_vpfutil_SRCS} ${ossim_plugin_SRCS} ${ossim_init_SRCS} + ${ossim_kbool_SRCS} ${ossim_dll_main_SRCS} ) + SET_SOURCE_FILES_PROPERTIES( ${f} PROPERTIES COMPILE_FLAGS -w ) + ENDFOREACH(f) + ELSE(CMAKE_COMPILER_IS_GNUCXX) + IF(NOT BORLAND) + IF(NOT CYGWIN) + IF(NOT MINGW) + FOREACH(f ${ossim_base_SRCS} ${ossim_elevation_SRCS} ${ossim_font_SRCS} ${ossim_imaging_SRCS} ${ossim_matrix_SRCS} + ${ossim_parallel_SRCS} ${ossim_projection_SRCS} ${ossim_support_data_SRCS} + ${ossim_vec_SRCS} ${ossim_vpfutil_SRCS} ${ossim_plugin_SRCS} ${ossim_init_SRCS} + ${ossim_kbool_SRCS} ${ossim_dll_main_SRCS} ) + SET_SOURCE_FILES_PROPERTIES( ${f} PROPERTIES COMPILE_FLAGS /W0 ) + ENDFOREACH(f) + ENDIF(NOT MINGW) + ENDIF(NOT CYGWIN) + ENDIF(NOT BORLAND) + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + + IF(WIN32) + IF(NOT BORLAND) + IF(NOT CYGWIN) + IF(NOT MINGW) + SET(ossim_init_SRCS ${ossim_init_SRCS} ${ossim_dll_main_SRCS}) + ENDIF(NOT MINGW) + ENDIF(NOT CYGWIN) + ENDIF(NOT BORLAND) + ENDIF(WIN32) + + + ADD_EXECUTABLE(version-config src/ossim/version-config.cpp) + #FIND_PROGRAM( VERSION_CONFIG_PROGRAM + # NAMES version-config + # PATHS ${EXECUTABLE_OUTPUT_PATH} + # ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE} + # ${EXECUTABLE_OUTPUT_PATH}/Release + # ${EXECUTABLE_OUTPUT_PATH}/Debug + # ${EXECUTABLE_OUTPUT_PATH}/MinSizeRel + # ${EXECUTABLE_OUTPUT_PATH}/RelWithDebInfo + # NO_DEFAULT_PATH ) + + + IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$") + ADD_CUSTOM_COMMAND( + OUTPUT ${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h + COMMAND ${OTB_BINARY_DIR}/bin/version-config + ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" "${OSSIM_VERSION}" + DEPENDS version-config + COMMENT "Generating ossimVersion.h" ) + ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$") + ADD_CUSTOM_COMMAND( + OUTPUT ${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h + COMMAND ${OTB_BINARY_DIR}/bin/version-config + ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" "${OSSIM_VERSION}" + DEPENDS version-config + COMMENT "Generating ossimVersion.h" ) + ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$") + + + + SET_SOURCE_FILES_PROPERTIES( + src/ossim/init/ossimInit.cpp PROPERTIES + OBJECT_DEPENDS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" + ) + + #Specify that we are making DLL here + ADD_DEFINITIONS(-DNOMINMAX -DOSSIMMAKINGDLL) + + ADD_LIBRARY(otbossim + ${ossim_init_SRCS} + ${ossim_base_SRCS} + ${ossim_kbool_SRCS} + ${ossim_matrix_SRCS} + ${ossim_vec_SRCS} + ${ossim_vpfutil_SRCS} + ${ossim_plugin_SRCS} + ${ossim_font_SRCS} + ${ossim_support_data_SRCS} + ${ossim_projection_SRCS} + ${ossim_imaging_SRCS} + ${ossim_parallel_SRCS} + ${ossim_elevation_SRCS} + ) + TARGET_LINK_LIBRARIES(otbossim ${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${JPEG_LIBRARY} ${OPENTHREADS_LIBRARY}) + + IF(NOT OTB_INSTALL_NO_LIBRARIES) + INSTALL(TARGETS otbossim + RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR_CM24} COMPONENT Development) + ENDIF(NOT OTB_INSTALL_NO_LIBRARIES) + ENDIF(NOT OTB_DISABLE_UTILITIES_COMPILATION) + +FILE(GLOB ossim_base_HDRS "include/ossim/base/*.h") +FILE(GLOB ossim_elevation_HDRS "include/ossim/elevation/*.h") +FILE(GLOB ossim_font_HDRS "include/ossim/font/*.h") +FILE(GLOB_RECURSE ossim_imaging_HDRS "include/ossim/imaging/*.h") +FILE(GLOB ossim_init_HDRS "include/ossim/init/*.h") +FILE(GLOB ossim_kbool_HDRS "include/ossim/kbool/*.h") +FILE(GLOB ossim_matrix_HDRS "include/ossim/matrix/*.h") +FILE(GLOB ossim_parallel_HDRS "include/ossim/parallel/*.h") +FILE(GLOB ossim_plugin_HDRS "include/ossim/plugin/*.h") +FILE(GLOB_RECURSE ossim_projection_HDRS "include/ossim/projection/*.h") +FILE(GLOB ossim_support_data_HDRS "include/ossim/support_data/*.h") +FILE(GLOB ossim_vec_HDRS "include/ossim/vec/*.h") +FILE(GLOB ossim_vpfutil_HDRS "include/ossim/vpfutil/*.h") + +IF(NOT OTB_INSTALL_NO_DEVELOPMENT) + +INSTALL(FILES ${ossim_base_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/base + COMPONENT Development) +INSTALL(FILES ${ossim_elevation_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/elevation + COMPONENT Development) +INSTALL(FILES ${ossim_font_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/font + COMPONENT Development) +INSTALL(FILES ${ossim_imaging_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/imaging + COMPONENT Development) +INSTALL(FILES ${ossim_init_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/init + COMPONENT Development) +INSTALL(FILES ${ossim_kbool_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/kbool + COMPONENT Development) +INSTALL(FILES ${ossim_matrix_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/matrix + COMPONENT Development) +INSTALL(FILES ${ossim_parallel_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/parallel + COMPONENT Development) +INSTALL(FILES ${ossim_plugin_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/plugin + COMPONENT Development) +INSTALL(FILES ${ossim_projection_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/projection + COMPONENT Development) +INSTALL(FILES ${ossim_support_data_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/support_data + COMPONENT Development) +INSTALL(FILES ${ossim_vec_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/vec + COMPONENT Development) +INSTALL(FILES ${ossim_vpfutil_HDRS} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/vpfutil + COMPONENT Development) + +SET(ossim_config_HDR "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimConfig.h" ) + +INSTALL(FILES ${ossim_config_HDR} + DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim + COMPONENT Development) + +ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT) \ No newline at end of file diff --git a/Utilities/otbossim/include/CMakeLists.txt b/Utilities/otbossim/include/CMakeLists.txt deleted file mode 100644 index ac3ce0bdd9d311c73098be498f58ce21f479642f..0000000000000000000000000000000000000000 --- a/Utilities/otbossim/include/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -FILE(GLOB ossim_base_HDRS "ossim/base/*.h") -FILE(GLOB ossim_elevation_HDRS "ossim/elevation/*.h") -FILE(GLOB ossim_font_HDRS "ossim/font/*.h") -FILE(GLOB_RECURSE ossim_imaging_HDRS "ossim/imaging/*.h") -FILE(GLOB ossim_init_HDRS "ossim/init/*.h") -FILE(GLOB ossim_kbool_HDRS "ossim/kbool/*.h") -FILE(GLOB ossim_matrix_HDRS "ossim/matrix/*.h") -FILE(GLOB ossim_parallel_HDRS "ossim/parallel/*.h") -FILE(GLOB ossim_plugin_HDRS "ossim/plugin/*.h") -FILE(GLOB_RECURSE ossim_projection_HDRS "ossim/projection/*.h") -FILE(GLOB ossim_support_data_HDRS "ossim/support_data/*.h") -FILE(GLOB ossim_vec_HDRS "ossim/vec/*.h") -FILE(GLOB ossim_vpfutil_HDRS "ossim/vpfutil/*.h") - -IF(NOT OTB_INSTALL_NO_DEVELOPMENT) - -INSTALL(FILES ${ossim_base_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/base - COMPONENT Development) -INSTALL(FILES ${ossim_elevation_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/elevation - COMPONENT Development) -INSTALL(FILES ${ossim_font_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/font - COMPONENT Development) -INSTALL(FILES ${ossim_imaging_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/imaging - COMPONENT Development) -INSTALL(FILES ${ossim_init_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/init - COMPONENT Development) -INSTALL(FILES ${ossim_kbool_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/kbool - COMPONENT Development) -INSTALL(FILES ${ossim_matrix_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/matrix - COMPONENT Development) -INSTALL(FILES ${ossim_parallel_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/parallel - COMPONENT Development) -INSTALL(FILES ${ossim_plugin_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/plugin - COMPONENT Development) -INSTALL(FILES ${ossim_projection_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/projection - COMPONENT Development) -INSTALL(FILES ${ossim_support_data_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/support_data - COMPONENT Development) -INSTALL(FILES ${ossim_vec_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/vec - COMPONENT Development) -INSTALL(FILES ${ossim_vpfutil_HDRS} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim/vpfutil - COMPONENT Development) - -SET(ossim_config_HDR "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimConfig.h" ) - -INSTALL(FILES ${ossim_config_HDR} - DESTINATION ${OTB_INSTALL_INCLUDE_DIR_CM24}/Utilities/otbossim/include/ossim - COMPONENT Development) - -ENDIF(NOT OTB_INSTALL_NO_DEVELOPMENT) diff --git a/Utilities/otbossim/src/CMakeLists.txt b/Utilities/otbossim/src/CMakeLists.txt deleted file mode 100644 index 39bc7c472c4218a675aca223c07ebf5b5c92aa0c..0000000000000000000000000000000000000000 --- a/Utilities/otbossim/src/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS(ossim) diff --git a/Utilities/otbossim/src/ossim/CMakeLists.txt b/Utilities/otbossim/src/ossim/CMakeLists.txt deleted file mode 100644 index 6da08c50311f44a9a9bbed330484e39a5e9d311d..0000000000000000000000000000000000000000 --- a/Utilities/otbossim/src/ossim/CMakeLists.txt +++ /dev/null @@ -1,117 +0,0 @@ -FILE(GLOB_RECURSE ossim_init_SRCS "init/*.cpp" "init/*.c") -FILE(GLOB_RECURSE ossim_base_SRCS "base/*.cpp" "base/*.c") -FILE(GLOB_RECURSE ossim_elevation_SRCS "elevation/*.cpp" "elevation/*.c") -FILE(GLOB_RECURSE ossim_font_SRCS "font/*.cpp" "font/*.c") -FILE(GLOB_RECURSE ossim_imaging_SRCS "imaging/*.cpp" "imaging/*.c") -FILE(GLOB_RECURSE ossim_matrix_SRCS "matrix/*.cpp" "matrix/*.c") -FILE(GLOB_RECURSE ossim_parallel_SRCS "parallel/*.cpp" "parallel/*.c") -FILE(GLOB_RECURSE ossim_projection_SRCS "projection/*.cpp" "projection/*.c") -FILE(GLOB_RECURSE ossim_support_data_SRCS "support_data/*.cpp" "support_data/*.c") -FILE(GLOB_RECURSE ossim_vec_SRCS "vec/*.cpp" "vec/*.c") -FILE(GLOB_RECURSE ossim_vpfutil_SRCS "vpfutil/*.cpp" "vpfutil/*.c") -FILE(GLOB_RECURSE ossim_plugin_SRCS "plugin/*.cpp" "plugin/*.c") -FILE(GLOB_RECURSE ossim_kbool_SRCS "kbool/*.cpp" "kbool/*.c") -FILE(GLOB_RECURSE ossim_dll_main_SRCS "dll_main/*.cpp") - -# Removing empty source file causing compilation warning on visual -REMOVE(ossim_support_data_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/support_data/ossimDemPoint.cpp") -REMOVE(ossim_plugin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/plugin/ossimSharedObjectBridge.cpp") -REMOVE(ossim_base_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/base/ossimFactoryBaseTemplate.cpp") -REMOVE(ossim_imaging_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/imaging/ErsSar/*") -REMOVE(ossim_imaging_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/imaging/RadarSat2/*") - -# Adjust the compiler flags to avoid problems with ossim code. -IF(CMAKE_COMPILER_IS_GNUCXX) - FOREACH(f ${ossim_base_SRCS} ${ossim_elevation_SRCS} ${ossim_font_SRCS} ${ossim_imaging_SRCS} ${ossim_matrix_SRCS} - ${ossim_parallel_SRCS} ${ossim_projection_SRCS} ${ossim_support_data_SRCS} - ${ossim_vec_SRCS} ${ossim_vpfutil_SRCS} ${ossim_plugin_SRCS} ${ossim_init_SRCS} - ${ossim_kbool_SRCS} ${ossim_dll_main_SRCS} ) - SET_SOURCE_FILES_PROPERTIES( ${f} PROPERTIES COMPILE_FLAGS -w ) - ENDFOREACH(f) -ELSE(CMAKE_COMPILER_IS_GNUCXX) - IF(NOT BORLAND) - IF(NOT CYGWIN) - IF(NOT MINGW) - FOREACH(f ${ossim_base_SRCS} ${ossim_elevation_SRCS} ${ossim_font_SRCS} ${ossim_imaging_SRCS} ${ossim_matrix_SRCS} - ${ossim_parallel_SRCS} ${ossim_projection_SRCS} ${ossim_support_data_SRCS} - ${ossim_vec_SRCS} ${ossim_vpfutil_SRCS} ${ossim_plugin_SRCS} ${ossim_init_SRCS} - ${ossim_kbool_SRCS} ${ossim_dll_main_SRCS} ) - SET_SOURCE_FILES_PROPERTIES( ${f} PROPERTIES COMPILE_FLAGS /W0 ) - ENDFOREACH(f) - ENDIF(NOT MINGW) - ENDIF(NOT CYGWIN) - ENDIF(NOT BORLAND) -ENDIF(CMAKE_COMPILER_IS_GNUCXX) - -IF(WIN32) - IF(NOT BORLAND) - IF(NOT CYGWIN) - IF(NOT MINGW) - SET(ossim_init_SRCS ${ossim_init_SRCS} ${ossim_dll_main_SRCS}) - ENDIF(NOT MINGW) - ENDIF(NOT CYGWIN) - ENDIF(NOT BORLAND) -ENDIF(WIN32) - - -ADD_EXECUTABLE(version-config version-config.cpp) -#FIND_PROGRAM( VERSION_CONFIG_PROGRAM -# NAMES version-config -# PATHS ${EXECUTABLE_OUTPUT_PATH} -# ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE} -# ${EXECUTABLE_OUTPUT_PATH}/Release -# ${EXECUTABLE_OUTPUT_PATH}/Debug -# ${EXECUTABLE_OUTPUT_PATH}/MinSizeRel -# ${EXECUTABLE_OUTPUT_PATH}/RelWithDebInfo -# NO_DEFAULT_PATH ) - - -IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$") - ADD_CUSTOM_COMMAND( - OUTPUT ${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h - COMMAND ${OTB_BINARY_DIR}/bin/version-config - ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" "${OSSIM_VERSION}" - DEPENDS version-config - COMMENT "Generating ossimVersion.h" ) -ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$") - ADD_CUSTOM_COMMAND( - OUTPUT ${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h - COMMAND version-config - ARGS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" "${OSSIM_VERSION}" - DEPENDS version-config - COMMENT "Generating ossimVersion.h" ) -ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" MATCHES "^2\\.4$") - - - -SET_SOURCE_FILES_PROPERTIES( - init/ossimInit.cpp PROPERTIES - OBJECT_DEPENDS "${OTB_BINARY_DIR}/Utilities/otbossim/include/ossim/ossimVersion.h" - ) - -#Specify that we are making DLL here -ADD_DEFINITIONS(-DNOMINMAX -DOSSIMMAKINGDLL) - -ADD_LIBRARY(otbossim -${ossim_init_SRCS} -${ossim_base_SRCS} -${ossim_kbool_SRCS} -${ossim_matrix_SRCS} -${ossim_vec_SRCS} -${ossim_vpfutil_SRCS} -${ossim_plugin_SRCS} -${ossim_font_SRCS} -${ossim_support_data_SRCS} -${ossim_projection_SRCS} -${ossim_imaging_SRCS} -${ossim_parallel_SRCS} -${ossim_elevation_SRCS} -) -TARGET_LINK_LIBRARIES(otbossim ${TIFF_LIBRARY} ${GEOTIFF_LIBRARY} ${JPEG_LIBRARY} ${OPENTHREADS_LIBRARY}) - -IF(NOT OTB_INSTALL_NO_LIBRARIES) - INSTALL(TARGETS otbossim - RUNTIME DESTINATION ${OTB_INSTALL_BIN_DIR_CM24} COMPONENT RuntimeLibraries - LIBRARY DESTINATION ${OTB_INSTALL_LIB_DIR_CM24} COMPONENT RuntimeLibraries - ARCHIVE DESTINATION ${OTB_INSTALL_LIB_DIR_CM24} COMPONENT Development) -ENDIF(NOT OTB_INSTALL_NO_LIBRARIES)