diff --git a/Documentation/SoftwareGuide/Latex/ReleaseNotes.tex b/Documentation/SoftwareGuide/Latex/ReleaseNotes.tex index d94fd7b1e0c055905f05c14881aa09866405840a..ab97f045e27723cf6dcdd8436c2915b2e1b29fb4 100644 --- a/Documentation/SoftwareGuide/Latex/ReleaseNotes.tex +++ b/Documentation/SoftwareGuide/Latex/ReleaseNotes.tex @@ -1 +1 @@ -\verbatiminput{RELEASE\_NOTES.txt} +\verbatiminput{RELEASE_NOTES.txt} diff --git a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx index b3e2a04b5ebe9ce9647f0e0c46979080971e0b4d..3de87d84bdb2d36261bedc3f441b3ff388efb4a3 100644 --- a/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbComputeImagesStatistics.cxx @@ -86,44 +86,39 @@ private: // Samples typedef double ValueType; typedef itk::VariableLengthVector<ValueType> MeasurementType; + typedef itk::VariableSizeMatrix<ValueType> MatrixValueType; - unsigned int nbSamples = 0; unsigned int nbBands = 0; + FloatVectorImageListType* imageList = GetParameterImageList("il"); + FloatVectorImageListType::InternalContainerSizeType nbImages = imageList->Size(); + + // Initialization, all image have same size and number of band/component + FloatVectorImageType* firstImage = imageList->GetNthElement(0); + nbBands = firstImage->GetNumberOfComponentsPerPixel(); + // Build a Measurement Vector of mean - MeasurementType mean; + MatrixValueType mean(nbBands, static_cast<unsigned int>(nbImages)); + mean.Fill(itk::NumericTraits<MatrixValueType::ValueType>::Zero); - // Build a MeasurementVector of variance - MeasurementType variance; + // Build a Measurement Matrix of variance + MatrixValueType variance(nbBands, static_cast<unsigned int>(nbImages)); + variance.Fill(itk::NumericTraits<MatrixValueType::ValueType>::Zero); - FloatVectorImageListType* imageList = GetParameterImageList("il"); + // Build a Measurement Matrix of nbSamples + MatrixValueType nbSamples(nbBands, static_cast<unsigned int>(nbImages)); + nbSamples.Fill(itk::NumericTraits<MatrixValueType::ValueType>::Zero); //Iterate over all input images - for (unsigned int imageId = 0; imageId < imageList->Size(); ++imageId) + for (unsigned int imageId = 0; imageId < nbImages; ++imageId) { FloatVectorImageType* image = imageList->GetNthElement(imageId); - - if (nbBands == 0) - { - nbBands = image->GetNumberOfComponentsPerPixel(); - } - else if (nbBands != image->GetNumberOfComponentsPerPixel()) + if (nbBands != image->GetNumberOfComponentsPerPixel()) { itkExceptionMacro(<< "The image #" << imageId + 1 << " has " << image->GetNumberOfComponentsPerPixel() << " bands, while the image #1 has " << nbBands ); } - FloatVectorImageType::SizeType size = image->GetLargestPossibleRegion().GetSize(); - - //Set the measurement vectors size if it's the first iteration - if (imageId == 0) - { - mean.SetSize(nbBands); - mean.Fill(0.); - variance.SetSize(nbBands); - variance.Fill(0.); - } - // Compute Statistics of each VectorImage StreamingStatisticsVImageFilterType::Pointer statsEstimator = StreamingStatisticsVImageFilterType::New(); std::ostringstream processName; @@ -131,41 +126,88 @@ private: AddProcess(statsEstimator->GetStreamer(), processName.str().c_str()); statsEstimator->SetInput(image); statsEstimator->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); - if( HasValue( "bv" )==true ) + + if( HasValue( "bv" ) ) { statsEstimator->SetIgnoreUserDefinedValue(true); statsEstimator->SetUserIgnoredValue(GetParameterFloat("bv")); } statsEstimator->Update(); - mean += statsEstimator->GetMean(); - for (unsigned int itBand = 0; itBand < nbBands; itBand++) + + MeasurementType nbRelevantPixels = statsEstimator->GetNbRelevantPixels(); + MeasurementType meanPerBand = statsEstimator->GetMean(); + + for(unsigned int itBand = 0; itBand < nbBands; itBand++) + { + mean(itBand, imageId) = meanPerBand[itBand]; + variance(itBand, imageId) = (statsEstimator->GetCovariance())( itBand, itBand ); + nbSamples(itBand, imageId) = nbRelevantPixels[itBand]; + } + } + + // Compute total mean and pooled variation for each band of the image list + MeasurementType totalSamplesPerBand; + totalSamplesPerBand.SetSize(nbBands); + totalSamplesPerBand.Fill(itk::NumericTraits<MeasurementType::ValueType>::Zero); + + MeasurementType totalMeanPerBand; + totalMeanPerBand.SetSize(nbBands); + totalMeanPerBand.Fill(itk::NumericTraits<MeasurementType::ValueType>::Zero); + + MeasurementType totalVariancePerBand; + totalVariancePerBand.SetSize(nbBands); + totalVariancePerBand.Fill(itk::NumericTraits<MeasurementType::ValueType>::Zero); + + for (unsigned int imageId = 0; imageId < nbImages; ++imageId) + { + for(unsigned int itBand = 0; itBand < nbBands; itBand++) { - variance[itBand] += (size[0] * size[1] - 1) * (statsEstimator->GetCovariance())(itBand, itBand); + MeasurementType::ValueType nbSample = nbSamples(itBand, imageId); + totalSamplesPerBand[itBand] += nbSample; + totalMeanPerBand[itBand] += mean(itBand, imageId) * nbSample; + totalVariancePerBand[itBand] += variance(itBand, imageId) * (nbSample - 1); } - //Increment nbSamples - nbSamples += size[0] * size[1]; } - //Divide by the number of input images to get the mean over all layers - mean /= imageList->Size(); - //Apply the pooled variance formula - variance /= (nbSamples - imageList->Size()); + // Check 0 division + for(unsigned int itBand = 0; itBand < nbBands; itBand++) + { + MeasurementType::ValueType nbSample = totalSamplesPerBand[itBand]; + + if ( nbSample > nbImages ) + { + totalVariancePerBand[itBand] /= (nbSample - nbImages); + } + else + { + totalVariancePerBand[itBand] = itk::NumericTraits<ValueType>::Zero; + } + + if ( nbSample != 0 ) + { + totalMeanPerBand[itBand] /= nbSample; + } + else + { + totalMeanPerBand[itBand] = itk::NumericTraits<ValueType>::Zero; + } + } MeasurementType stddev; stddev.SetSize(nbBands); - stddev.Fill(0.); - for (unsigned int i = 0; i < variance.GetSize(); ++i) + stddev.Fill(itk::NumericTraits<MeasurementType::ValueType>::Zero); + for (unsigned int i = 0; i < totalVariancePerBand.GetSize(); ++i) { - stddev[i] = vcl_sqrt(variance[i]); + stddev[i] = vcl_sqrt(totalVariancePerBand[i]); } - if( HasValue( "out" )==true ) + if( HasValue( "out" ) ) { // Write the Statistics via the statistic writer typedef otb::StatisticsXMLFileWriter<MeasurementType> StatisticsWriter; StatisticsWriter::Pointer writer = StatisticsWriter::New(); writer->SetFileName(GetParameterString("out")); - writer->AddInput("mean", mean); + writer->AddInput("mean", totalMeanPerBand); writer->AddInput("stddev", stddev); writer->Update(); } diff --git a/Modules/Applications/AppSARCalibration/test/CMakeLists.txt b/Modules/Applications/AppSARCalibration/test/CMakeLists.txt index 585c4d1e48dd3f1603123ce7ffcc7d5eb51c345b..dfceda5530c883a31d3b892e6d04ef673833a6b1 100644 --- a/Modules/Applications/AppSARCalibration/test/CMakeLists.txt +++ b/Modules/Applications/AppSARCalibration/test/CMakeLists.txt @@ -2,12 +2,22 @@ otb_module_test() #----------- SarRadiometricCalibration TESTS ---------------- otb_test_application(NAME apTvRaSarRadiometricCalibration_SENTINEL1 APP SARCalibration - OPTIONS -in ${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.tif?&geom=${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.geom + OPTIONS -in ${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_1200_1100_300_300.tiff?&geom=${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_1200_1100_300_300.geom -out ${TEMP}/apTvRaSarRadiometricCalibration_SENTINEL1.tif VALID --compare-image ${NOTOL} ${BASELINE}/raTvSarRadiometricCalibration_SENTINEL1.tif ${TEMP}/apTvRaSarRadiometricCalibration_SENTINEL1.tif ) +if(OTB_DATA_USE_LARGEINPUT) + otb_test_application(NAME apTvRaSarRadiometricCalibration_SENTINEL1_PRODUCT_INPUT + APP SARCalibration + OPTIONS -in LARGEINPUT{SENTINEL1/S1A_S6_SLC__1SSV_20150619T195043/measurement/s1a-s6-slc-vv-20150619t195043-20150619t195101-006447-00887d-001.tiff} + -out "${TEMP}/apTvRaSarRadiometricCalibration_SENTINEL1_PRODUCT_INPUT.tif?box=1200:1100:256:256" + VALID --compare-image ${NOTOL} + ${BASELINE}/raTvSarRadiometricCalibration_SENTINEL1_PRODUCT_INPUT.tif + ${TEMP}/apTvRaSarRadiometricCalibration_SENTINEL1_PRODUCT_INPUT.tif ) +endif() + otb_test_application(NAME apTvRaSarRadiometricCalibration_RADARSAT2 APP SARCalibration OPTIONS -in ${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.tif?&geom=${INPUTDATA}/RADARSAT2_ALTONA_300_300_VV.geom diff --git a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx index 2a42ba1430cd4d71b81388037a8cfc80f0bee821..e00c1aa0cb4ea48ea6b4a74881f5a4e484f270af 100644 --- a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx @@ -94,9 +94,9 @@ Sentinel1ImageMetadataInterface otbMsgDevMacro(<<"calibration.startTime: "<<std::setprecision(16) << firstLineTime); otbMsgDevMacro(<<"calibration.stopTime : "<<std::setprecision(16) << lastLineTime); - const std::string supportDataPrefix = "support_data."; //make && use GetBandPrefix(subSwath, polarisation) + //const std::string supportDataPrefix = "support_data."; //make && use GetBandPrefix(subSwath, polarisation) - const int numOfLines = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey(supportDataPrefix + "number_lines"), supportDataPrefix + "number_lines(int)"); + const int numOfLines = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey("number_lines"), "number_lines(int)"); otbMsgDevMacro(<<"numOfLines : " << numOfLines); const int count = Utils::LexicalCast<int>(imageKeywordlist.GetMetadataByKey("calibration.count"), "calibration.count"); diff --git a/Modules/Core/Metadata/test/CMakeLists.txt b/Modules/Core/Metadata/test/CMakeLists.txt index 0217f7387745ff58527bb6c3a5c618e06e4e0345..dd74719a20306c81c292cd1be5e890afccfb3e58 100644 --- a/Modules/Core/Metadata/test/CMakeLists.txt +++ b/Modules/Core/Metadata/test/CMakeLists.txt @@ -385,7 +385,7 @@ otb_add_test(NAME ioTvSarCalibrationLookupDataTest_SENTINEL1 COMMAND otbMetadata --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvSarCalibrationLookupDataTest_SENTINEL1.txt ${TEMP}/ioTvSarCalibrationLookupDataTest_SENTINEL1.txt otbSarCalibrationLookupDataTest - ${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.tif?&geom=${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_300_300.geom + ${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_1200_1100_300_300.tiff?&geom=${INPUTDATA}/SENTINEL1_SLC_S6_1S_extract_1200_1100_300_300.geom ${TEMP}/ioTvSarCalibrationLookupDataTest_SENTINEL1.txt ) diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h index d3da80dceb3d65e08965727eec485e187c8da615..fcb3d0d4f03d0042601510569e8994a449b3c993 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.h @@ -88,6 +88,7 @@ public: /** Type to use for computations. */ typedef itk::VariableSizeMatrix<PrecisionType> MatrixType; typedef itk::VariableLengthVector<PrecisionType> RealPixelType; + typedef itk::VariableLengthVector<unsigned long> CountType; /** Type of DataObjects used for outputs */ typedef itk::SimpleDataObjectDecorator<RealType> RealObjectType; @@ -95,6 +96,15 @@ public: typedef itk::SimpleDataObjectDecorator<PixelType> PixelObjectType; typedef itk::SimpleDataObjectDecorator<RealPixelType> RealPixelObjectType; typedef itk::SimpleDataObjectDecorator<MatrixType> MatrixObjectType; + typedef itk::SimpleDataObjectDecorator<CountType> CountObjectType; + + /** Return the number of relevant pixels **/ + CountType GetNbRelevantPixels() const + { + return this->GetNbRelevantPixelsOutput()->Get(); + } + CountObjectType* GetNbRelevantPixelsOutput(); + const CountObjectType* GetNbRelevantPixelsOutput() const; /** Return the computed Min */ PixelType GetMinimum() const @@ -300,6 +310,8 @@ public: typedef typename StatFilterType::RealPixelObjectType RealPixelObjectType; typedef typename StatFilterType::MatrixType MatrixType; typedef typename StatFilterType::MatrixObjectType MatrixObjectType; + typedef typename StatFilterType::CountType CountType; + typedef typename StatFilterType::CountObjectType CountObjectType; typedef typename StatFilterType::InternalPixelType InternalPixelType; @@ -313,6 +325,21 @@ public: return this->GetFilter()->GetInput(); } + /** Return the number of relevant pixels **/ + CountType GetNbRelevantPixels() const + { + return this->GetFilter()->GetNbRelevantPixelsOutput()->Get(); + } + CountObjectType* GetNbRelevantPixelsOutput() + { + return this->GetFilter()->GetNbRelevantPixelsOutput(); + } + const CountObjectType* GetNbRelevantPixelsOutput() const + { + return this->GetFilter()->GetNbRelevantPixelsOutput(); + } + + /** Return the computed Minimum. */ RealPixelType GetMinimum() const { @@ -383,7 +410,7 @@ public: return this->GetFilter()->GetCovarianceOutput(); } - /** Return the computed Covariance. */ + /** Return the computed Correlation. */ MatrixType GetCorrelation() const { return this->GetFilter()->GetCorrelationOutput()->Get(); @@ -425,7 +452,7 @@ public: return this->GetFilter()->GetComponentCovarianceOutput(); } - /** Return the computed Covariance. */ + /** Return the computed Correlation. */ RealType GetComponentCorrelation() const { return this->GetFilter()->GetComponentCorrelationOutput()->Get(); diff --git a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx index e76b876e578063e4914da29921c93b591d004a35..fbd4e8004e2a6be33dea3a5315e40777b7a176ba 100644 --- a/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx +++ b/Modules/Filtering/Statistics/include/otbStreamingStatisticsVectorImageFilter.txx @@ -43,7 +43,7 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> // allocate the data objects for the outputs which are // just decorators around vector/matrix types - for (unsigned int i = 1; i < 10; ++i) + for (unsigned int i = 1; i < 11; ++i) { this->itk::ProcessObject::SetNthOutput(i, this->MakeOutput(i).GetPointer()); } @@ -83,6 +83,9 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> // component mean, component covariance, component correlation return static_cast<itk::DataObject*>(RealObjectType::New().GetPointer()); break; + case 10: + // relevant pixel + return static_cast<itk::DataObject*>(CountObjectType::New().GetPointer()); default: // might as well make an image return static_cast<itk::DataObject*>(TInputImage::New().GetPointer()); @@ -90,6 +93,23 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> } } +template<class TInputImage, class TPrecision> +typename PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision>::CountObjectType* +PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> +::GetNbRelevantPixelsOutput() +{ + return static_cast<CountObjectType*>(this->itk::ProcessObject::GetOutput(10)); +} + +template<class TInputImage, class TPrecision> +const typename PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision>::CountObjectType* +PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> +::GetNbRelevantPixelsOutput() const +{ + return static_cast<const CountObjectType*>(this->itk::ProcessObject::GetOutput(10)); +} + + template<class TInputImage, class TPrecision> typename PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision>::PixelObjectType* PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> @@ -419,10 +439,15 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> ); } - unsigned int nbRelevantPixels = + unsigned int nbRelevantPixel = nbPixels - (ignoredInfinitePixelCount + ignoredUserPixelCount); - if( nbRelevantPixels==0 ) + CountType nbRelevantPixels(numberOfComponent); + nbRelevantPixels.Fill(nbRelevantPixel); + + this->GetNbRelevantPixelsOutput()->Set(nbRelevantPixels); + + if( nbRelevantPixel==0 ) { itkExceptionMacro( "Statistics cannot be calculated with zero relevant pixels." @@ -438,15 +463,15 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> if (m_EnableFirstOrderStats) { - this->GetComponentMeanOutput()->Set(streamFirstOrderComponentAccumulator / (nbRelevantPixels * numberOfComponent)); + this->GetComponentMeanOutput()->Set(streamFirstOrderComponentAccumulator / (nbRelevantPixel * numberOfComponent)); - this->GetMeanOutput()->Set(streamFirstOrderAccumulator / nbRelevantPixels); + this->GetMeanOutput()->Set(streamFirstOrderAccumulator / nbRelevantPixel); this->GetSumOutput()->Set(streamFirstOrderAccumulator); } if (m_EnableSecondOrderStats) { - MatrixType cor = streamSecondOrderAccumulator / nbRelevantPixels; + MatrixType cor = streamSecondOrderAccumulator / nbRelevantPixel; this->GetCorrelationOutput()->Set(cor); const RealPixelType& mean = this->GetMeanOutput()->Get(); @@ -454,18 +479,18 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> double regul = 1.0; double regulComponent = 1.0; - if( m_UseUnbiasedEstimator && nbRelevantPixels>1 ) + if( m_UseUnbiasedEstimator && nbRelevantPixel>1 ) { regul = - static_cast< double >( nbRelevantPixels ) / - ( static_cast< double >( nbRelevantPixels ) - 1.0 ); + static_cast< double >( nbRelevantPixel ) / + ( static_cast< double >( nbRelevantPixel ) - 1.0 ); } - - if( m_UseUnbiasedEstimator && (nbRelevantPixels * numberOfComponent) > 1 ) + + if( m_UseUnbiasedEstimator && (nbRelevantPixel * numberOfComponent) > 1 ) { regulComponent = - static_cast< double >(nbRelevantPixels * numberOfComponent) / - ( static_cast< double >(nbRelevantPixels * numberOfComponent) - 1.0 ); + static_cast< double >(nbRelevantPixel * numberOfComponent) / + ( static_cast< double >(nbRelevantPixel * numberOfComponent) - 1.0 ); } MatrixType cov = cor; @@ -478,8 +503,8 @@ PersistentStreamingStatisticsVectorImageFilter<TInputImage, TPrecision> } this->GetCovarianceOutput()->Set(cov); - this->GetComponentMeanOutput()->Set(streamFirstOrderComponentAccumulator / (nbRelevantPixels * numberOfComponent)); - this->GetComponentCorrelationOutput()->Set(streamSecondOrderComponentAccumulator / (nbRelevantPixels * numberOfComponent)); + this->GetComponentMeanOutput()->Set(streamFirstOrderComponentAccumulator / (nbRelevantPixel * numberOfComponent)); + this->GetComponentCorrelationOutput()->Set(streamSecondOrderComponentAccumulator / (nbRelevantPixel * numberOfComponent)); this->GetComponentCovarianceOutput()->Set( regulComponent * (this->GetComponentCorrelation() - (this->GetComponentMean() * this->GetComponentMean()))); @@ -586,6 +611,7 @@ PersistentStreamingStatisticsVectorImageFilter<TImage, TPrecision> os << indent << "Mean: " << this->GetMeanOutput()->Get() << std::endl; os << indent << "Covariance: " << this->GetCovarianceOutput()->Get() << std::endl; os << indent << "Correlation: " << this->GetCorrelationOutput()->Get() << std::endl; + os << indent << "Relevant pixel: " << this->GetNbRelevantPixelsOutput()->Get() << std::endl; os << indent << "Component Mean: " << this->GetComponentMeanOutput()->Get() << std::endl; os << indent << "Component Covariance: " << this->GetComponentCovarianceOutput()->Get() << std::endl; os << indent << "Component Correlation: " << this->GetComponentCorrelationOutput()->Get() << std::endl; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 4402dbf028504c9187f6a47145131fec5fd99cbb..26c389002dc32713c481a6fd5fc6728f57a83d73 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -483,6 +483,34 @@ public: */ void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, InputImageListParameter::ImageBaseType * img); +/** + * Add a value to a parameter list as a string + * + * Can be called for parameter types: + * \li ParameterType_InputImageList + * + * \in parameter The parameter key + * \in str The string + * \throw itk::Exception if parameter is not found or not an + * InputImageList parameter + */ + void AddParameterStringList(std::string parameter, const std::string & str); + + /** + * Set the nth value of a parameter list as a string. + * + * Can be called for parameter types: + * \li ParameterType_InputImageList + * + * \in parameter The parameter key + * \in id Position at which to set the ImageBase pointer + * \in str The string + * \throw itk::Exception if parameter is not found or not an + * InputImageList parameter or if id is out of bounds + */ + void SetNthParameterStringList(std::string parameter, const unsigned int &id, const std::string& str); + + /** * Clear all images from an InputImageList parameter. * diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 4611450d2120cb31fdcd43d36e6fa9aae8252143..cf17ba6fc9b2d0856d0d69e5350740b0803a83dc 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -1263,6 +1263,42 @@ void Application::SetNthParameterInputImageList(std::string parameter, const uns } +void Application::AddParameterStringList(std::string parameter, const std::string & str) +{ + Parameter* param = GetParameterByKey(parameter); + + InputImageListParameter * paramDown = dynamic_cast<InputImageListParameter *>(param); + + if(paramDown) + { + paramDown->AddFromFileName(str); + } + else + { + itkExceptionMacro(<<parameter << "parameter can't be casted to InputImageListParameter"); + } + +} + +void Application::SetNthParameterStringList(std::string parameter, const unsigned int &id, const std::string & str) +{ + Parameter* param = GetParameterByKey(parameter); + + InputImageListParameter * paramDown = dynamic_cast<InputImageListParameter *>(param); + + if(paramDown) + { + paramDown->SetNthFileName(id,str); + } + else + { + itkExceptionMacro(<<parameter << "parameter can't be casted to InputImageListParameter"); + } + +} + + + void Application::ClearParameterInputImageList(std::string parameter) { Parameter* param = GetParameterByKey(parameter); diff --git a/Modules/Wrappers/ApplicationEngine/test/otbApplicationMemoryConnectTest.cxx b/Modules/Wrappers/ApplicationEngine/test/otbApplicationMemoryConnectTest.cxx index e0f646d59565adb1f98323c18fd4f59d58d3231f..b9d92f8d265f873ef87b6ef0e038ab6119b513df 100644 --- a/Modules/Wrappers/ApplicationEngine/test/otbApplicationMemoryConnectTest.cxx +++ b/Modules/Wrappers/ApplicationEngine/test/otbApplicationMemoryConnectTest.cxx @@ -64,6 +64,7 @@ int otbApplicationMemoryConnectTest(int argc, char * argv[]) app4->AddImageToParameterInputImageList("il",app2->GetParameterOutputImage("out")); app4->AddImageToParameterInputImageList("il",app3->GetParameterOutputImage("out")); + app4->AddParameterStringList("il",infname); app4->ExecuteAndWriteOutput(); diff --git a/Modules/Wrappers/SWIG/src/otbApplication.i b/Modules/Wrappers/SWIG/src/otbApplication.i index c617e05e7220d28d8db455a92f130c8e0ebed7f4..aa93633ba359170270f853d5b4973c7cfa54de1e 100644 --- a/Modules/Wrappers/SWIG/src/otbApplication.i +++ b/Modules/Wrappers/SWIG/src/otbApplication.i @@ -209,7 +209,9 @@ public: ComplexInputImageParameter::ImageBaseType * GetParameterComplexOutputImage(std::string parameter); void SetParameterComplexInputImage(std::string parameter, ComplexInputImageParameter::ImageBaseType * inputImage); void AddImageToParameterInputImageList(std::string parameter,InputImageParameter::ImageBaseType * img); - void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, InputImageParameter::ImageBaseType * img); + void AddParameterStringList(std::string parameter,const std::string & str); + void SetNthParameterInputImageList(std::string parameter, const unsigned int &id, InputImageParameter::ImageBaseType * img); + void SetNthParameterStringList(std::string parameter, const unsigned int &id, const std::string& str); void ClearParameterInputImageList(std::string parameter); unsigned int GetNumberOfElementsInParameterInputImageList(std::string parameter); diff --git a/Modules/Wrappers/SWIG/test/python/PythonConnectApplications.py b/Modules/Wrappers/SWIG/test/python/PythonConnectApplications.py index 0b25eb0018f1044a737b69e776df8e6acd1d4393..30a0be351910636d28e5969d050e0df2c3548bd6 100644 --- a/Modules/Wrappers/SWIG/test/python/PythonConnectApplications.py +++ b/Modules/Wrappers/SWIG/test/python/PythonConnectApplications.py @@ -21,6 +21,7 @@ def test(otb, argv): app4.AddImageToParameterInputImageList("il",app2.GetParameterOutputImage("out")); app4.AddImageToParameterInputImageList("il",app3.GetParameterOutputImage("out")); + app4.AddParameterStringList("il",argv[1]) app4.OUT = argv[2] app4.ExecuteAndWriteOutput() diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 9f4946140f5f7ff173446c045420dd4d452eee29..e7815e818e73fbf246819fd7ae5af58d4c015079 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1299,7 +1299,7 @@ OTB-v.3.14.0 - Changes since version 3.12.0 (2012/07/09) * 0000555: monteverdi -in does not work with JP2 images * 0000560: Monteverdi compilation error * 0000527: While saving dataset with rescaling option, - the channels n° > 3 are incorrect + the channels nb > 3 are incorrect * OTB-applications * 0000518: Missing GDAL dependencies