From 47d7a11e58e35b03366a773674a4e5c8ef503275 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Mon, 19 Sep 2016 11:53:45 +0200 Subject: [PATCH] ENH: use the RAM parameter in persistent filters --- .../app/otbDimensionalityReduction.cxx | 5 ++++- Modules/Applications/AppImageUtils/app/otbColorMapping.cxx | 5 +++-- Modules/Applications/AppImageUtils/app/otbCompareImages.cxx | 4 ++++ .../AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx | 4 ++++ .../AppSegmentation/app/otbLSMSVectorization.cxx | 4 ++++ .../AppStereo/app/otbStereoRectificationGridGenerator.cxx | 3 ++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx index 06e07d00ad..2359b00bb6 100644 --- a/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx +++ b/Modules/Applications/AppDimensionalityReduction/app/otbDimensionalityReduction.cxx @@ -169,6 +169,8 @@ private: SetParameterDescription("outmatrix", "Filename to store the transformation matrix (csv format)"); MandatoryOff("outmatrix"); + AddRAMParameter(); + // Doc example parameter settings SetDocExampleParameterValue("in", "cupriteSubHsi.tif"); SetDocExampleParameterValue("out", "FilterOutput.tif"); @@ -420,7 +422,8 @@ private: m_MinMaxFilter = MinMaxFilterType::New(); m_MinMaxFilter->SetInput(m_ForwardFilter->GetOutput()); - m_MinMaxFilter->GetStreamer()->SetNumberOfLinesStrippedStreaming(50); + //m_MinMaxFilter->GetStreamer()->SetNumberOfLinesStrippedStreaming(50); + m_MinMaxFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); AddProcess(m_MinMaxFilter->GetStreamer(), "Min/Max computing"); m_MinMaxFilter->Update(); diff --git a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx index 37d55102e5..aded04dc11 100644 --- a/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx +++ b/Modules/Applications/AppImageUtils/app/otbColorMapping.cxx @@ -293,8 +293,6 @@ private: SetParameterDescription("out","Output image filename"); SetDefaultOutputPixelType("out",ImagePixelType_uint8); - AddRAMParameter(); - // --- OPERATION --- : Label to color / Color to label AddParameter(ParameterType_Choice, "op", "Operation"); SetParameterDescription("op","Selection of the operation to execute (default is : label to color)."); @@ -384,6 +382,7 @@ private: SetMinimumParameterIntValue("method.image.up", 0); SetMaximumParameterIntValue("method.image.up", 100); + AddRAMParameter(); // Doc example parameter settings SetDocExampleParameterValue("in", "ROI_QB_MUL_1_SVN_CLASS_MULTI.png"); @@ -611,6 +610,8 @@ private: m_StatisticsMapFromLabelImageFilter = StreamingStatisticsMapFromLabelImageFilterType::New(); m_StatisticsMapFromLabelImageFilter->SetInput(GetParameterImage("method.image.in")); m_StatisticsMapFromLabelImageFilter->SetInputLabelImage(m_CasterToLabelImage->GetOutput()); + m_StatisticsMapFromLabelImageFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(m_StatisticsMapFromLabelImageFilter->GetStreamer(), "Computing statistics on labels..."); m_StatisticsMapFromLabelImageFilter->Update(); StreamingStatisticsMapFromLabelImageFilterType::MeanValueMapType diff --git a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx index 7cc5fec084..aaf58e8cd1 100644 --- a/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx +++ b/Modules/Applications/AppImageUtils/app/otbCompareImages.cxx @@ -114,6 +114,8 @@ private: SetParameterDescription("count", "Nb of pixels which are different"); SetParameterRole("count", Role_Output); + AddRAMParameter(); + // Doc example parameter settings SetDocExampleParameterValue("ref.in", "GomaApres.png"); SetDocExampleParameterValue("ref.channel", "1"); @@ -206,6 +208,8 @@ private: m_CompareFilter->SetInput1(m_ExtractRefFilter->GetOutput()); m_CompareFilter->SetInput2(m_ExtractMeasFilter->GetOutput()); m_CompareFilter->SetPhysicalSpaceCheck(false); + m_CompareFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(m_CompareFilter->GetStreamer(), "Comparing..."); m_CompareFilter->Update(); // Show result diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx index 23f3397859..5adea92933 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSSmallRegionsMerging.cxx @@ -108,6 +108,8 @@ private: SetDefaultParameterInt("tilesizey", 500); SetMinimumParameterIntValue("tilesizey", 1); + AddRAMParameter(); + // Doc example parameter settings SetDocExampleParameterValue("in","smooth.tif"); SetDocExampleParameterValue("inseg","segmentation.tif"); @@ -142,6 +144,8 @@ private: StatisticsImageFilterType::Pointer stats = StatisticsImageFilterType::New(); stats->SetInput(labelIn); + stats->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(stats->GetStreamer(), "Retrieve region count..."); stats->Update(); unsigned int regionCount=stats->GetMaximum(); diff --git a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx index 9a0c070e99..9238a008f5 100644 --- a/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLSMSVectorization.cxx @@ -94,6 +94,8 @@ private: SetDefaultParameterInt("tilesizey", 500); SetMinimumParameterIntValue("tilesizey", 1); + AddRAMParameter(); + // Doc example parameter settings SetDocExampleParameterValue("in","avions.tif"); SetDocExampleParameterValue("inseg","merged.tif"); @@ -129,6 +131,8 @@ private: StatisticsImageFilterType::Pointer stats = StatisticsImageFilterType::New(); stats->SetInput(labelIn); + stats->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(stats->GetStreamer(), "Retrieve region count..."); stats->Update(); unsigned int regionCount=stats->GetMaximum(); diff --git a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx index de20a9b507..6517ccd845 100644 --- a/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx +++ b/Modules/Applications/AppStereo/app/otbStereoRectificationGridGenerator.cxx @@ -239,7 +239,8 @@ private: m_DEMToImageGenerator->AboveEllipsoidOn(); m_StatisticsFilter->SetInput(m_DEMToImageGenerator->GetOutput()); - AddProcess(m_StatisticsFilter,"Computing DEM statistics ..."); + m_StatisticsFilter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); + AddProcess(m_StatisticsFilter->GetStreamer(),"Computing DEM statistics ..."); m_StatisticsFilter->Update(); otb::DEMHandler::Instance()->SetDefaultHeightAboveEllipsoid(m_StatisticsFilter->GetMean()); -- GitLab