diff --git a/Code/IO/otbIkonosImageMetadataInterface.cxx b/Code/IO/otbIkonosImageMetadataInterface.cxx index c74ee6336bcf898c804efa8d714c35c593602288..cca9789dca1629e355ad377e57c9277a53fc4773 100755 --- a/Code/IO/otbIkonosImageMetadataInterface.cxx +++ b/Code/IO/otbIkonosImageMetadataInterface.cxx @@ -457,6 +457,13 @@ IkonosImageMetadataInterface VariableLengthVectorType outputValuesVariableLengthVector; unsigned int numBands = GetNumberOfBands(dict); + + /** Tests if the number of bands in metadata are the same as bandName size*/ + if (numBands != bandName.size() ) + { + itkExceptionMacro(<<"Invalid number of bands..."); + } + outputValuesVariableLengthVector.SetSize(numBands); for(unsigned int i=0; i<numBands; ++i) { diff --git a/Code/IO/otbImageMetadataInterfaceBase.cxx b/Code/IO/otbImageMetadataInterfaceBase.cxx index df61387cf7e3b95fad026abbc711cedb0dc72f4e..00e53f725981180da30bfe2c91be1e2e7ec752c2 100644 --- a/Code/IO/otbImageMetadataInterfaceBase.cxx +++ b/Code/IO/otbImageMetadataInterfaceBase.cxx @@ -406,7 +406,7 @@ ImageMetadataInterfaceBase::GetBandName( const MetaDataDictionaryType & dict ) c ImageKeywordlist.convertToOSSIMKeywordlist(kwl); std::string key= "support_data.band_name"; ossimString keywordString = kwl.find(key.c_str()); - ossimString separatorList = " "; + ossimString separatorList = " /"; std::vector<ossimString> keywordStrings = keywordString.split(separatorList); std::vector<std::string> outputValues; for (unsigned int i=0; i < keywordStrings.size(); ++i) diff --git a/Code/IO/otbTerraSarImageMetadataInterface.cxx b/Code/IO/otbTerraSarImageMetadataInterface.cxx index 8915cb4a7b925de5b5316c1afdf1070f08723b04..08fd6773e637f4d1253de99df573b8b7ff7eec60 100644 --- a/Code/IO/otbTerraSarImageMetadataInterface.cxx +++ b/Code/IO/otbTerraSarImageMetadataInterface.cxx @@ -88,7 +88,7 @@ TerraSarImageMetadataInterface::GetDay( const MetaDataDictionaryType & dict ) co ossimKeywordlist kwl; imageKeywordlist.convertToOSSIMKeywordlist(kwl); - +std::cout<<kwl<<std::endl; std::string key; ossimString separatorList; key = "azimuth_start_time"; @@ -678,8 +678,33 @@ TerraSarImageMetadataInterface::GetRadarFrequency( const MetaDataDictionaryType ossimKeywordlist kwl; imageKeywordlist.convertToOSSIMKeywordlist(kwl); - + ossimString tempVal = kwl.find("radarFrequency"); + double freq =tempVal.toDouble(); + + return freq; +} + + +double +TerraSarImageMetadataInterface::GetPRF( const MetaDataDictionaryType & dict ) const +{ + if( !this->CanRead( dict ) ) + { + itkExceptionMacro(<<"Invalid Metadata, no TerraSar Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData<ImageKeywordlistType>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + ossimKeywordlist kwl; + imageKeywordlist.convertToOSSIMKeywordlist(kwl); + + ossimString tempVal = kwl.find("sensor_params.prf"); double freq = tempVal.toDouble(); return freq; diff --git a/Code/IO/otbTerraSarImageMetadataInterface.h b/Code/IO/otbTerraSarImageMetadataInterface.h index 7f763f895a2c0e156927460056523621452d566f..3a4ca993c8a48506df0dbaea1808e61a6b2ae3b1 100644 --- a/Code/IO/otbTerraSarImageMetadataInterface.h +++ b/Code/IO/otbTerraSarImageMetadataInterface.h @@ -126,6 +126,9 @@ public: /** Get the radar frequency */ double GetRadarFrequency( const MetaDataDictionaryType & ) const; + + /** Get the PRF */ + double GetPRF( const MetaDataDictionaryType & ) const; /** Get the incidence angles structure */ ossimplugins::IncidenceAngles* GetIncidenceAngles( const MetaDataDictionaryType & ) const; diff --git a/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h b/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h index 18dff8d10507622f35cbb976f313608f8308f892..c698ac6ae9251baa144218a8aef914b7677c0c8c 100644 --- a/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h +++ b/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h @@ -88,12 +88,7 @@ public: * m_IlluminationCorrectionCoefficient / m_SolarIllumination; - // Set a 1e-3 precision - itk::OStringStream oss; - oss.str(""); - oss << std::fixed << std::setprecision(3); - oss<<temp; - outPixel = static_cast<TOutput>( atof(oss.str().c_str()) ); + outPixel = static_cast<TOutput>( vcl_floor(temp*1000.)/1000.); return outPixel; } diff --git a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h index 03f9f3734dbc1721975b4348126657b1bbe92cd4..887dcff4659b701900bee52c2ce49fef420b882c 100644 --- a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h +++ b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h @@ -96,13 +96,8 @@ public: double temp, temp2; temp = static_cast<double>(inPixel)*m_Coefficient + m_Residu; temp2 = temp / (1. + m_SphericalAlbedo * temp); - - // Set a 1e-3 precision - itk::OStringStream oss; - oss.str(""); - oss << std::fixed << std::setprecision(3); - oss<<temp2; - outPixel = static_cast<TOutput>( atof(oss.str().c_str()) ); + + outPixel = static_cast<TOutput>( vcl_floor(temp2*1000.)/1000.); return outPixel; } @@ -232,7 +227,7 @@ protected: void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); - + private: AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; CorrectionParametersPointerType m_CorrectionParameters; diff --git a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx index 2b593a76e6cfb14970b3635e30e13023af3ec87d..7ebfd7cc97b1ecc9dacfd8990e3efed57392c082 100644 --- a/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx +++ b/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx @@ -168,7 +168,7 @@ void ReflectanceToSurfaceReflectanceImageFilter<TInputImage,TOutputImage> ::GenerateParameters() { - if(m_IsSetAtmosphericRadiativeTerms==false) + if(!m_IsSetAtmosphericRadiativeTerms) { this->UpdateAtmosphericRadiativeTerms(); } diff --git a/Code/Radiometry/otbTerraSarBrightnessFunctor.h b/Code/Radiometry/otbTerraSarBrightnessFunctor.h index 871a5ce91130bad19a56b7e8453afaa73f79f355..fd431eba2f0d73e0c4c8d1edd7d31d9ec8defcd9 100644 --- a/Code/Radiometry/otbTerraSarBrightnessFunctor.h +++ b/Code/Radiometry/otbTerraSarBrightnessFunctor.h @@ -69,6 +69,18 @@ public: return m_ResultsInDecibels; } + /** Set Default value for null or negative pixel beta */ + void SetDefaultValue(double db) + { + m_DefaultValue = db; + } + + /** Set Default value for null or negative pixel beta */ + bool GetDefaultValue() + { + return m_DefaultValue; + } + /** We assume that the input pixel is a scalar -> modulus image */ inline TOutput operator() (const TInput & inPix); /** We assume that the input pixel is a complex -> complex image */ @@ -80,6 +92,9 @@ private: /** Shall we compute results in decibels ? */ bool m_ResultsInDecibels; + + /** Default value for null or negative pixel beta */ + double m_DefaultValue; }; }// end namespace functor diff --git a/Code/Radiometry/otbTerraSarBrightnessFunctor.txx b/Code/Radiometry/otbTerraSarBrightnessFunctor.txx index 14fbbddb87e00d4c117e99c4630632c3c761937b..7194124e5bfc33ab18ad884357b5accd8630266b 100644 --- a/Code/Radiometry/otbTerraSarBrightnessFunctor.txx +++ b/Code/Radiometry/otbTerraSarBrightnessFunctor.txx @@ -33,6 +33,7 @@ TerraSarBrightnessFunctor<TInput, TOutput> { m_CalibrationFactor = itk::NumericTraits<double>::Zero; m_ResultsInDecibels = false; + m_DefaultValue = 0.00001; // Default value is 10^-5 } @@ -49,10 +50,14 @@ TerraSarBrightnessFunctor<TInput, TOutput> // Then apply the calibration factor double beta = m_CalibrationFactor*squareInPix; + if( beta<=0 ) + beta = m_DefaultValue; + + // Results in decibels case if(m_ResultsInDecibels) { - beta = 10 * vcl_log10(beta); + beta = 10 * vcl_log10(beta); } return static_cast<TOutput>(beta); diff --git a/Code/Radiometry/otbTerraSarBrightnessImageFilter.h b/Code/Radiometry/otbTerraSarBrightnessImageFilter.h index ca74d5675e10ccc739676de3b9b443a3ffde85f6..9df5ab6444932db47b02be8cc63ffd1e895a5a18 100644 --- a/Code/Radiometry/otbTerraSarBrightnessImageFilter.h +++ b/Code/Radiometry/otbTerraSarBrightnessImageFilter.h @@ -126,6 +126,19 @@ public: return this->GetFunctor().GetResultsInDecibels(); } + /** Set the default value (replacing negative beta) */ + void SetDefaultValue(double value) + { + this->GetFunctor().SetResultsInDecibels(value); + this->Modified(); + } + + double GetDefaultValue() + { + return this->GetFunctor().SetResultsInDecibels(); + } + + protected: /** Constructor */ TerraSarBrightnessImageFilter(){}; @@ -138,6 +151,7 @@ protected: private: TerraSarBrightnessImageFilter(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented + }; } // end namespace otb diff --git a/Code/Radiometry/otbTerraSarCalibrationImageFilter.txx b/Code/Radiometry/otbTerraSarCalibrationImageFilter.txx index 9233a2aca77b385ae59d6b90a90da5465a086a5c..8cb40cd27accb24c14ae36d996ded6b3662ad25b 100644 --- a/Code/Radiometry/otbTerraSarCalibrationImageFilter.txx +++ b/Code/Radiometry/otbTerraSarCalibrationImageFilter.txx @@ -19,6 +19,7 @@ #define __otbTerraSarCalibrationImageFilter_txx #include <algorithm> +#include <iomanip> #include "otbTerraSarCalibrationImageFilter.h" #include "otbTerraSarImageMetadataInterface.h" @@ -147,12 +148,12 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage> } } - // Radar frequency (PRF) + // PRF if (this->GetPRF() == 1.) { if (mdIsAvailable) { - m_PRF = lImageMetadata->GetRadarFrequency(this->GetInput()->GetMetaDataDictionary()); + m_PRF = lImageMetadata->GetPRF(this->GetInput()->GetMetaDataDictionary()); } else { @@ -213,27 +214,46 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage> // Set up progress reporting itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); + + for(unsigned int i = 0; i < m_NoiseRecords.size();++i) + { + std::cout<<std::fixed<<std::setprecision(10)<<"t"<<i<<": "<< m_NoiseRecords[i].first << std::endl; + } + + assert(!m_NoiseRecords.empty()); + // The acquisition time of the first line of OutputRegionForThread. - double invPRF = 1/m_PRF; - double currentAzimuthPosition = m_NoiseRecords.back().first = invPRF + //double PRFJulian = m_PRF * (0.864 / 1e-5); + double invPRF = /*(0.864/1e-5) * */1/m_PRF; + double currentAzimuthPosition = m_NoiseRecords.back().first + invPRF * (m_OriginalProductSize[1]- inputIt.GetIndex()[1] -1); - - // Local variable to store the current noise record - NoiseRecordType currentNoiseRecord; + std::cout<<"Product size: "<<m_OriginalProductSize<<std::endl; + std::cout<<"Start index: "<<inputIt.GetIndex()<<std::endl; + std::cout<<"Current position: "<<currentAzimuthPosition<<std::endl; + std::cout<<"PRF: "<<m_PRF<<std::endl; + + // Look for the first noise record to be used (remember we sorted // m_NoiseRecords by decreasing time) NoiseRecordVectorType::const_iterator currentNoiseRecordIt = m_NoiseRecords.begin(); + unsigned int nrIndex = 0; + // Iterate until we find it while(currentNoiseRecordIt != m_NoiseRecords.end() && currentNoiseRecordIt->first > currentAzimuthPosition) { - ++currentNoiseRecordIt; + ++nrIndex; + ++currentNoiseRecordIt; } + assert(currentNoiseRecordIt != m_NoiseRecords.end()); + // Store the current noise record azimuth position double currentNoiseRecordAzimuthPosition = currentNoiseRecordIt->first; - + calibrationFunctor.SetNoiseRecord(currentNoiseRecordIt->second); + std::cout<<nrIndex<<" degree: "<<currentNoiseRecordIt->second.get_polynomialDegree()<<std::endl; + // Store current line index typename OutputImageRegionType::IndexType::IndexValueType currentLine = inputIt.GetIndex()[1]; @@ -254,13 +274,15 @@ TerraSarCalibrationImageFilter<TInputImage,TOutputImage> { // Update the iterator ++currentNoiseRecordIt; - + ++nrIndex; + std::cout<<"NrIndex increment"<<std::endl; // If we are not at the last record if(currentNoiseRecordIt != m_NoiseRecords.end()) { // Update the functor noise record currentNoiseRecordAzimuthPosition = currentNoiseRecordIt->first; calibrationFunctor.SetNoiseRecord(currentNoiseRecordIt->second); + std::cout<<nrIndex<<" degree: "<<currentNoiseRecordIt->second.get_polynomialDegree()<<std::endl; } } } diff --git a/Examples/GeospatialAnalysis/PostGISCreateTable.cxx b/Examples/GeospatialAnalysis/PostGISCreateTable.cxx index 0fdc06602cc2d5f2217cdc0fcce6e9ad6028bf7e..2f63d9d83d2c8cf500df93cfa72f9b2c3bc2fdd1 100644 --- a/Examples/GeospatialAnalysis/PostGISCreateTable.cxx +++ b/Examples/GeospatialAnalysis/PostGISCreateTable.cxx @@ -15,24 +15,46 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ + +// Software Guide : BeginLatex +// +// This test uses a transactor to create a table. The transactor +// needs to have a copy constructor, so the initialization is done +// correctly for the class variables which are set before the transaction. +// Let's look at the minimal code required to use this algorithm. First, the +// following header defining the \doxygen{otb}{PostGISCreateTableTransactor} class +// must be included. +// Software Guide : EndLatex + #include "itkExceptionObject.h" #include "otbMacro.h" +// Software Guide : BeginCodeSnippet #include "otbPostGISCreateTableTransactor.h" #include "otbPostGISConnectionImplementation.h" - -/** This test uses a transactor to create a table. The transactor -needs to have a copy constructor, so the initialization is done -correctly for the class variables which are set before the transaction -*/ +// Software Guide : EndCodeSnippet int main(int argc, char * argv[]) { + + // Software Guide : BeginLatex + // + // Instanciation of the PQXX-based transactor + // for creating PostGIS tables. + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet typedef otb::PostGISCreateTableTransactor TransactorType; - - //Instantiation + TransactorType myTransactor; - + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Set arguments of the transactor + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet unsigned short dimension = 2; myTransactor.SetDimension( dimension ); @@ -43,26 +65,43 @@ int main(int argc, char * argv[]) myTransactor.SetSRID( srid ); myTransactor.SetRemoveExistingTable( true ); + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // After defining the transcator, we need to create the + // connection interface to the PostgreSQL database. + // This is done by the \doxygen{otb}{PostGISConnectionImplementation}. + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet const std::string hostName = argv[1]; const std::string dbName = argv[2]; const std::string userName = argv[3]; const std::string userPassword = argv[4]; - typedef otb::PostGISConnectionImplementation GISConnectionType; - - //Instantiation + GISConnectionType::Pointer connection = GISConnectionType::New(); - + connection->SetHost( hostName ); connection->SetDBName( dbName ); connection->SetUser( userName ); connection->SetPassword( userPassword ); + // Software Guide : EndCodeSnippet - connection->ConnectToDB(); + // Software Guide : BeginLatex + // + // Let's now connect to the database and perform the transaction + // with the method \code{PerformTransaction}. + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet + connection->ConnectToDB(); + connection->PerformTransaction( myTransactor ); - + // Software Guide : EndCodeSnippet return EXIT_SUCCESS; } diff --git a/Examples/GeospatialAnalysis/PostGISCreateTable.cxx~ b/Examples/GeospatialAnalysis/PostGISCreateTable.cxx~ index 67403356073c0490422027549d70a13d41766e93..2f63d9d83d2c8cf500df93cfa72f9b2c3bc2fdd1 100644 --- a/Examples/GeospatialAnalysis/PostGISCreateTable.cxx~ +++ b/Examples/GeospatialAnalysis/PostGISCreateTable.cxx~ @@ -15,24 +15,46 @@ PURPOSE. See the above copyright notices for more information. =========================================================================*/ + +// Software Guide : BeginLatex +// +// This test uses a transactor to create a table. The transactor +// needs to have a copy constructor, so the initialization is done +// correctly for the class variables which are set before the transaction. +// Let's look at the minimal code required to use this algorithm. First, the +// following header defining the \doxygen{otb}{PostGISCreateTableTransactor} class +// must be included. +// Software Guide : EndLatex + #include "itkExceptionObject.h" #include "otbMacro.h" +// Software Guide : BeginCodeSnippet #include "otbPostGISCreateTableTransactor.h" #include "otbPostGISConnectionImplementation.h" +// Software Guide : EndCodeSnippet -/** This test uses a transactor to create a table. The transactor -needs to have a copy constructor, so the initialization is done -correctly for the class variables which are set before the transaction -*/ - -int otbPostGISCreateTableTransactorCreate(int argc, char * argv[]) +int main(int argc, char * argv[]) { + + // Software Guide : BeginLatex + // + // Instanciation of the PQXX-based transactor + // for creating PostGIS tables. + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet typedef otb::PostGISCreateTableTransactor TransactorType; - - //Instantiation + TransactorType myTransactor; - + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Set arguments of the transactor + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet unsigned short dimension = 2; myTransactor.SetDimension( dimension ); @@ -43,26 +65,43 @@ int otbPostGISCreateTableTransactorCreate(int argc, char * argv[]) myTransactor.SetSRID( srid ); myTransactor.SetRemoveExistingTable( true ); + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // After defining the transcator, we need to create the + // connection interface to the PostgreSQL database. + // This is done by the \doxygen{otb}{PostGISConnectionImplementation}. + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet const std::string hostName = argv[1]; const std::string dbName = argv[2]; const std::string userName = argv[3]; const std::string userPassword = argv[4]; - typedef otb::PostGISConnectionImplementation GISConnectionType; - - //Instantiation + GISConnectionType::Pointer connection = GISConnectionType::New(); - + connection->SetHost( hostName ); connection->SetDBName( dbName ); connection->SetUser( userName ); connection->SetPassword( userPassword ); + // Software Guide : EndCodeSnippet - connection->ConnectToDB(); + // Software Guide : BeginLatex + // + // Let's now connect to the database and perform the transaction + // with the method \code{PerformTransaction}. + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet + connection->ConnectToDB(); + connection->PerformTransaction( myTransactor ); - + // Software Guide : EndCodeSnippet return EXIT_SUCCESS; } diff --git a/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx~ b/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx~ index fbac952a9c5c3071303a0a2e8d0cc05ec0d4f14c..6b97d574df14487913a55777e75b3cbf190d9d07 100644 --- a/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx~ +++ b/Examples/GeospatialAnalysis/otbGeospatialAnalysisExamplesTests.cxx~ @@ -29,6 +29,6 @@ void RegisterTests() } #undef main -#define main OBIAImageToLabelToImageTest +#define main GeospatialAnalysisPostGISCreateTableTest #include "PostGISCreateTable.cxx" diff --git a/Examples/OBIA/ImageToLabelToImage.cxx b/Examples/OBIA/ImageToLabelToImage.cxx index 06840aba7f978f9dc3722f746103ea84a0afa826..bc04b9c3399fc5f46deb80416f09479e9cb5aba2 100644 --- a/Examples/OBIA/ImageToLabelToImage.cxx +++ b/Examples/OBIA/ImageToLabelToImage.cxx @@ -65,13 +65,14 @@ int main(int argc, char * argv[]) const int dim = 2; typedef unsigned short PixelType; typedef otb::Image< PixelType, dim > ImageType; - // Software Guide : EndCodeSnippet + typedef itk::LabelObject< PixelType, dim > LabelObjectType; typedef itk::LabelMap< LabelObjectType > LabelMapType; + // Software Guide : EndCodeSnippet // Software Guide : BeginLatex // - // The reader is instantiated and + // As usual, the reader is instantiated and // the input image is set. // // Software Guide : EndLatex @@ -91,7 +92,7 @@ int main(int argc, char * argv[]) // \item \code{FullyConnected}: Set whether the connected // components are defined strictly by face connectivity or by // face+edge+vertex connectivity. Default is FullyConnectedOff. - // \item InputForegroundValue/OutputBackgroundValue specify the + // \item \code{InputForegroundValue/OutputBackgroundValue}: specify the // pixel value of input/output of the foreground/background. // the input image is set. // \end{itemize} @@ -109,7 +110,7 @@ int main(int argc, char * argv[]) // Software Guide : BeginLatex // - // Then the inverse process is . + // Then the inverse process is uses to recreate a image of labels. // The \doxygen{itk}{LabelMapToLabelImageFilter} converts a // LabelMap to a labeled image. // diff --git a/Examples/OBIA/ShapeAttributeComputation.cxx b/Examples/OBIA/ShapeAttributeComputation.cxx index 93384fa7e2ae735d3e210e7b685de6631900f252..3409517e448400c6876f0e3c41f2a34771b693eb 100644 --- a/Examples/OBIA/ShapeAttributeComputation.cxx +++ b/Examples/OBIA/ShapeAttributeComputation.cxx @@ -23,7 +23,9 @@ // Software Guide : BeginLatex // -// This example shows the +// This basic example shows how compute shape attributes at the object level. +// The input image is firstly translate in a set of regions (of \doxygen{itk}{ShapeLabelObject}) +// and some attributes values of each object are then save to an ASCII file. // // Software Guide : EndLatex @@ -39,9 +41,7 @@ int main(int argc, char * argv[]) { - const int dim = 2; - typedef unsigned long PixelType; - typedef itk::Image< PixelType, dim > ImageType; + if( argc != 3) { @@ -49,42 +49,95 @@ int main(int argc, char * argv[]) return EXIT_FAILURE; } - // read the input image + // Software Guide : BeginLatex + // + // The image types are defined using pixel types and + // dimension. The input image is defined as an \doxygen{otb}{Image}. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + const int dim = 2; + typedef unsigned long PixelType; + typedef itk::Image< PixelType, dim > ImageType; + typedef unsigned long LabelType; + typedef itk::ShapeLabelObject< LabelType, dim > LabelObjectType; + typedef itk::LabelMap< LabelObjectType > LabelMapType; + typedef itk::LabelImageToLabelMapFilter< ImageType, LabelMapType > ConverterType; + + // Software Guide : EndCodeSnippet + + // Software Guide : BeginLatex + // + // Firstly, the image reader is instantiated. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet typedef itk::ImageFileReader< ImageType > ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName( argv[1] ); + // Software Guide : EndCodeSnippet + - // define the object type. Here the ShapeLabelObject type + // Software Guide : BeginLatex + // + // Here the \doxygen{itk}{ShapeLabelObject} type // is chosen in order to read some attribute related to the shape // of the objects (by opposition to the content of the object, with - // the StatisticsLabelObejct). - typedef unsigned long LabelType; - typedef itk::ShapeLabelObject< LabelType, dim > LabelObjectType; - typedef itk::LabelMap< LabelObjectType > LabelMapType; + // the \doxygen{itk}{StatisticsLabelObject). + // + // Software Guide : EndLatex - // convert the image in a collection of objects - typedef itk::LabelImageToLabelMapFilter< ImageType, LabelMapType > ConverterType; + // Software Guide : BeginCodeSnippet + typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType; + // Software Guide : EndCodeSnippet + + + // Software Guide : BeginLatex + // + // The input image is converted in a collection of objects + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet ConverterType::Pointer converter = ConverterType::New(); converter->SetInput( reader->GetOutput() ); converter->SetBackgroundValue( itk::NumericTraits<LabelType>::min() ); - typedef itk::ShapeLabelMapFilter< LabelMapType > ShapeFilterType; ShapeFilterType::Pointer shape = ShapeFilterType::New(); shape->SetInput( converter->GetOutput() ); - // update the shape filter, so its output will be up to date + // Software Guide : EndCodeSnippet + + + // Software Guide : BeginLatex + // + // Update the shape filter, so its output will be up to date. + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet shape->Update(); + // Software Guide : EndCodeSnippet std::cout << "Nb. objects conv. " << converter->GetOutput()->GetNumberOfLabelObjects() << std::endl; - std::cout << "Nb. objects shape " << shape->GetOutput()->GetNumberOfLabelObjects() << std::endl; - // then we can read the attribute values we're interested in. The BinaryImageToShapeLabelMapFilter + std::cout << "Nb. objects shape " << shape->GetOutput()->GetNumberOfLabelObjects() << std::endl; + + // Software Guide : BeginLatex + // + // Then, we can read the attribute values we're interested in. The \doxygen{itk}{BinaryImageToShapeLabelMapFilter // produce consecutive labels, so we can use a for loop and GetLabelObject() method to retrieve // the label objects. If the labels are not consecutive, the GetNthLabelObject() method must be // use instead of GetLabelObject(), or an iterator on the label // object container of the label map. - std::ofstream outfile( argv[2] ); - + // In this example, we print 2 shape attributes of each object to a text file (the size and the centroid coordinates). + // + // Software Guide : EndLatex + + // Software Guide : BeginCodeSnippet + std::ofstream outfile( argv[2] ); LabelMapType::Pointer labelMap = shape->GetOutput(); for( unsigned long label=1; label<=labelMap->GetNumberOfLabelObjects(); label++ ) @@ -96,5 +149,7 @@ int main(int argc, char * argv[]) } outfile.close(); + // Software Guide : EndCodeSnippet + return EXIT_SUCCESS; } diff --git a/Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx b/Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx index 87dd73dc2683a921eb65fd2dadc726fcea3e4166..fd21c7548dde5249adc95e9b23ebac658e097f28 100755 --- a/Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx +++ b/Examples/OBIA/otbRadiometricAttributesLabelMapFilterExample.cxx @@ -17,9 +17,9 @@ =========================================================================*/ // Software Guide : BeginCommandLineArgs -// INPUTS: {/home/grizonnetm/OTB/Dev/OTB-Data/Examples/qb_RoadExtract2.tif} +// INPUTS: {qb_RoadExtract2.tif} // OUTPUTS: {OBIARadiometricAttribute1.tif} -// STATS::Ndvi::Mean 0 0.3 16 16 200 1.0 +// STATS::Ndvi::Mean 0 -0.3 16 16 10 1.0 // Software Guide : EndCommandLineArgs // Software Guide : BeginLatex @@ -44,9 +44,9 @@ // \item NDWI2 // \item Intensity // \item and original B, G, R and NIR channels - // \end{itemize}, + // \end{itemize} // Here we use the \doxygen{otb}{AttributesMapOpeningLabelMapFilter} to extract vegetated areas. -// +// Let's get to the source code explanation. // // Software Guide : EndLatex @@ -115,7 +115,8 @@ int main(int argc, char * argv[]) vreader->SetFileName(reffname); // Software Guide : BeginLatex // - // Firstly, segment input image using the Mean Shift algorithm. + // Firstly, segment the input image by using the Mean Shift algorithm (see \ref{sec:MeanShift} for deeper + // explanations). // // Software Guide : EndLatex @@ -134,11 +135,12 @@ int main(int argc, char * argv[]) // types. // // Software Guide : EndLatex -// Software Guide : BeginCodeSnippet + + // Software Guide : BeginCodeSnippet filter->SetInput(reader->GetOutput()); -// Software Guide : EndCodeSnippet + // Software Guide : EndCodeSnippet -// Software Guide : BeginLatex + // Software Guide : BeginLatex // // The \doxygen{itk}{LabelImageToLabelMapFilter} type is instantiated using the output // of the \doxygen{otb}{MeanShiftImageFilter}. This filter produces a labeled image @@ -163,7 +165,7 @@ int main(int argc, char * argv[]) // Software Guide : BeginLatex // // Instantiate the \doxygen{otb}{RadiometricAttributesLabelMapFilter} to - // compute radiometric value on each label object. + // compute radiometric valuee on each label object. // // Software Guide : EndLatex @@ -208,7 +210,8 @@ int main(int argc, char * argv[]) // Software Guide : BeginLatex // - // Then, Label object selected are transform in a Label Image using the \doxygen{itk}{LabelMapToLabelImageFilter} + // Then, Label objects selected are transform in a Label Image using the + // \doxygen{itk}{LabelMapToLabelImageFilter}. // // Software Guide : EndLatex @@ -234,3 +237,16 @@ int main(int argc, char * argv[]) return EXIT_SUCCESS; } + + // Software Guide : BeginLatex + // + // Figure~\ref{fig:RADIOMETRIC_LABEL_MAP_FILTER} shows the result of applying + // the object selection based on radiometric attributes. + // \begin{figure} \center + // \includegraphics[width=0.44\textwidth]{qb_RoadExtract2.eps} + // \includegraphics[width=0.44\textwidth]{OBIARadiometricAttribute1.eps} + // \itkcaption[Object based extraction based on ]{From left to right : original image, vegetation mask resulting from processing.} + // \label{fig:RADIOMETRIC_LABEL_MAP_FILTER} + // \end{figure} + // + // Software Guide : EndLatex diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index f64910f66ea736656351d5c4b2a5e4eaf7bf3bdc..5931308ab5056b2544efab3170da8eeb3624d3a9 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,3 +1,32 @@ +OTB-v.3.2.0 - Changes since version 3.0.0 (2010/01/15) +----------------------------------------- + +* Applications + - Monteverdi, a new all-in one user-friendly graphical tool + for remote sensing data processing released as a separate package (see README file). + +* Library + The library includes these additions + * Support for TerraSarX, Quickbird and Spot5 calibration metadata + * Support for Aeronet files + * Various filters for Object Based Image Analysis based on LabelObjectMaps + * Support for RPC sensor model estimation from a set of Ground Control Points + * Support for affine transform least-square estimation from a set of tie points + * Support for SVM cross-validation and parameters optimization + * Box and Whiskey filter to detect outlier on VectorImage + * Enhanced SOM algorithm taking into account invalid missing values + * Wavelet transform + * Filters for GIS database interaction + * ImageFileWriter now supports streaming natively + * Lots of bug fixes + +* System + * Internal ITK updated to 3.16.0 + OTB Patches + * Internal OSSIM updated to svn revision 15872 + OTB patches + * Home brewed metadata reader were moved to ossimplugins + + + OTB-v.3.0.0 - Changes since version 2.8.0 (2009/05/11) ----------------------------------------- diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index dfa3439bad779048302eb4b31412b3dd4e1f8f6e..f0e113418dbd2caf34a401a6be7dc4e4d66acc69 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -15,15 +15,16 @@ IF(OTB_BINARY_DIR) ADD_SUBDIRECTORY(Utilities) ELSE(OTB_BINARY_DIR) # We are building as a stand-alone project. + CMAKE_MINIMUM_REQUIRED(VERSION 2.4) SET(LIBRARY_OUTPUT_PATH ${OTBTesting_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.") SET(EXECUTABLE_OUTPUT_PATH ${OTBTesting_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.") MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH) SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH}) # Configure Dart testing support. - SET(PROJECT_SOURCE_DIR "${OTBTesting_SOURCE_DIR}/..") + #SET(PROJECT_SOURCE_DIR "${OTBTesting_SOURCE_DIR}/..") INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake) - SET(PROJECT_SOURCE_DIR "${OTBTesting_SOURCE_DIR}") + #SET(PROJECT_SOURCE_DIR "${OTBTesting_SOURCE_DIR}") MARK_AS_ADVANCED(TCL_TCLSH) IF(BUILD_TESTING) ENABLE_TESTING() diff --git a/Testing/Code/Projections/CMakeLists.txt b/Testing/Code/Projections/CMakeLists.txt index fcccb913023e121cb9100f30f1217b4e034b3e87..4d81ed0060b2fbd7b468fa933064fffe27c58db8 100644 --- a/Testing/Code/Projections/CMakeLists.txt +++ b/Testing/Code/Projections/CMakeLists.txt @@ -165,6 +165,7 @@ ADD_TEST(prTvSensorModelRadarSat2 ${PROJECTIONS_TESTS1} --compare-ascii ${NOTOL} ${BASELINE_FILES}/prTvSensorModelRadarSat2.txt ${TEMP}/prTvSensorModelRadarSat2.txt + --ignore-lines-with 3 product_xml_filename meters_per_pixel_x meters_per_pixel_y otbSensorModel ${LARGEINPUT}/RADARSAT2/ALTONA/Fine_Quad-Pol_Dataset/PK6621_DK406_FQ9_20080405_124900_HH_VV_HV_VH_SLC_Altona/product.xml ${TEMP}/prTvSensorModelRadarSat2.txt