diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index dd339f5ab7bfa4d76c5e1ea0d35c64bb2a34d03f..f036cc0e37799343ffa29f615fd250d843968ac1 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -59,11 +59,6 @@ OTB_CREATE_APPLICATION(NAME SARCartesianMeanEstimation LINK_LIBRARIES ${${otb-module}_LIBRARIES} ) -OTB_CREATE_APPLICATION(NAME SARCartesianMeanWithMeanPerLineEstimation - SOURCES otbSARCartesianMeanWithMeanPerLineEstimation.cxx - LINK_LIBRARIES ${${otb-module}_LIBRARIES} -) - OTB_CREATE_APPLICATION(NAME SARInterferogram SOURCES otbSARInterferogram.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES} diff --git a/app/otbSARAmplitudeEstimation.cxx b/app/otbSARAmplitudeEstimation.cxx index 60677e6e307a142171da437d3be82a31e34a421c..d38ccf25edb87fb782fd5ce1cd83a6991a22b9e9 100644 --- a/app/otbSARAmplitudeEstimation.cxx +++ b/app/otbSARAmplitudeEstimation.cxx @@ -64,10 +64,11 @@ private: SetDocLongDescription("This application estimates a simulated amplitude image thanks to a DEM file."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "indemproj", "Input vector of DEM projected into SAR geometry"); diff --git a/app/otbSARCartesianMeanEstimation.cxx b/app/otbSARCartesianMeanEstimation.cxx index 02f2eb91b8f2f9aff30d27356974ae3853fea550..2ab5f58d07d941d872a2b4b666c29c4bda3060ca 100644 --- a/app/otbSARCartesianMeanEstimation.cxx +++ b/app/otbSARCartesianMeanEstimation.cxx @@ -64,10 +64,11 @@ private: SetDocLongDescription("This application estimates a simulated cartesian mean image thanks to a DEM file."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "indemproj", "Input vector of DEM projected into SAR geometry"); diff --git a/app/otbSARCartesianMeanWithMeanPerLineEstimation.cxx b/app/otbSARCartesianMeanWithMeanPerLineEstimation.cxx deleted file mode 100644 index 70f4456db6f42245f9832cb0cd5c2755bf2bdba9..0000000000000000000000000000000000000000 --- a/app/otbSARCartesianMeanWithMeanPerLineEstimation.cxx +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2005-2018 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "otbWrapperApplication.h" -#include "otbWrapperApplicationFactory.h" - -#include "otbSARDEMPolygonsAnalysisImageFilter.h" -#include "otbSARCartesianMeanWithMeanPerLineFunctor.h" - -#include "otbWrapperOutputImageParameter.h" - -#include <iostream> -#include <string> -#include <fstream> - -namespace otb -{ -namespace Wrapper -{ - -class SARCartesianMeanWithMeanPerLineEstimation : public Application -{ -public: - typedef SARCartesianMeanWithMeanPerLineEstimation Self; - typedef itk::SmartPointer<Self> Pointer; - - itkNewMacro(Self); - itkTypeMacro(SARCartesianMeanWithMeanPerLineEstimation, otb::Wrapper::Application); - - // Pixels - typedef typename FloatVectorImageType::PixelType ImageInPixelType; - typedef typename DoubleVectorImageType::PixelType ImageOutPixelType; - - // Function - typedef otb::Function::SARCartesianMeanWithMeanPerLineFunctor<ImageInPixelType, ImageOutPixelType> CartesianMeanFunctorType; - - // Filters - typedef otb::SARDEMPolygonsAnalysisImageFilter < FloatVectorImageType, DoubleVectorImageType, FloatImageType, ComplexFloatImageType, CartesianMeanFunctorType > FilterType; - -private: - void DoInit() override - { - SetName("SARCartesianMeanWithMeanPerLineEstimation"); - SetDescription("SAR Cartesian Mean estimation thanks to the associated DEM."); - - SetDocLongDescription("This application estimates a cartesian image per pixel and per line thanks to a DEM file."); - - //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); - SetDocAuthors("OTB-Team"); - SetDocSeeAlso(" "); - AddDocTag(Tags::SAR); - - //Parameter declarations - AddParameter(ParameterType_InputImage, "indemproj", "Input vector of DEM projected into SAR geometry"); - SetParameterDescription("indemproj", "Input vector image for cartesian mean estimation."); - - AddParameter(ParameterType_InputImage, "indem", "Input DEM"); - SetParameterDescription("indem", "DEM to extract DEM geometry."); - - AddParameter(ParameterType_InputImage, "insar", "Input SAR image"); - SetParameterDescription("insar", "SAR Image to extract SAR geometry."); - - AddParameter(ParameterType_Int, "indirectiondemc", "Range direction for DEM scan"); - SetParameterDescription("indirectiondemc", "Range direction for DEM scan."); - SetDefaultParameterInt("indirectiondemc", 1); - MandatoryOff("indirectiondemc"); - - AddParameter(ParameterType_Int, "indirectiondeml", "Azimut direction for DEM scan"); - SetParameterDescription("indirectiondeml", "Azimut direction for DEM scan."); - SetDefaultParameterInt("indirectiondeml", 1); - MandatoryOff("indirectiondeml"); - - AddParameter(ParameterType_Int, "mlran", "Averaging on distance (output geometry)"); - SetParameterDescription("mlran","Averaging on distance (output geometry)"); - SetDefaultParameterInt("mlran", 3); - SetMinimumParameterIntValue("mlran", 1); - MandatoryOff("mlran"); - - AddParameter(ParameterType_Int, "mlazi", "Averaging on azimut (output geometry)"); - SetParameterDescription("mlazi","Averaging on azimut (output geometry)"); - SetDefaultParameterInt("mlazi", 3); - SetMinimumParameterIntValue("mlazi", 1); - MandatoryOff("mlazi"); - - AddParameter(ParameterType_OutputImage, "out", "Output cartesian (mean) Image for DEM Projection"); - SetParameterDescription("out","Output cartesian (mean) Image for DEM Projection."); - - AddParameter(ParameterType_OutputImage, "outopt", "Optionnal Output cartesian (mean) Per line"); - SetParameterDescription("outopt","Optionnal Output cartesian (mean) Per line."); - - - AddRAMParameter(); - - SetDocExampleParameterValue("indemproj","CLZY_S21E055.tiff"); - SetDocExampleParameterValue("indem","S21E055.hgt"); - SetDocExampleParameterValue("insar","s1a-s4-slc-vv-20160818t014650-20160818t014715-012648-013db1-002_SLC.tiff"); - SetDocExampleParameterValue("out","s1a-s4-simu-cartMean.tiff"); - SetDocExampleParameterValue("outopt","s1a-s4-simu-cartMeanPerLine.tiff"); - } - - void DoUpdateParameters() override - { - // Nothing to do here : all parameters are independent - } - - void DoExecute() override - { - // Get numeric parameters : ML factors and directions for DEM scan - int mlRan = GetParameterInt("mlran"); - int mlAzi = GetParameterInt("mlazi"); - int DEMScanDirectionC = GetParameterInt("indirectiondemc"); - int DEMScanDirectionL = GetParameterInt("indirectiondeml"); - - otbAppLogINFO(<<"ML Range : "<<mlRan); - otbAppLogINFO(<<"ML Azimut : "<<mlAzi); - otbAppLogINFO(<<"Direction (DEM scan) in range : "<<DEMScanDirectionC); - otbAppLogINFO(<<"Direction (DEM scan) in azimut : "<<DEMScanDirectionL); - - // Start the first pipelines (Read SAR and DEM image metedata) - ComplexFloatImageType::Pointer SARPtr = GetParameterComplexFloatImage("insar"); - FloatImageType::Pointer DEMPtr = GetParameterFloatImage("indem"); - - - // CartesianMeanEstimation Filter (use SARDEMPolygonsAnalysisImageFilter with SARCartesianMeanEstimationFunctor - // to estimate cartesian mean image per pixel and per line) - FilterType::Pointer filterCartesianMeanEstimation = FilterType::New(); - m_Ref.push_back(filterCartesianMeanEstimation.GetPointer()); - filterCartesianMeanEstimation->SetSARImageKeyWorList(SARPtr->GetImageKeywordlist()); - filterCartesianMeanEstimation->SetSARImagePtr(SARPtr); - filterCartesianMeanEstimation->SetDEMImagePtr(DEMPtr); - filterCartesianMeanEstimation->SetDEMInformation(0, DEMScanDirectionC, DEMScanDirectionL); - filterCartesianMeanEstimation->initializeMarginAndRSTransform(); - - // Function Type : SARCartesianMeanEstimationFunctor - int nbThreads = filterCartesianMeanEstimation->GetNumberOfThreads(); - CartesianMeanFunctorType::Pointer functor = CartesianMeanFunctorType::New(nbThreads, mlRan, mlAzi); - filterCartesianMeanEstimation->SetFunctorPtr(functor); - - - // Define the main pipeline (controlled with extended FileName) - std::string origin_FileName = GetParameterString("out"); - - // Check if FileName is extended (with the ? caracter) - // If not extended then override the FileName - if (origin_FileName.find("?") == std::string::npos && !origin_FileName.empty()) - { - std::string extendedFileName = origin_FileName; - - // Get the ram value (in MB) - int ram = GetParameterInt("ram"); - - // Define with the ram value, the number of lines for the streaming - int nbColSAR = SARPtr->GetLargestPossibleRegion().GetSize()[0]; - int nbLinesSAR = SARPtr->GetLargestPossibleRegion().GetSize()[1]; - // To determine the number of lines : - // nbColSAR * nbLinesStreaming * sizeof(OutputPixel) = RamValue/2 (/2 to be sure) - // OutputPixel are float => sizeof(OutputPixel) = 4 (Bytes) - long int ram_In_KBytes = (ram/2) * 1024; - long int nbLinesStreaming = (ram_In_KBytes / (nbColSAR)) * (1024/4); - - // Check the value of nbLinesStreaming - int nbLinesStreamingMax = 15000; - if (nbLinesStreamingMax > nbLinesSAR) - { - nbLinesStreamingMax = nbLinesSAR; - } - if (nbLinesStreaming <= 0 || nbLinesStreaming > nbLinesStreamingMax) - { - nbLinesStreaming = nbLinesStreamingMax; - } - - // Construct the extendedPart - std::ostringstream os; - os << "?&streaming:type=stripped&streaming:sizevalue=" << nbLinesStreaming; - - // Add the extendedPart - std::string extendedPart = os.str(); - extendedFileName.append(extendedPart); - - // Set the new FileName with extended options - SetParameterString("out", extendedFileName); - } - - // Execute the main Pipeline - filterCartesianMeanEstimation->SetInput(GetParameterImage<FloatVectorImageType>("indemproj")); - SetParameterOutputImage<DoubleVectorImageType>("out", filterCartesianMeanEstimation->GetOutput()); - SetParameterOutputImage<DoubleVectorImageType>("outopt", filterCartesianMeanEstimation->GetOptionnalOutput()); - } - // Vector for filters - std::vector<itk::ProcessObject::Pointer> m_Ref; - -}; - - -} - -} - -OTB_APPLICATION_EXPORT(otb::Wrapper::SARCartesianMeanWithMeanPerLineEstimation) diff --git a/app/otbSARCoRegistration.cxx b/app/otbSARCoRegistration.cxx index 229a93bb06d5547eb69238cd41514c55da6f7a95..d8e11ba7271fec1872f31bad668d3ef1c8023b1b 100644 --- a/app/otbSARCoRegistration.cxx +++ b/app/otbSARCoRegistration.cxx @@ -68,10 +68,11 @@ namespace otb " two SAR images thanks to a deformation grid."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "ingrid", "Input deformation grid"); diff --git a/app/otbSARCorrectionGrid.cxx b/app/otbSARCorrectionGrid.cxx index b61dcefabb1a206bbc575785641e7824e0901fb3..98df03ea7ac9aef1c8078bf545b341fafd63d38e 100644 --- a/app/otbSARCorrectionGrid.cxx +++ b/app/otbSARCorrectionGrid.cxx @@ -74,10 +74,11 @@ private: "components. This application can directly take the projectd DEM."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "indemgrid", "Input DEM grid (Vector Image)"); diff --git a/app/otbSARCorrelationGrid.cxx b/app/otbSARCorrelationGrid.cxx index 7976294dc787d51ade71678a69debb13785e7598..ca3c8b43206900f5b078e5f51ff0814cd112af4a 100644 --- a/app/otbSARCorrelationGrid.cxx +++ b/app/otbSARCorrelationGrid.cxx @@ -61,10 +61,11 @@ private: "The inputs of this application are MultiLooked images (real images)."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products and Cosmo are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "inmaster", "Input Master image (real image)"); @@ -151,11 +152,6 @@ void DoExecute() override minMaxFilter->SetImage(correlationFilter->GetOutput()); minMaxFilter->ComputeMaximum(); - float shiftSLC_range = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2.)- - minMaxFilter->GetIndexOfMaximum()[0]) * static_cast<float>(factorML_ran); - float shiftSLC_azimut = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2.) - -minMaxFilter->GetIndexOfMaximum()[1]) * static_cast<float>(factorML_azi); - float shiftML_range = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[0]/2.)- minMaxFilter->GetIndexOfMaximum()[0]); float shiftML_azimut = ((correlationFilter->GetOutput()->GetLargestPossibleRegion().GetSize()[1]/2.) diff --git a/app/otbSARCorrelationRough.cxx b/app/otbSARCorrelationRough.cxx index 39f9e00c0a841fa6909933b3e3e51917261dbafb..15e767fd643727b50765bd54156cd1900ded66dd 100644 --- a/app/otbSARCorrelationRough.cxx +++ b/app/otbSARCorrelationRough.cxx @@ -57,10 +57,11 @@ private: "The inputs of this application are MultiLooked images (real images)."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products and Cosmo are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "inmaster", "Input Master image (real image)"); diff --git a/app/otbSARDEMGrid.cxx b/app/otbSARDEMGrid.cxx index 8c120125760b2cc81fad96ef290c348760e489cf..dedc931d505b975f9334fd2edde657ced9c98238 100644 --- a/app/otbSARDEMGrid.cxx +++ b/app/otbSARDEMGrid.cxx @@ -61,10 +61,11 @@ private: " the projected DEM as inputs."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "insarmaster", "Input SAR Master image"); diff --git a/app/otbSARDEMProjection.cxx b/app/otbSARDEMProjection.cxx index a339dbae31e9cf303b565544f9a94a85d5ae5ab5..d0e187eed0c8268b30e777cc8b983a26faddb529 100644 --- a/app/otbSARDEMProjection.cxx +++ b/app/otbSARDEMProjection.cxx @@ -62,10 +62,11 @@ private: "image), L (line into SAR image), Z and Y."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "indem", "Input DEM"); diff --git a/app/otbSARDEMToAmplitude.cxx b/app/otbSARDEMToAmplitude.cxx index 7d7bec2c7eb0db14ebd8c79eedd97aa3a82bb606..164cfa80c3120deb77122d0fe3971e030c9e5208 100644 --- a/app/otbSARDEMToAmplitude.cxx +++ b/app/otbSARDEMToAmplitude.cxx @@ -59,10 +59,11 @@ private: " and SARMultiLook."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "indem", "Input DEM"); diff --git a/app/otbSARDeramp.cxx b/app/otbSARDeramp.cxx index acec7452fd60c5e2adbfa096e13c61c5e34e4c88..b3e897876528713155b844197c3a7be844b33e72 100644 --- a/app/otbSARDeramp.cxx +++ b/app/otbSARDeramp.cxx @@ -57,10 +57,11 @@ namespace otb SetDocLongDescription("This application does the deramping or reramping of S1 Iw burst."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "in", "Input burst"); diff --git a/app/otbSARDoppler0.cxx b/app/otbSARDoppler0.cxx index f2f12a8c470c94ca12ff1f9d11c7328cbd74b85c..241c34ce6223a1d0bb0f4a53e0afbc72c9b50e04 100644 --- a/app/otbSARDoppler0.cxx +++ b/app/otbSARDoppler0.cxx @@ -59,10 +59,11 @@ private: "into [Estimating the Doppler centroid of SAR data]."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "insar", "Input image"); diff --git a/app/otbSARESD.cxx b/app/otbSARESD.cxx index 46cbba227cf32bbfde5d4d943556d6455ce3e07f..2e116028d9f47ab76af7ef16841e44985846e3cb 100644 --- a/app/otbSARESD.cxx +++ b/app/otbSARESD.cxx @@ -72,10 +72,11 @@ private: " dimension."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "ininterfup", "First interferogram (Vector Image)"); diff --git a/app/otbSARFineDeformationGrid.cxx b/app/otbSARFineDeformationGrid.cxx index 2dc7d8e619e90c9b35a095222d7b53b182ebea23..cbbe0cb697f4ddd47a8cc1692a0bd287c96c4416 100644 --- a/app/otbSARFineDeformationGrid.cxx +++ b/app/otbSARFineDeformationGrid.cxx @@ -60,10 +60,11 @@ private: " master and slave SAR images."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "indem", "Input DEM"); diff --git a/app/otbSARFineMetadata.cxx b/app/otbSARFineMetadata.cxx index 308af0d93a8b3e4399eaec32bed543f2ee724f74..33bd753646bec78a2c11727283995d0800e2d5cd 100644 --- a/app/otbSARFineMetadata.cxx +++ b/app/otbSARFineMetadata.cxx @@ -78,10 +78,11 @@ private: "of the first line and the slant near range."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "ingrid", "Input correlation grid"); diff --git a/app/otbSARGridOffset.cxx b/app/otbSARGridOffset.cxx index bace7d8618658ced429317f91391157f62c2e6d3..b5a8925374573adc34df6ae7766bcdf85e9b2ef2 100644 --- a/app/otbSARGridOffset.cxx +++ b/app/otbSARGridOffset.cxx @@ -66,10 +66,11 @@ private: " dimension."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "ingrid", "Input grid (Vector Image)"); diff --git a/app/otbSARGridStatistics.cxx b/app/otbSARGridStatistics.cxx index 58f0e2379a279ade1a34bb9976a87118aa311baa..0be4177b24b0c6272be4ffdc5416dfcb4319a1f3 100644 --- a/app/otbSARGridStatistics.cxx +++ b/app/otbSARGridStatistics.cxx @@ -56,10 +56,11 @@ private: " dimension."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "ingrid", "Input grid (Vector Image)"); diff --git a/app/otbSARInterferogram.cxx b/app/otbSARInterferogram.cxx index 4a4d4d45cc159904ee1075e644946e8a2ffc29ec..fde1007786f5e5a1f9d605d686367e815c5bcb46 100644 --- a/app/otbSARInterferogram.cxx +++ b/app/otbSARInterferogram.cxx @@ -58,10 +58,11 @@ namespace otb " SAR images."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "insarslave", "Input SAR Slave image (Coregistrated image)"); @@ -70,10 +71,6 @@ namespace otb AddParameter(ParameterType_InputImage, "insarmaster", "Input SAR Master image"); SetParameterDescription("insarmaster", "Input SAR Master image."); - AddParameter(ParameterType_InputImage, "indem", "Input DEM (for metadata only)"); - SetParameterDescription("indem", "Input DEM (for metadata only)."); - MandatoryOff("indem"); - AddParameter(ParameterType_InputImage, "topographicphase", "Input Topographic Phase (estimation with DEM projection)"); SetParameterDescription("topographicphase", "Input Topographic Phase (estimation with DEM projection)."); MandatoryOff("topographicphase"); @@ -108,22 +105,13 @@ namespace otb SetMinimumParameterFloatValue("gain", 0); MandatoryOff("gain"); - AddParameter(ParameterType_Bool, "ortho", "Build interferogram into ortho geometry"); - SetParameterDescription("ortho", "If true, then build interferogram into ortho geometry."); - AddParameter(ParameterType_OutputImage, "out", "Interferogram"); SetParameterDescription("out","Output Vector Image : Interferogram."); - AddParameter(ParameterType_OutputImage, "outopt", "Interferogram into ortho geometry"); - SetParameterDescription("outopt","Output Vector Image : Interferogram into ortho geometry."); - MandatoryOff("outopt"); - - AddRAMParameter(); SetDocExampleParameterValue("insarslave","s1b-s4-slc-vv-20160929t014610-20160929t014634-002277-003d71-002.tiff"); SetDocExampleParameterValue("insarmaster","s1a-s4-slc-vv-20160818t014650-20160818t014715-012648-013db1-002_SLC.tiff"); - SetDocExampleParameterValue("indem","S21E055.hgt"); SetDocExampleParameterValue("mlran","3"); SetDocExampleParameterValue("mlazi","3"); SetDocExampleParameterValue("gain","0.1"); @@ -151,16 +139,6 @@ namespace otb otbAppLogINFO(<<"Averaging Margin on range : "<<margin_Ran); otbAppLogINFO(<<"Gain Factor : "<<factor_gain); - // Check if ortho is enabled - if (IsParameterEnabled("ortho")) - { - if (!GetParameterByKey("indem")->HasValue()) - { - otbAppLogFATAL(<<"ortho activate. indem must be assigned"); - } - } - - ///////////////////////////////////// Interferogram Filter /////////////////////////////////////////////// // Instanciate the Interferogram filter InterferogramFilterType::Pointer filterInterferogram = InterferogramFilterType::New(); @@ -170,12 +148,6 @@ namespace otb filterInterferogram->SetMarginRan(margin_Ran); filterInterferogram->SetMarginAzi(margin_Azi); filterInterferogram->SetGain(factor_gain); - filterInterferogram->SetUseDEMGeoAsOutput(false); - - if (GetParameterByKey("indem")->HasValue()) - { - filterInterferogram->SetDEMPtr(GetParameterFloatImage("indem")); - } // Execute the main Pipeline ComplexFloatImageType::Pointer SARMasterPtr; @@ -192,20 +164,11 @@ namespace otb if (GetParameterByKey("topographicphase")->HasValue()) { filterInterferogram->SetTopographicPhaseInput(GetParameterImage("topographicphase")); - - if (IsParameterEnabled("ortho")) - { - filterInterferogram->SetUseDEMGeoAsOutput(true); - } } // Main Output SetParameterOutputImage("out", filterInterferogram->GetOutput()); - if (IsParameterEnabled("ortho")) - { - SetParameterOutputImage("outopt", filterInterferogram->GetOutputIntoDEMGeo()); - } } // Vector for filters std::vector<itk::ProcessObject::Pointer> m_Ref; diff --git a/app/otbSARMultiLook.cxx b/app/otbSARMultiLook.cxx index 0af46916f9ebd780053caebeb11136581eb1d5b9..bdd0a7840a72d89fe554375dd9c95819ae1ed3b9 100644 --- a/app/otbSARMultiLook.cxx +++ b/app/otbSARMultiLook.cxx @@ -64,10 +64,11 @@ private: "a SLC product."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "incomplex", "Input Complex image"); diff --git a/app/otbSARRobustInterferogram.cxx b/app/otbSARRobustInterferogram.cxx index 01f93c8baf734a74438b594a45c6e636875d50cf..18ed722796ca9d824bea3b15a35286afa4cd1609 100644 --- a/app/otbSARRobustInterferogram.cxx +++ b/app/otbSARRobustInterferogram.cxx @@ -60,10 +60,11 @@ namespace otb "Coregistrated Slave)."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "incoregistratedslave", "Input SAR Slave image (Coregistrated image)"); @@ -75,10 +76,6 @@ namespace otb AddParameter(ParameterType_InputImage, "insarmaster", "Input SAR Master image"); SetParameterDescription("insarmaster", "Input SAR Master image."); - AddParameter(ParameterType_InputImage, "indem", "Input DEM (for metadata only)"); - SetParameterDescription("indem", "Input DEM (for metadata only)."); - MandatoryOff("indem"); - AddParameter(ParameterType_InputImage, "ingrid", "Input deformation grid"); SetParameterDescription("ingrid", "Input deformation grid."); @@ -122,23 +119,15 @@ namespace otb SetDefaultParameterFloat("gain", 0.1); SetMinimumParameterFloatValue("gain", 0); MandatoryOff("gain"); - - AddParameter(ParameterType_Bool, "ortho", "Build interferogram into ortho geometry"); - SetParameterDescription("ortho", "If true, then build interferogram into ortho geometry."); AddParameter(ParameterType_OutputImage, "out", "Output interferogram (ML geometry)"); SetParameterDescription("out","Output interferogram (ML geometry)."); - AddParameter(ParameterType_OutputImage, "outopt", "Interferogram into ortho geometry"); - SetParameterDescription("outopt","Output Vector Image : Interferogram into ortho geometry."); - MandatoryOff("outopt"); - AddRAMParameter(); SetDocExampleParameterValue("insarslave","s1b-s4-slc-vv-20160929t014610-20160929t014634-002277-003d71-002.tiff"); SetDocExampleParameterValue("incoregistratedslave","s1b-s4-slc-vv-20160929t014610-20160929t014634-002277-003d71-002_coregistrated.tiff"); SetDocExampleParameterValue("insarmaster","s1a-s4-slc-vv-20160818t014650-20160818t014715-012648-013db1-002_SLC.tiff"); - SetDocExampleParameterValue("indem","S21E055.hgt"); SetDocExampleParameterValue("incartmeanmaster","CartesianMaster.tiff"); SetDocExampleParameterValue("ingrid","./FineDeformation.tiff"); SetDocExampleParameterValue("gain","0.1"); @@ -168,21 +157,6 @@ namespace otb otbAppLogINFO(<<"Averaging Margin on azimut :"<<margin_Azi); otbAppLogINFO(<<"Averaging Margin on range : "<<margin_Ran); otbAppLogINFO(<<"Gain : "<<gain); - - // Check if ortho is enabled - if (IsParameterEnabled("ortho")) - { - if (!GetParameterByKey("outopt")->HasValue()) - { - otbAppLogFATAL(<<"ortho activate. outopt must be assigned"); - } - - if (!GetParameterByKey("indem")->HasValue()) - { - otbAppLogFATAL(<<"ortho activate. indem must be assigned"); - } - } - // Retrive inputs FloatVectorImageType::Pointer GridPtr = GetParameterFloatVectorImage("ingrid"); @@ -202,11 +176,6 @@ namespace otb GetInternalApplication("TopographicPhaseApp")->SetParameterInt("gridstepazimut", gridStepAzi); GetInternalApplication("TopographicPhaseApp")->SetParameterInt("mlran", mlRan); GetInternalApplication("TopographicPhaseApp")->SetParameterInt("mlazi", mlAzi); - - if (IsParameterEnabled("ortho")) - { - GetInternalApplication("TopographicPhaseApp")->EnableParameter("cartcopy"); - } ExecuteInternal("TopographicPhaseApp"); @@ -218,34 +187,18 @@ namespace otb GetInternalApplication("InterferogramApp")->SetParameterInputImage("topographicphase", GetInternalApplication("TopographicPhaseApp")->GetParameterOutputImage("out")); - if (GetParameterByKey("indem")->HasValue()) - { - FloatImageType::Pointer inputDEM = GetParameterFloatImage("indem"); - GetInternalApplication("InterferogramApp")->SetParameterInputImage("indem", - inputDEM); - } GetInternalApplication("InterferogramApp")->SetParameterInt("mlran", mlRan); GetInternalApplication("InterferogramApp")->SetParameterInt("mlazi", mlAzi); GetInternalApplication("InterferogramApp")->SetParameterInt("marginran", margin_Ran); GetInternalApplication("InterferogramApp")->SetParameterInt("marginazi", margin_Azi); GetInternalApplication("InterferogramApp")->SetParameterFloat("gain", gain); - if (IsParameterEnabled("ortho")) - { - GetInternalApplication("InterferogramApp")->EnableParameter("ortho"); - } ExecuteInternal("InterferogramApp"); // Main output SetParameterOutputImage("out", GetInternalApplication("InterferogramApp")->GetParameterOutputImage("out")); - // Optionnal output - if (IsParameterEnabled("ortho")) - { - SetParameterOutputImage("outopt", GetInternalApplication("InterferogramApp")->GetParameterOutputImage("outopt")); - } - } // Vector for filters std::vector<itk::ProcessObject::Pointer> m_Ref; diff --git a/app/otbSARTopographicPhase.cxx b/app/otbSARTopographicPhase.cxx index ed97902aeee3a83be6eee665f23f353b1717d2e2..bca9ad6c779acfd0d3c149576bdf0f6cd353c5b1 100644 --- a/app/otbSARTopographicPhase.cxx +++ b/app/otbSARTopographicPhase.cxx @@ -60,10 +60,11 @@ namespace otb " between two SAR images in order to improve the interferogram."); //Optional descriptors - SetDocLimitations("Only Sentinel 1 products are supported for now."); + SetDocLimitations("Only Sentinel 1 (IW and StripMap mode) and Cosmo products are supported for now."); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); AddDocTag(Tags::SAR); + AddDocTag("DiapOTB"); //Parameter declarations AddParameter(ParameterType_InputImage, "ingrid", "Input deformation grid"); diff --git a/doc_cookbook/generate_cookbook.txt b/doc_cookbook/generate_cookbook.txt index cca2292eed79cb2a42f9728440d797ef318674b9..1dc18ae5d3249689d5fc14f1dd325628c0ac914f 100644 --- a/doc_cookbook/generate_cookbook.txt +++ b/doc_cookbook/generate_cookbook.txt @@ -8,6 +8,6 @@ NB: _ sphinx-build must be installed as a python module with an specific theme (sphinx_rtd_theme). - Conda environment could be used to configure a python with the required sphinx. + Conda environment could be used to configure a python with the required sphinx. Activate conda env (or virtual env) for 4. Use the same python than DiapOTB and OTB for previous steps. _ Markdown can be generated with sphinx-build command thanks to sphinx-markdown-builder module as following : sphinx-build -M markdown ./rst/ build_md/ -c . diff --git a/doc_cookbook/otbGenerateWrappersRstDoc.py b/doc_cookbook/otbGenerateWrappersRstDoc.py index ca45fdac402d78f2b5386431bbef238432fa524f..d2fb98c3dbb10b0b8acc8e91cbb4464d65a1ce30 100755 --- a/doc_cookbook/otbGenerateWrappersRstDoc.py +++ b/doc_cookbook/otbGenerateWrappersRstDoc.py @@ -397,57 +397,44 @@ def GetApplicationTags(appname): def GenerateRstForApplications(rst_dir): "Generate .rst files for all applications" - - diapOTBList = ["SARAmplitudeEstimation", "SARESD", "SARCartesianMeanEstimation", "SARCoRegistration", "SARCorrectionGrid", "SARCorrelationGrid", "SARCorrelationRough", "SARDEMGrid", "SARDEMProjection", "SARDEMToAmplitude", "SARDeramp", "SARDoppler0", "SARFineDeformationGrid", "SARFineMetadata", "SARGridOffset", "SARGridStatistics", "SARInterferogram", "SARMultiLook", "SARRobustInterferogram", "SARTopographicPhase"] + allApps = otbApplication.Registry.GetAvailableApplications() if not allApps: raise RuntimeError("No OTB applications available. Please check OTB_APPLICATION_PATH env variable.") writtenTags = [] - appNames = [app for app in allApps if app in diapOTBList] - + appIndexFile = open(rst_dir + '/Applications.rst', 'w') appIndexFile.write(RstPageHeading("All Applications", "2", ref="apprefdoc")) - print("Generating rst for {} applications".format(len(appNames))) - - for appName in appNames: + # Find DiapOTB applciations (with DiapOTB tag) + diapOTBList = []; + + for appName in allApps: + # Get application tags + tags = list(GetApplicationTags(appName)) + if "Deprecated" in tags: + tags.remove("Deprecated") + if not tags or len(tags) == 0: + raise RuntimeError("No tags for application: " + appName) + # Select applications only if DiapOTB is into their tags + if "DiapOTB" in tags : + diapOTBList.append(appName) + + # Loop on diapOTB Applications + for appName in diapOTBList: # Add it to the index (i.e. Applications.html) appIndexFile.write('\tApplications/' + "app_" + appName + '.rst\n') - - # # Get application first tag - # tags = list(GetApplicationTags(appName)) - # if "Deprecated" in tags: - # tags.remove("Deprecated") - # if not tags or len(tags) == 0: - # raise RuntimeError("No tags for application: " + appName) - - # print(tags) - # quit() - - # tag = tags[0] - # tag_ = tag.replace(" ", "_") - - # # Add it to the index (i.e. https://www.orfeo-toolbox.org/CookBook/Applications.html) - # if not tag in writtenTags: - # appIndexFile.write('\tApplications/' + tag_ + '.rst\n') - # writtenTags.append(tag) - - # # Create or update tag index file (e.g. https://www.orfeo-toolbox.org/CookBook/Applications/Feature_Extraction.html) - # tagFileName = rst_dir + '/Applications/' + tag_ + '.rst' - # if os.path.isfile(tagFileName): - # with open(tagFileName, 'a') as tagFile: - # tagFile.write("\tapp_" + appName + "\n") - # else: - # with open(tagFileName, 'w') as tagFile: - # tagFile.write( RstPageHeading(tag, "1") ) - # tagFile.write("\tapp_" + appName + "\n") + + print("Create rst for : " + appName) # Write application rst with open(rst_dir + '/Applications/app_' + appName + '.rst', 'w',encoding='utf-8') as appFile: - appFile.write(render_application(appName, appNames)) + appFile.write(render_application(appName, diapOTBList)) + + if __name__ == "__main__": parser = argparse.ArgumentParser(usage="Export application(s) to rst file") diff --git a/include/otbSARCartesianMeanWithMeanPerLineFunctor.h b/include/otbSARCartesianMeanWithMeanPerLineFunctor.h deleted file mode 100644 index a144bd7998741e8b7e387b805296c7dfa4ab591f..0000000000000000000000000000000000000000 --- a/include/otbSARCartesianMeanWithMeanPerLineFunctor.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2005-2018 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef otbSARCartesianMeanWithMeanPerLineFunctor_h -#define otbSARCartesianMeanWithMeanPerLineFunctor_h -#include <cassert> - -#include "itkVariableLengthVector.h" -#include "itkRGBPixel.h" -#include "itkRGBAPixel.h" -#include "itkObject.h" -#include "itkObjectFactory.h" - -#include "otbSARPolygonsFunctor.h" -#include "otbSARCartesianMeanFunctor.h" - -namespace otb -{ -namespace Function -{ -/** \class SARCartesianMeanWithMeanPerLineFunctor -* \brief Catesian mean estimation for each output pixel and output line. -* -* This functor spreads SARCartesianMeanFunctor. It estimates the Cartesian coordonates mean image and -* an optionnal image (Cartesian coordonates mean for each output line). -* -* The characteristics are the following : -* _ Output Geometry : ML (defined by ML factors) -* _ Seven required components : L, C, Y, Z, XCart, YCart and ZCart -* _ Three estimated component : Mean of XCart, YCart and ZCart -* _ Optionnal image : Yes (dimension 1 x nbLineOfMainOutput) -* -* \ingroup DiapOTBModule -*/ - template <class TInputPixel, class TOutputPixel> - class SARCartesianMeanWithMeanPerLineFunctor : public SARCartesianMeanFunctor<TInputPixel, TOutputPixel> -{ -public: - /** Standard class typedefs */ - typedef SARCartesianMeanWithMeanPerLineFunctor Self; - typedef SARCartesianMeanFunctor<TInputPixel, TOutputPixel> Superclass; - typedef itk::SmartPointer<Self> Pointer; - typedef itk::SmartPointer<const Self> ConstPointer; - - /** Runtime information */ - itkTypeMacro(SARCartesianMeanWithMeanPerLineFunctor, itk::Object); - - /** - * Method synthetize (override) - */ - // Synthetize to apply on XCart, YCart and Zcart the counter of polygons - void synthetize(int nbElt, TOutputPixel * outValue, int threadId=1) override - { - // ReInitialize m_OutMeanByLine and m_CountPolygonsPerLine - m_OutMeanByLine[threadId][0] = 0; - m_OutMeanByLine[threadId][1] = 0; - m_OutMeanByLine[threadId][2] = 0; - m_CountPolygonsPerLine[threadId] = 0; - - //////// Mean by line //////// - for(int ind = 0; ind < nbElt; ind++) - { - m_OutMeanByLine[threadId][0] += outValue[ind][0]; - m_OutMeanByLine[threadId][1] += outValue[ind][1]; - m_OutMeanByLine[threadId][2] += outValue[ind][2]; - - m_CountPolygonsPerLine[threadId] += this->m_CountPolygons[threadId][ind]; - } - - if (m_CountPolygonsPerLine[threadId] != 0) - { - m_OutMeanByLine[threadId][0] /= m_CountPolygonsPerLine[threadId]; - m_OutMeanByLine[threadId][1] /= m_CountPolygonsPerLine[threadId]; - m_OutMeanByLine[threadId][2] /= m_CountPolygonsPerLine[threadId]; - } - - //////// Mean by pixel //////// - for(int ind = 0; ind < nbElt; ind++) - { - if (this->m_CountPolygons[threadId][ind] !=0) - { - outValue[ind][0] /= this->m_CountPolygons[threadId][ind]; - outValue[ind][1] /= this->m_CountPolygons[threadId][ind]; - outValue[ind][2] /= this->m_CountPolygons[threadId][ind]; - } - } - } - - - /** - * Method estimateOptionnalImage (override) - */ - void estimateOptionnalImage(TOutputPixel * outValue, int threadId=1) override - { - // Allocation of Components - outValue[0].Reserve(4); - - // Assignate (only one element per line for this functor) - outValue[0][0] = m_OutMeanByLine[threadId][0]; - outValue[0][1] = m_OutMeanByLine[threadId][1]; - outValue[0][2] = m_OutMeanByLine[threadId][2]; - - // IsData always to 1 - outValue[0][3] = 1; - } - - - /** Constructor */ // - SARCartesianMeanWithMeanPerLineFunctor(int nbThreads, unsigned int mlran = 1, unsigned int mlazi = 1) : Superclass(nbThreads, mlran, mlazi) - { - // Specific argument - m_CountPolygonsPerLine = new int[this->m_NbThreads]; - - // Allocate the buffer of polygons for each thread - for (int i = 0; i < this->m_NbThreads; i++) - { - m_CountPolygonsPerLine[i] = 0; - } - - // Set optionnal output (MeanPerline Image) to true - this->SetWithOptionnalOutput(true); - - // Allocate the MeanPerline Buffer - m_OutMeanByLine = new TOutputPixel[this->m_NbThreads]; - - for (int i = 0; i < this->m_NbThreads; i++) - { - m_OutMeanByLine[i].Reserve(4); - m_OutMeanByLine[i][0] = 0; - m_OutMeanByLine[i][1] = 0; - m_OutMeanByLine[i][2] = 0; - m_OutMeanByLine[i][3] = 0; - } - } - - - // Redefinition to use construction with NumberOfThreads (Functor used in Multi-Threading) - static Pointer New(int nbThreads, unsigned int mlran = 1, unsigned int mlazi = 1) - { - Pointer smartPtr = ::itk::ObjectFactory< Self >::Create(); - if ( smartPtr == nullptr ) - { - smartPtr = new Self(nbThreads, mlran, mlazi); - } - smartPtr->UnRegister(); - return smartPtr; - } - - /** Destructor */ - ~SARCartesianMeanWithMeanPerLineFunctor() override - { - // free Memory - delete m_CountPolygonsPerLine; - - for (int i = 0; i < this->m_NbThreads; i++) - { - m_OutMeanByLine[i].DestroyExistingData(); // TOutputPixel a itk::VariableLengthVector - } - } - - -private : - int * m_CountPolygonsPerLine; - TOutputPixel * m_OutMeanByLine; - int m_CountLine; - }; - -} -} - -#endif diff --git a/include/otbSARDEMPolygonsAnalysisImageFilter.h b/include/otbSARDEMPolygonsAnalysisImageFilter.h index 481cb96cce324b0df4e4a822c8f25d671772012e..a784fb8abeaffe18baec6c41a68c4aa492b9f6ce 100644 --- a/include/otbSARDEMPolygonsAnalysisImageFilter.h +++ b/include/otbSARDEMPolygonsAnalysisImageFilter.h @@ -159,16 +159,6 @@ public: // Initialize margin and GenericRSTransform void initializeMarginAndRSTransform(); - - /** Returns the const image */ - const TImageOut * GetOutput() const; - /** Returns the image */ - TImageOut * GetOutput(); - /** Returns the const optionnal output image */ - //const ImageOptionnalType * GetImageOptionnalTypeOutput() const; - /** Returns the optionnal output image */ - ImageOptionnalType * GetOptionnalOutput(); - protected: // Constructor @@ -201,20 +191,7 @@ protected: * OutputRegionToInputRegion returns the input region. This input region corresponds to the outputRegion. */ ImageInRegionType OutputRegionToInputRegion(const ImageOutRegionType& outputRegion) const; - - /** - * SARDEMPolygonsAnalysisImageFilter can produce an optionnal image according to the functor. The requested - * region for this optionnal output is set to the largest possible region. - */ - void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; - - /** - * SARDEMPolygonsAnalysisImageFilter can produce an optionnal image according to the functor. An allocation of - * this optionnal output is made into BeforeThreadedGenerateData. - */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; - - + /** * SARDEMPolygonsAnalysisImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine @@ -295,10 +272,7 @@ protected: // Store optionnalImage ImageOutPixelType * m_OptionnalResults; - int m_OutputCounter; - // Mutex for optionnalImage - MutexType * m_Mutex; // RSTransform (for inverse localisation) RSTransformType2D::Pointer m_RSTransform; diff --git a/include/otbSARDEMPolygonsAnalysisImageFilter.txx b/include/otbSARDEMPolygonsAnalysisImageFilter.txx index 34229bed64a14ead442d4401d8db7476cecbcf27..38eeccba4d6d7d793ccdc2cdcecf7ea672a4377e 100644 --- a/include/otbSARDEMPolygonsAnalysisImageFilter.txx +++ b/include/otbSARDEMPolygonsAnalysisImageFilter.txx @@ -43,54 +43,8 @@ namespace otb SARDEMPolygonsAnalysisImageFilter< TImageIn ,TImageOut, TImageDEM, TImageSAR, TFunction >::SARDEMPolygonsAnalysisImageFilter() : m_SarSensorModelAdapter(ITK_NULLPTR), m_Gain(100.), m_Margin(0), m_NoData(-32768), m_MLRan(1), m_MLAzi(1) { - // Outputs required and/or needed (one required and one optionnal) - this->SetNumberOfRequiredOutputs(1); - this->SetNumberOfIndexedOutputs(2); - - this->SetNthOutput(0, ImageOutType::New()); - this->SetNthOutput(1, ImageOptionnalType::New()); - - m_OutputCounter = 0; - - m_Mutex = new MutexType(); - } - - template <class TImageIn, class TImageOut, class TImageDEM, class TImageSAR, class TFunction> - TImageOut * - SARDEMPolygonsAnalysisImageFilter< TImageIn ,TImageOut, TImageDEM, TImageSAR, TFunction > - ::GetOutput() -{ - if (this->GetNumberOfOutputs() < 1) - { - return ITK_NULLPTR; - } - return static_cast<ImageOutType *>(this->itk::ProcessObject::GetOutput(0)); -} - - template <class TImageIn, class TImageOut, class TImageDEM, class TImageSAR, class TFunction> - const TImageOut * - SARDEMPolygonsAnalysisImageFilter< TImageIn ,TImageOut, TImageDEM, TImageSAR, TFunction > - ::GetOutput() const -{ - if (this->GetNumberOfOutputs() < 1) - { - return 0; - } - return static_cast<ImageOutType *>(this->itk::ProcessObject::GetOutput(0)); } - - template <class TImageIn, class TImageOut, class TImageDEM, class TImageSAR, class TFunction> - typename SARDEMPolygonsAnalysisImageFilter< TImageIn ,TImageOut, TImageDEM, TImageSAR, TFunction >::ImageOptionnalType * - SARDEMPolygonsAnalysisImageFilter< TImageIn ,TImageOut, TImageDEM, TImageSAR, TFunction > - ::GetOptionnalOutput() -{ - if (this->GetNumberOfOutputs() < 2) - { - return ITK_NULLPTR; - } - return static_cast<ImageOptionnalType *>(this->itk::ProcessObject::GetOutput(1)); -} - + /** * Set Sar Image keyWordList */ @@ -369,70 +323,6 @@ namespace otb outputKwl.AddKey(key, std::to_string(i)); } outputPtr->SetImageKeywordList(outputKwl); - - - ////////// Check if the optionnal output is required ////////// - if (m_FunctionOnPolygon->GetWithOptionnalOutput()) - { - // This output is just a vector with 1xNbLine_MainOutput pixels. - // Pixels are the same nature than Main Output - ImageOptionnalPointer outputOptionnalPtr = this->GetOptionnalOutput(); - if (numberOfEstimatedComponents > 1) - { - // Set the number of Components - outputOptionnalPtr->SetNumberOfComponentsPerPixel(numberOfEstimatedComponents); - } - - ImageOptionnalRegionType region = outputPtr->GetLargestPossibleRegion(); - ImageOptionnalSizeType sizeRegion; - - - sizeRegion[0] = 1; - sizeRegion[1] = outputPtr->GetLargestPossibleRegion().GetSize()[1]; - - region.SetSize(sizeRegion); - outputOptionnalPtr->SetLargestPossibleRegion(region); - outputOptionnalPtr->SetOrigin(outputPtr->GetOrigin()); - outputOptionnalPtr->SetSpacing(outputPtr->GetSpacing()); - - // Complete Optionnal Output KeyWordList - ImageKeywordlist outputOptionnalKwl; - for (unsigned int i = 0; i < vecEstimatedComponents.size(); i++) - { - std::string key = BandKey + vecEstimatedComponents.at(i); - outputOptionnalKwl.AddKey(key, std::to_string(i)); - } - outputOptionnalPtr->SetImageKeywordList(outputOptionnalKwl); - - if (m_OutputCounter == 0) - { - // Allocate optionnal Results (Vector) - int nbLineOptionnal = this->GetOptionnalOutput()->GetLargestPossibleRegion().GetSize()[1]; - m_OptionnalResults = new ImageOutPixelType[nbLineOptionnal]; - } - } - - // Increment Output Counter - ++m_OutputCounter; - } - -/** - * Method EnlargeOutputRequestedRegion - */ - template<class TImageIn, class TImageOut, class TImageDEM, class TImageSAR, class TFunction> - void - SARDEMPolygonsAnalysisImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR, TFunction > - ::EnlargeOutputRequestedRegion( itk::DataObject *itkNotUsed(output) ) - { - // This filter requires all of the optionnal output image (Nth Output = 1). The output is - // vector with 1xNbLines_Main_Output as size - if (m_FunctionOnPolygon->GetWithOptionnalOutput()) - { - if ( this->itk::ProcessObject::GetOutput(1) ) - { - this->itk::ProcessObject::GetOutput(1)->SetRequestedRegionToLargestPossibleRegion(); - } - } } /** @@ -603,26 +493,6 @@ namespace otb ///////////// Set Output Requestion Region (Strips) /////////////// ImageOutRegionType outputRequestedRegion = this->GetOutput()->GetRequestedRegion(); - // if (m_FunctionOnPolygon->GetWithOptionnalOutput()) - // { - // if (outputRequestedRegion.GetIndex()[0] != 0 && - // outputRequestedRegion.GetSize()[0] != this->GetOutput()->GetLargestPossibleRegion().GetSize()[0]) - // { - // ImageOutIndexType outputIndex; - // outputIndex[0] = 0; - // outputIndex[1] = outputRequestedRegion.GetIndex()[1]; - - // ImageOutSizeType outputSize; - // outputSize[0] = this->GetOutput()->GetLargestPossibleRegion().GetSize()[0]; - // outputSize[1] = outputRequestedRegion.GetSize()[1]; - - // // Region affectation (with Crop to respect image dimension) - // outputRequestedRegion.SetSize(outputSize); - // outputRequestedRegion.SetIndex(outputIndex); - // //outputRequestedRegion.Crop(this->GetOutput()->GetLargestPossibleRegion()); - // this->GetOutput()->SetRequestedRegion(outputRequestedRegion); - // } - // } ///////////// With the new output requested region, find the region into Projeted DEM ///////////// ImageInRegionType inputRequestedRegion = OutputRegionToInputRegion(outputRequestedRegion); ImageInPointer inputPtr = const_cast< ImageInType * >( this->GetInput() ); @@ -964,25 +834,6 @@ namespace otb } } - /** - * Method ThreadedGenerateData - */ - template<class TImageIn, class TImageOut, class TImageDEM, class TImageSAR, class TFunction> - void - SARDEMPolygonsAnalysisImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR, TFunction > - ::BeforeThreadedGenerateData() - { - // Allocation for the optionnal image (if needed) - if (m_FunctionOnPolygon->GetWithOptionnalOutput()) - { - // Allocate optionnal output - ImageOptionnalPointer outputOptionnalPtr = this->GetOptionnalOutput(); - outputOptionnalPtr->SetBufferedRegion(outputOptionnalPtr->GetRequestedRegion() ); - outputOptionnalPtr->Allocate(); - } - } - - /** * Method ThreadedGenerateData */ @@ -1216,30 +1067,6 @@ namespace otb // Next Line OutIt.NextLine(); - - /// Optionnal Output //// - if (m_FunctionOnPolygon->GetWithOptionnalOutput()) - { - // Assignate the optionnal image - ImageOutIndexType indexOptionnalImage; - indexOptionnalImage[0] = 0; // Always 0 since optionnal image is a vector - indexOptionnalImage[1] = ind_Line; - - // Estimate the value for the current ind_Line and store it into m_OptionnalResults - // If first output => Estimate ans store results if second => copy and write into optionnal image - // m_OptionnalResults is threadSafe because of mutex lock and unlock - m_Mutex->Lock(); - if (m_OutputCounter == 1) - { - m_FunctionOnPolygon->estimateOptionnalImage(&m_OptionnalResults[ind_Line], threadId); - } - else - { - this->GetOptionnalOutput()->SetPixel(indexOptionnalImage, m_OptionnalResults[ind_Line]); - } - m_Mutex->Unlock(); - } - } // End lines (Main output) delete [] Polygon_SideInUp_VecLine; diff --git a/include/otbSARDopplerCentroidFreqImageFilter.txx b/include/otbSARDopplerCentroidFreqImageFilter.txx index f2bab7485e2a0ce33df97df744decc2b4ba006d4..9a216cc816fa2f9a4063f6988958d52e4b6228d8 100644 --- a/include/otbSARDopplerCentroidFreqImageFilter.txx +++ b/include/otbSARDopplerCentroidFreqImageFilter.txx @@ -205,7 +205,7 @@ namespace otb this->getAllCoefs(inputKWL, DCFRecords); - DurationType diffAziTimeMin; + DurationType diffAziTimeMin(0); unsigned int polySelected = 0; // Select one polynomial (with m_MidAziTime) diff --git a/include/otbSARInterferogramImageFilter.h b/include/otbSARInterferogramImageFilter.h index a1b84cdebefc9e54ae9af8f18e4e81837f94ed48..befd8cce23da22b36119d8f29c0785dfa011d719 100644 --- a/include/otbSARInterferogramImageFilter.h +++ b/include/otbSARInterferogramImageFilter.h @@ -145,16 +145,13 @@ public: itkSetMacro(MarginRan, unsigned int); itkSetMacro(MarginAzi, unsigned int); itkSetMacro(Gain, float); - itkSetMacro(UseDEMGeoAsOutput, bool); - itkSetMacro(ApproxDiapason, bool); - void SetDEMPtr(ImageDEMPointer DEMPtr); + // Getter itkGetMacro(MLRan, unsigned int); itkGetMacro(MLAzi, unsigned int); itkGetMacro(MarginRan, unsigned int); itkGetMacro(MarginAzi, unsigned int); itkGetMacro(Gain, float); - itkGetMacro(UseDEMGeoAsOutput, bool); // Setter/Getter for inputs (SAR images and potentially topographic phase) /** Connect one of the operands for interferometry : Master */ @@ -171,13 +168,6 @@ public: const ImageSARType * GetSlaveInput() const; const ImagePhaseType * GetTopographicPhaseInput() const; - // Getter for outputs (Interferogram into ML geometry and potentially into DEM geometry) - /** Returns the const image */ - const TImageOut * GetOutput() const; - /** Returns the image */ - TImageOut * GetOutput(); - /** Returns the optionnal output image (into DEM/Ortho geometry) */ - ImageOutType * GetOutputIntoDEMGeo(); protected: // Constructor @@ -219,16 +209,16 @@ protected: * SARInterferogramImageFilter can produce an optionnal image if UseDEMGeoAsOutput = true. The requested * region for this optionnal output is set to the largest possible region. */ - void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; + //void EnlargeOutputRequestedRegion( itk::DataObject *output ) ITK_OVERRIDE; /** * SARInterferogramImageFilter can produce an optionnal image according to the functor. An allocation of * this optionnal output is made into BeforeThreadedGenerateData and free memory into * AfterThreadedGenerateData. */ - void BeforeThreadedGenerateData() ITK_OVERRIDE; + //void BeforeThreadedGenerateData() ITK_OVERRIDE; - void AfterThreadedGenerateData() ITK_OVERRIDE; + //void AfterThreadedGenerateData() ITK_OVERRIDE; /** * SARInterferogramImageFilterr can be implemented as a multithreaded filter. @@ -263,12 +253,6 @@ protected: // gain for amplitude estimation float m_Gain; - // DEM Pointer (metadata only) - ImageDEMPointer m_DEMPtr; - - // Use DEM Geometry as optionnal output - bool m_UseDEMGeoAsOutput; - // SAR Dimensions int m_nbLinesSAR; int m_nbColSAR; @@ -277,28 +261,10 @@ protected: unsigned int m_MarginRan; unsigned int m_MarginAzi; - // Counter to synchronize our outputs with calculation - int m_OutputCounter; - - // Mutex for optionnalImage (geo ortho) - MutexType * m_Mutex; - - // Arrays to store ortho accumlations and counters - double * m_OrthoRealAcc; - double * m_OrthoImagAcc; - double * m_OrthoModAcc; - double * m_OrthoCounter; - // One arrays by thread to guarantee Thread-Safety - float ** m_OrthoRealAccByThread; - float ** m_OrthoImagAccByThread; - float ** m_OrthoModAccByThread; - float ** m_OrthoCounterByThread; - // Dimensions of DEM int m_nbLinesDEM; int m_nbColDEM; - bool m_ApproxDiapason; }; } // End namespace otb diff --git a/include/otbSARInterferogramImageFilter.txx b/include/otbSARInterferogramImageFilter.txx index 9ae073463387eabf222e3ba9cf6174d708cbb05f..4159ac510db81d2a3505b15577cde16420406ada 100644 --- a/include/otbSARInterferogramImageFilter.txx +++ b/include/otbSARInterferogramImageFilter.txx @@ -35,9 +35,6 @@ #include <algorithm> #include <omp.h> -#ifndef M_1_PI -#define M_1_PI 0.31830988618379067154 -#endif namespace otb { @@ -46,23 +43,12 @@ namespace otb */ template <class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut >::SARInterferogramImageFilter() - : m_MLRan(1), m_MLAzi(1), m_Gain(1), m_UseDEMGeoAsOutput(false), m_nbLinesSAR(0), m_nbColSAR(0), - m_MarginRan(1), m_MarginAzi(1), m_nbLinesDEM(0), m_nbColDEM(0), m_ApproxDiapason(false) + : m_MLRan(1), m_MLAzi(1), m_Gain(1), m_nbLinesSAR(0), m_nbColSAR(0), + m_MarginRan(1), m_MarginAzi(1), m_nbLinesDEM(0), m_nbColDEM(0) { // Inputs required and/or needed this->SetNumberOfRequiredInputs(2); this->SetNumberOfIndexedInputs(3); - - // Outputs required and/or needed (one required and one optionnal) - this->SetNumberOfRequiredOutputs(1); - this->SetNumberOfIndexedOutputs(2); - - this->SetNthOutput(0, ImageOutType::New()); // ML Geo - this->SetNthOutput(1, ImageOutType::New()); // DEM Geo - - m_OutputCounter = 0; - - m_Mutex = new MutexType(); } /** @@ -87,17 +73,6 @@ namespace otb os << indent << "Gain for amplitude estimation : " << m_Gain << std::endl; } - /** - * SetDEMPtr - */ - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - void - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::SetDEMPtr(ImageDEMPointer demPtr) - { - m_DEMPtr = demPtr; - } - /** * Set Master Image */ @@ -192,47 +167,6 @@ namespace otb return static_cast<const ImagePhaseType *>(this->itk::ProcessObject::GetInput(2)); } - - /** - * Get Main Output : Interferogram into ML geometry - */ - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - TImageOut * - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::GetOutput() - { - if (this->GetNumberOfOutputs() < 1) - { - return ITK_NULLPTR; - } - return static_cast<ImageOutType *>(this->itk::ProcessObject::GetOutput(0)); - } - - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - const TImageOut * - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::GetOutput() const - { - if (this->GetNumberOfOutputs() < 1) - { - return 0; - } - return static_cast<ImageOutType *>(this->itk::ProcessObject::GetOutput(0)); - } - - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - typename SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut >::ImageOutType * - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::GetOutputIntoDEMGeo() - { - if (this->GetNumberOfOutputs() < 2) - { - return ITK_NULLPTR; - } - return static_cast<ImageOutType *>(this->itk::ProcessObject::GetOutput(1)); - } - - /** * Method GenerateOutputInformaton() **/ @@ -327,63 +261,6 @@ namespace otb // itkExceptionMacro(<<"Margin for averaging can't be superior to ML Factors."); // } } - - - //////////////////////////// Optionnal Output : Interferogram into DEM Geo /////////////////////////// - if (m_UseDEMGeoAsOutput) - { - // Get Pointer - ImageOutPointer outputOptionnalPtr = this->GetOutputIntoDEMGeo(); - - // Vector Image : - // At Least 4 Components : - // _ Amplitude - // _ Phase - // _ Coherence - // _ IsData - outputOptionnalPtr->SetNumberOfComponentsPerPixel(4); - - // This output is defined with the DEM geometry - outputOptionnalPtr->SetLargestPossibleRegion(m_DEMPtr->GetLargestPossibleRegion()); - outputOptionnalPtr->SetOrigin(m_DEMPtr->GetOrigin()); - outputOptionnalPtr->SetSignedSpacing(m_DEMPtr->GetSignedSpacing()); - - // Projection Ref - outputOptionnalPtr->SetProjectionRef(m_DEMPtr->GetProjectionRef()); - - // Interferogram Ortho requires Topographic phase in input - if (this->GetTopographicPhaseInput() == nullptr || - this->GetTopographicPhaseInput()->GetNumberOfComponentsPerPixel() < 3) - { - itkExceptionMacro(<<"Interferogram into ortho geometry requires Topographic phase in input with cartesian coordonates."); - } - - if (m_OutputCounter == 0) - { - if (m_DEMPtr == nullptr) - { - itkExceptionMacro(<<"To estimate interferogram into ortho geometry, a DEM must be in input."); - } - - // Get DEM's size - m_nbLinesDEM = m_DEMPtr->GetLargestPossibleRegion().GetSize()[1]; - m_nbColDEM = m_DEMPtr->GetLargestPossibleRegion().GetSize()[0]; - - // Allocation of arrays for accumulation and counter into ortho geo - m_OrthoRealAcc = new double[m_nbLinesDEM * m_nbColDEM]; - m_OrthoImagAcc = new double[m_nbLinesDEM * m_nbColDEM]; - m_OrthoModAcc = new double[m_nbLinesDEM * m_nbColDEM]; - m_OrthoCounter = new double[m_nbLinesDEM * m_nbColDEM]; - - // Initialize to zero - memset(m_OrthoRealAcc, 0, m_nbLinesDEM * m_nbColDEM * sizeof(double)); - memset(m_OrthoImagAcc, 0, m_nbLinesDEM * m_nbColDEM * sizeof(double)); - memset(m_OrthoModAcc, 0, m_nbLinesDEM * m_nbColDEM * sizeof(double)); - memset(m_OrthoCounter, 0, m_nbLinesDEM * m_nbColDEM * sizeof(double)); - } - } - - ++m_OutputCounter; } /** @@ -571,104 +448,25 @@ namespace otb // Get Output requested region ImageOutRegionType outputRequestedRegion = this->GetOutput()->GetRequestedRegion(); - if (m_OutputCounter == 1) - { ///////////// Find the region into SAR input images (same geometry for SAR after coregistration //////////// - ImageSARRegionType inputSARRequestedRegion = OutputRegionToInputRegion(outputRequestedRegion, true); + ///////////// Find the region into SAR input images (same geometry for SAR after coregistration //////////// + ImageSARRegionType inputSARRequestedRegion = OutputRegionToInputRegion(outputRequestedRegion, true); - ImageSARPointer masterPtr = const_cast< ImageSARType * >( this->GetMasterInput() ); - ImageSARPointer slavePtr = const_cast< ImageSARType * >( this->GetSlaveInput() ); + ImageSARPointer masterPtr = const_cast< ImageSARType * >( this->GetMasterInput() ); + ImageSARPointer slavePtr = const_cast< ImageSARType * >( this->GetSlaveInput() ); - masterPtr->SetRequestedRegion(inputSARRequestedRegion); - slavePtr->SetRequestedRegion(inputSARRequestedRegion); + masterPtr->SetRequestedRegion(inputSARRequestedRegion); + slavePtr->SetRequestedRegion(inputSARRequestedRegion); - ///////////// Find the region into topographic phase image (if needed) ///////////// - if (this->GetTopographicPhaseInput() != nullptr) - { - bool sameGeoAsMainOutput; - ImagePhaseRegionType phaseRequestedRegion = OutputRegionToInputPhaseRegion(outputRequestedRegion, - sameGeoAsMainOutput, true); - ImagePhasePointer phasePtr = const_cast< ImagePhaseType * >( this->GetTopographicPhaseInput() ); - phasePtr->SetRequestedRegion(phaseRequestedRegion); - } - } - else + ///////////// Find the region into topographic phase image (if needed) ///////////// + if (this->GetTopographicPhaseInput() != nullptr) { - // No region requested - ImageSARRegionType inputSARRequestedRegion; - ImageSARIndexType index; - index.Fill(0); - ImageSARSizeType size; - size.Fill(0); - inputSARRequestedRegion.SetIndex(index); - inputSARRequestedRegion.SetSize(size); - - ImageSARPointer masterPtr = const_cast< ImageSARType * >( this->GetMasterInput() ); - ImageSARPointer slavePtr = const_cast< ImageSARType * >( this->GetSlaveInput() ); - - masterPtr->SetRequestedRegion(inputSARRequestedRegion); - slavePtr->SetRequestedRegion(inputSARRequestedRegion); - - - ImagePhaseRegionType phaseRequestedRegion; - ImagePhaseIndexType indexPhase; - indexPhase.Fill(0); - ImagePhaseSizeType sizePhase; - sizePhase.Fill(0); - phaseRequestedRegion.SetIndex(indexPhase); - phaseRequestedRegion.SetSize(sizePhase); - + bool sameGeoAsMainOutput; + ImagePhaseRegionType phaseRequestedRegion = OutputRegionToInputPhaseRegion(outputRequestedRegion, + sameGeoAsMainOutput, true); ImagePhasePointer phasePtr = const_cast< ImagePhaseType * >( this->GetTopographicPhaseInput() ); phasePtr->SetRequestedRegion(phaseRequestedRegion); } } - - - /** - * Method EnlargeOutputRequestedRegion - */ - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - void - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::EnlargeOutputRequestedRegion( itk::DataObject *itkNotUsed(output) ) - { - // This filter requires all of the optionnal output image (Nth Output = 1). - if (m_UseDEMGeoAsOutput) - { - if ( this->itk::ProcessObject::GetOutput(1) ) - { - this->itk::ProcessObject::GetOutput(1)->SetRequestedRegionToLargestPossibleRegion(); - } - } - } - - - /** - * Method BeforeThreadedGenerateData - */ - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - void - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::BeforeThreadedGenerateData() - { - // Allocation for the optionnal image (if needed) - if (m_UseDEMGeoAsOutput) - { - // Allocate optionnal output - ImageOutPointer outputOptionnalPtr = this->GetOutputIntoDEMGeo(); - outputOptionnalPtr->SetBufferedRegion(outputOptionnalPtr->GetRequestedRegion() ); - outputOptionnalPtr->Allocate(); - } - } - - /** - * Method AfterThreadedGenerateData - */ - template<class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut> - void - SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut > - ::AfterThreadedGenerateData() - { - } /** @@ -951,470 +749,332 @@ namespace otb ImageOutPixelType outPixel; outPixel.Reserve(4); - // Two possible outputs => Two kinds of streaming and calculation : - // m_OutputCounter = 0 => Main output and main calculation - // m_OutputCounter = 1 => Optionnal output (ortho geo) and copy of accumulation into ortho geo to ortho - // image - if (m_OutputCounter == 1) - { - // Compute corresponding input region for SAR images - ImageSARRegionType inputRegionForThread = OutputRegionToInputRegion(outputRegionForThread, true); + // Compute corresponding input region for SAR images + ImageSARRegionType inputRegionForThread = OutputRegionToInputRegion(outputRegionForThread, true); - // Compute corresponding input region for Topographic phase image - bool sameGeoAsMainOutput; // If true => Geo TopoPhase == main output geo else Geo TopoPhase = SAR Geo - ImagePhaseRegionType inputPhaseRegionForThread = OutputRegionToInputPhaseRegion(outputRegionForThread, - sameGeoAsMainOutput, true); - // Define/declare an iterator that will walk the input regions for this - // thread. - InputSARIterator inMasterIt(this->GetMasterInput(), inputRegionForThread); - InputSARIterator inSlaveIt(this->GetSlaveInput(), inputRegionForThread); - - InputPhaseIterator inTopoPhaseIt(this->GetTopographicPhaseInput(), inputPhaseRegionForThread); - - // Define/declare an iterator that will walk the output region for this - // thread. - OutputIterator outIt(this->GetOutput(), outputRegionForThread); + // Compute corresponding input region for Topographic phase image + bool sameGeoAsMainOutput; // If true => Geo TopoPhase == main output geo else Geo TopoPhase = SAR Geo + ImagePhaseRegionType inputPhaseRegionForThread = OutputRegionToInputPhaseRegion(outputRegionForThread, + sameGeoAsMainOutput, true); + // Define/declare an iterator that will walk the input regions for this + // thread. + InputSARIterator inMasterIt(this->GetMasterInput(), inputRegionForThread); + InputSARIterator inSlaveIt(this->GetSlaveInput(), inputRegionForThread); + + InputPhaseIterator inTopoPhaseIt(this->GetTopographicPhaseInput(), inputPhaseRegionForThread); + + // Define/declare an iterator that will walk the output region for this + // thread. + OutputIterator outIt(this->GetOutput(), outputRegionForThread); - inMasterIt.GoToBegin(); - inSlaveIt.GoToBegin(); - inTopoPhaseIt.GoToBegin(); - outIt.GoToBegin(); - - // Get the number of column of the region - const ImageOutSizeType & outputRegionForThreadSize = outputRegionForThread.GetSize(); - unsigned int nbCol = static_cast<unsigned int>(outputRegionForThreadSize[0]); + inMasterIt.GoToBegin(); + inSlaveIt.GoToBegin(); + inTopoPhaseIt.GoToBegin(); + outIt.GoToBegin(); + + // Get the number of column of the region + const ImageOutSizeType & outputRegionForThreadSize = outputRegionForThread.GetSize(); + unsigned int nbCol = static_cast<unsigned int>(outputRegionForThreadSize[0]); - // Allocate Arrays for accumulations (size = nbCol) - double *complexMulConjTab_Re = new double[nbCol]; - double *complexMulConjTab_Im = new double[nbCol]; - double *complexMulConjTab_Mod = new double[nbCol]; - int *isDataCounter = new int[nbCol]; - - Point2DType groundPoint; - itk::ContinuousIndex<double, 2> groundContinousIndex; - - //// Initialize the indLastL and indFirstL (for spending our averaging with a margin) //// - int indFirstL = 0; - int indLastL = m_MLAzi+ m_MarginAzi; - int marginAzi = (int) m_MarginAzi; + // Allocate Arrays for accumulations (size = nbCol) + double *complexMulConjTab_Re = new double[nbCol]; + double *complexMulConjTab_Im = new double[nbCol]; + double *complexMulConjTab_Mod = new double[nbCol]; + int *isDataCounter = new int[nbCol]; + + Point2DType groundPoint; + itk::ContinuousIndex<double, 2> groundContinousIndex; + + //// Initialize the indLastL and indFirstL (for spending our averaging with a margin) //// + int indFirstL = 0; + int indLastL = m_MLAzi+ m_MarginAzi; + int marginAzi = (int) m_MarginAzi; - if (inMasterIt.GetIndex()[1] >= marginAzi && marginAzi != 0) - { - indFirstL = -marginAzi; - } + if (inMasterIt.GetIndex()[1] >= marginAzi && marginAzi != 0) + { + indFirstL = -marginAzi; + } - if ((inMasterIt.GetIndex()[1] + (indLastL - indFirstL)) > (m_nbLinesSAR-1)) - { - indLastL = (m_nbLinesSAR-1) + indFirstL - inMasterIt.GetIndex()[1]; - } + if ((inMasterIt.GetIndex()[1] + (indLastL - indFirstL)) > (m_nbLinesSAR-1)) + { + indLastL = (m_nbLinesSAR-1) + indFirstL - inMasterIt.GetIndex()[1]; + } - bool backTopreviousLines = false; - bool backTopreviousColunms = false; + bool backTopreviousLines = false; + bool backTopreviousColunms = false; - //////// For each Line ///////// - while ( !inMasterIt.IsAtEnd() && !inSlaveIt.IsAtEnd() && !inTopoPhaseIt.IsAtEnd() && !outIt.IsAtEnd()) + //////// For each Line ///////// + while ( !inMasterIt.IsAtEnd() && !inSlaveIt.IsAtEnd() && !inTopoPhaseIt.IsAtEnd() && !outIt.IsAtEnd()) + { + // reinitialize + for (unsigned int j = 0; j < nbCol; j++) { - // reinitialize - for (unsigned int j = 0; j < nbCol; j++) - { - complexMulConjTab_Re[j] = 0; - complexMulConjTab_Im[j] = 0; - complexMulConjTab_Mod[j] = 0; - isDataCounter[j] = 0; - } + complexMulConjTab_Re[j] = 0; + complexMulConjTab_Im[j] = 0; + complexMulConjTab_Mod[j] = 0; + isDataCounter[j] = 0; + } - if (backTopreviousLines) + if (backTopreviousLines) + { + //// Previous index in azimut (for averaging) //// + if (inMasterIt.GetIndex()[1] >= marginAzi && marginAzi != 0) { - //// Previous index in azimut (for averaging) //// - if (inMasterIt.GetIndex()[1] >= marginAzi && marginAzi != 0) - { - indFirstL = -marginAzi; - } + indFirstL = -marginAzi; + } - ImageSARIndexType indSARL; - indSARL[0] = inMasterIt.GetIndex()[0]; - indSARL[1] = inMasterIt.GetIndex()[1] - (2*marginAzi); + ImageSARIndexType indSARL; + indSARL[0] = inMasterIt.GetIndex()[0]; + indSARL[1] = inMasterIt.GetIndex()[1] - (2*marginAzi); - ImagePhaseIndexType indPhaL; - indPhaL[0] = inTopoPhaseIt.GetIndex()[0]; - indPhaL[1] = inTopoPhaseIt.GetIndex()[1] - (2*marginAzi); + ImagePhaseIndexType indPhaL; + indPhaL[0] = inTopoPhaseIt.GetIndex()[0]; + indPhaL[1] = inTopoPhaseIt.GetIndex()[1] - (2*marginAzi); - if ((indSARL[1] + indLastL - indFirstL) > (m_nbLinesSAR-1)) - { - indLastL = (m_nbLinesSAR - 1) - indSARL[1] + indFirstL; - } + if ((indSARL[1] + indLastL - indFirstL) > (m_nbLinesSAR-1)) + { + indLastL = (m_nbLinesSAR - 1) - indSARL[1] + indFirstL; + } - // Check previous index - if (indSARL[1] >= 0 && indPhaL[1] >= 0 && marginAzi != 0) + // Check previous index + if (indSARL[1] >= 0 && indPhaL[1] >= 0 && marginAzi != 0) + { + // Previous index inputs + inMasterIt.SetIndex(indSARL); + inSlaveIt.SetIndex(indSARL); + // If topographic phase has SAR geo + if (!sameGeoAsMainOutput) { - // Previous index inputs - inMasterIt.SetIndex(indSARL); - inSlaveIt.SetIndex(indSARL); - // If topographic phase has SAR geo - if (!sameGeoAsMainOutput) - { - inTopoPhaseIt.SetIndex(indPhaL); - } - - indFirstL = -marginAzi; + inTopoPhaseIt.SetIndex(indPhaL); } + + indFirstL = -marginAzi; } + } - backTopreviousLines = true; + backTopreviousLines = true; - // GenerateInputRequestedRegion function requires an input region with - // In_nbLine = m_Averaging * Out_nbLine (Averaing in function of ML Factors and Margins) - for (int i = indFirstL ; i < indLastL; i++) - { - inMasterIt.GoToBeginOfLine(); - inSlaveIt.GoToBeginOfLine(); - inTopoPhaseIt.GoToBeginOfLine(); - outIt.GoToBeginOfLine(); + // GenerateInputRequestedRegion function requires an input region with + // In_nbLine = m_Averaging * Out_nbLine (Averaing in function of ML Factors and Margins) + for (int i = indFirstL ; i < indLastL; i++) + { + inMasterIt.GoToBeginOfLine(); + inSlaveIt.GoToBeginOfLine(); + inTopoPhaseIt.GoToBeginOfLine(); + outIt.GoToBeginOfLine(); - int colCounter = 0; - backTopreviousColunms = false; + int colCounter = 0; + backTopreviousColunms = false; - //// Initialize the indLastC and indFirstC (for spending average with a margin) //// - int indFirstC = 0; - int indLastC = m_MLRan + m_MarginRan; - int marginRan = (int) m_MarginRan; + //// Initialize the indLastC and indFirstC (for spending average with a margin) //// + int indFirstC = 0; + int indLastC = m_MLRan + m_MarginRan; + int marginRan = (int) m_MarginRan; - if (inMasterIt.GetIndex()[0] >= marginRan && marginRan != 0) - { - indFirstC = -marginRan; - } + if (inMasterIt.GetIndex()[0] >= marginRan && marginRan != 0) + { + indFirstC = -marginRan; + } - if ((inMasterIt.GetIndex()[0] + (indLastC - indFirstC)) > (m_nbColSAR-1)) - { - indLastC = (m_nbColSAR-1) + indFirstC - inMasterIt.GetIndex()[0]; - } + if ((inMasterIt.GetIndex()[0] + (indLastC - indFirstC)) > (m_nbColSAR-1)) + { + indLastC = (m_nbColSAR-1) + indFirstC - inMasterIt.GetIndex()[0]; + } - ///////// For each column ///////// - while (!inMasterIt.IsAtEndOfLine() && !inSlaveIt.IsAtEndOfLine() && !inTopoPhaseIt.IsAtEndOfLine() - && !outIt.IsAtEndOfLine()) - { + ///////// For each column ///////// + while (!inMasterIt.IsAtEndOfLine() && !inSlaveIt.IsAtEndOfLine() && !inTopoPhaseIt.IsAtEndOfLine() + && !outIt.IsAtEndOfLine()) + { - if (backTopreviousColunms) + if (backTopreviousColunms) + { + //// Previous index in range (for averaging) //// + if (inMasterIt.GetIndex()[0] >= marginRan && marginRan != 0) { - //// Previous index in range (for averaging) //// - if (inMasterIt.GetIndex()[0] >= marginRan && marginRan != 0) - { - indFirstC = -marginRan; - } + indFirstC = -marginRan; + } - ImageSARIndexType indSARC; - indSARC[0] = inMasterIt.GetIndex()[0] - (2*marginRan); - indSARC[1] = inMasterIt.GetIndex()[1]; + ImageSARIndexType indSARC; + indSARC[0] = inMasterIt.GetIndex()[0] - (2*marginRan); + indSARC[1] = inMasterIt.GetIndex()[1]; - ImagePhaseIndexType indPhaC; - indPhaC[0] = inTopoPhaseIt.GetIndex()[0] - (2*marginRan); - indPhaC[1] = inTopoPhaseIt.GetIndex()[1]; + ImagePhaseIndexType indPhaC; + indPhaC[0] = inTopoPhaseIt.GetIndex()[0] - (2*marginRan); + indPhaC[1] = inTopoPhaseIt.GetIndex()[1]; - if ((indSARC[0] + indLastC - indFirstC) > (m_nbColSAR-1)) - { - indLastC = (m_nbColSAR-1) - indSARC[0] + indFirstC; - } + if ((indSARC[0] + indLastC - indFirstC) > (m_nbColSAR-1)) + { + indLastC = (m_nbColSAR-1) - indSARC[0] + indFirstC; + } - // Check previous index - if (indSARC[0] >= 0 && indPhaC[0] >= 0 && marginRan != 0) + // Check previous index + if (indSARC[0] >= 0 && indPhaC[0] >= 0 && marginRan != 0) + { + // Previous index inputs + inMasterIt.SetIndex(indSARC); + inSlaveIt.SetIndex(indSARC); + // If topographic phase has SAR geo + if (!sameGeoAsMainOutput) { - // Previous index inputs - inMasterIt.SetIndex(indSARC); - inSlaveIt.SetIndex(indSARC); - // If topographic phase has SAR geo - if (!sameGeoAsMainOutput) - { - inTopoPhaseIt.SetIndex(indPhaC); - } - - indFirstC = -marginRan; + inTopoPhaseIt.SetIndex(indPhaC); } - + + indFirstC = -marginRan; } + + } - backTopreviousColunms = true; + backTopreviousColunms = true; - for (int k = indFirstC ; k < indLastC; k++) + for (int k = indFirstC ; k < indLastC; k++) + { + if (!inMasterIt.IsAtEndOfLine() && !inSlaveIt.IsAtEndOfLine()) { - if (!inMasterIt.IsAtEndOfLine() && !inSlaveIt.IsAtEndOfLine()) - { - // Check isData (grom topographic phase) - if (inTopoPhaseIt.Get()[1] != 0) - { - // Complex Raw interferogram (master * conj(slave)) - double real_RawInterfero = (inMasterIt.Get().real()*inSlaveIt.Get().real() + - inMasterIt.Get().imag()*inSlaveIt.Get().imag()); - - double imag_RawInterfero = (inMasterIt.Get().imag()*inSlaveIt.Get().real() - - inMasterIt.Get().real()*inSlaveIt.Get().imag()); - - ///////////// Topographoc phase as complex number //////////////// - double topoPhase = inTopoPhaseIt.Get()[0]; + // Check isData (grom topographic phase) + if (inTopoPhaseIt.Get()[1] != 0) + { + // Complex Raw interferogram (master * conj(slave)) + double real_RawInterfero = (inMasterIt.Get().real()*inSlaveIt.Get().real() + + inMasterIt.Get().imag()*inSlaveIt.Get().imag()); + + double imag_RawInterfero = (inMasterIt.Get().imag()*inSlaveIt.Get().real() - + inMasterIt.Get().real()*inSlaveIt.Get().imag()); + + ///////////// Topographoc phase as complex number //////////////// + double topoPhase = inTopoPhaseIt.Get()[0]; - if (m_ApproxDiapason) - { - int topoPhase_int = static_cast<int>(std::round(inTopoPhaseIt.Get()[0]))% - 256; - topoPhase = 2*M_PI*topoPhase_int / 256; - } - - double complexTopoPhase_Re = std::cos(topoPhase); - double complexTopoPhase_Im = std::sin(topoPhase); + double complexTopoPhase_Re = std::cos(topoPhase); + double complexTopoPhase_Im = std::sin(topoPhase); - // Multiply the conj(complexTopoPhase) with complex raw interferogram - double real_interfero = (real_RawInterfero * complexTopoPhase_Re + - imag_RawInterfero * complexTopoPhase_Im); - double imag_interfero = (imag_RawInterfero * complexTopoPhase_Re - - real_RawInterfero * complexTopoPhase_Im); + // Multiply the conj(complexTopoPhase) with complex raw interferogram + double real_interfero = (real_RawInterfero * complexTopoPhase_Re + + imag_RawInterfero * complexTopoPhase_Im); + double imag_interfero = (imag_RawInterfero * complexTopoPhase_Re - + real_RawInterfero * complexTopoPhase_Im); - ///////////// Accumulations /////////////// - complexMulConjTab_Re[colCounter] += real_interfero; + ///////////// Accumulations /////////////// + complexMulConjTab_Re[colCounter] += real_interfero; - complexMulConjTab_Im[colCounter] += imag_interfero; + complexMulConjTab_Im[colCounter] += imag_interfero; - complexMulConjTab_Mod[colCounter] += sqrt((real_interfero*real_interfero) + - (imag_interfero*imag_interfero)); - - isDataCounter[colCounter] += 1; - - // Accumulation for ortho geo (only if k and i betwwen 0 and ml Factors) - if (m_UseDEMGeoAsOutput && (i >= 0 && i < (int) m_MLAzi) && (k >= 0 && k < (int) m_MLRan)) - { - // Determine the index on ortho image - ossimEcefPoint ecefPt; - ecefPt.x() = inTopoPhaseIt.Get()[2]; - ecefPt.y() = inTopoPhaseIt.Get()[3]; - ecefPt.z() = inTopoPhaseIt.Get()[4]; - ossimGpt gptPt(ecefPt); - groundPoint[0] = gptPt.lon; - groundPoint[1] = gptPt.lat; - - m_DEMPtr->TransformPhysicalPointToContinuousIndex(groundPoint, - groundContinousIndex); - - int groundIndexC = static_cast<int>(std::round(groundContinousIndex[0])); - int groundIndexL = static_cast<int>(std::round(groundContinousIndex[1])); - - int groundIndex = groundIndexL*m_nbColDEM + groundIndexC; - - // Accumulate into OrthoAccByThread at threadId and at groundIndex - /*m_OrthoRealAccByThread[threadId][groundIndex] += real_interfero; - m_OrthoImagAccByThread[threadId][groundIndex] += imag_interfero; - m_OrthoModAccByThread[threadId][groundIndex] += sqrt((real_interfero* - real_interfero) + - (imag_interfero* - imag_interfero)); - - // Increment counter - ++m_OrthoCounterByThread[threadId];*/ - - m_Mutex->Lock(); - - m_OrthoRealAcc[groundIndex] += real_interfero; - m_OrthoImagAcc[groundIndex] += imag_interfero; - m_OrthoModAcc[groundIndex] += sqrt((real_interfero*real_interfero) + - (imag_interfero*imag_interfero)); - - ++m_OrthoCounter[groundIndex]; - - m_Mutex->Unlock(); - - - } - } - - // Next colunm inputs - ++inMasterIt; - ++inSlaveIt; - // If topographic phase has SAR geo - if (!sameGeoAsMainOutput) - { - ++inTopoPhaseIt; - } + complexMulConjTab_Mod[colCounter] += sqrt((real_interfero*real_interfero) + + (imag_interfero*imag_interfero)); + + isDataCounter[colCounter] += 1; } - } // End for k (indFirstC to indLastC) + + // Next colunm inputs + ++inMasterIt; + ++inSlaveIt; + // If topographic phase has SAR geo + if (!sameGeoAsMainOutput) + { + ++inTopoPhaseIt; + } + } + } // End for k (indFirstC to indLastC) // Estiamte and Assigne outIt //if (i == (m_MLAzi-1)) - if (i == (indLastL-1)) + if (i == (indLastL-1)) + { + // Check if Data + if (isDataCounter[colCounter] >= 1) { - // Check if Data - if (isDataCounter[colCounter] >= 1) - { - ///////////// Estimations of amplitude, phase and coherency /////////////// - double mod_Acc = sqrt(complexMulConjTab_Re[colCounter]*complexMulConjTab_Re[colCounter] - + complexMulConjTab_Im[colCounter]* - complexMulConjTab_Im[colCounter]); + ///////////// Estimations of amplitude, phase and coherency /////////////// + double mod_Acc = sqrt(complexMulConjTab_Re[colCounter]*complexMulConjTab_Re[colCounter] + + complexMulConjTab_Im[colCounter]* + complexMulConjTab_Im[colCounter]); - int countPixel = (m_MLRan + 2*m_MarginRan) * (m_MLAzi + 2*m_MarginAzi); + int countPixel = (m_MLRan + 2*m_MarginRan) * (m_MLAzi + 2*m_MarginAzi); - // Amplitude - outPixel[0] = m_Gain * sqrt((complexMulConjTab_Mod[colCounter]/(countPixel))); + // Amplitude + outPixel[0] = m_Gain * sqrt((complexMulConjTab_Mod[colCounter]/(countPixel))); - // Phase - outPixel[1] = std::atan2(complexMulConjTab_Im[colCounter], - complexMulConjTab_Re[colCounter]); - - // Mod 2*Pi - outPixel[1] = outPixel[1]-(2*M_PI)*floor(outPixel[1]/(2*M_PI)); + // Phase + outPixel[1] = std::atan2(complexMulConjTab_Im[colCounter], + complexMulConjTab_Re[colCounter]); - if (m_ApproxDiapason) - { - outPixel[1] = std::atan2(complexMulConjTab_Im[colCounter], - complexMulConjTab_Re[colCounter])* 128 * M_1_PI; + // Mod 2*Pi + outPixel[1] = outPixel[1]-(2*M_PI)*floor(outPixel[1]/(2*M_PI)); - outPixel[1] = outPixel[1]-(256)*floor(outPixel[1]/(256)); - - outPixel[1] = std::round(outPixel[1]); - } - - // Coherency - if (complexMulConjTab_Mod[colCounter] != 0) - { - outPixel[2] = mod_Acc / complexMulConjTab_Mod[colCounter]; - } - else - { - outPixel[2] = 0; - } - - // isData set to 1 - outPixel[3] = 1; - - if (outPixel[0] == 0 && outPixel[1] == 0 && outPixel[2] == 0) - { - outPixel[3] = 0; - } + // Coherency + if (complexMulConjTab_Mod[colCounter] != 0) + { + outPixel[2] = mod_Acc / complexMulConjTab_Mod[colCounter]; } else { - outPixel[0] = 0; - outPixel[1] = 0; outPixel[2] = 0; - outPixel[3] = 0; } - - outIt.Set(outPixel); - progress.CompletedPixel(); - } - // Next colunm output - ++outIt; - // If topographic phase has Main output geo - if (sameGeoAsMainOutput) + // isData set to 1 + outPixel[3] = 1; + + if (outPixel[0] == 0 && outPixel[1] == 0 && outPixel[2] == 0) + { + outPixel[3] = 0; + } + } + else { - ++inTopoPhaseIt; + outPixel[0] = 0; + outPixel[1] = 0; + outPixel[2] = 0; + outPixel[3] = 0; } - colCounter++; + + outIt.Set(outPixel); + progress.CompletedPixel(); } - - // Next line intputs - inMasterIt.NextLine(); - inSlaveIt.NextLine(); - // If topographic phase has SAR geo - if (!sameGeoAsMainOutput) + + // Next colunm output + ++outIt; + // If topographic phase has Main output geo + if (sameGeoAsMainOutput) { - inTopoPhaseIt.NextLine(); + ++inTopoPhaseIt; } - - } // End for i (firstL to lastL) - - // Next line output - outIt.NextLine(); - // If topographic phase has Main output geo - if (sameGeoAsMainOutput) + colCounter++; + } + + // Next line intputs + inMasterIt.NextLine(); + inSlaveIt.NextLine(); + // If topographic phase has SAR geo + if (!sameGeoAsMainOutput) { inTopoPhaseIt.NextLine(); } - + + } // End for i (firstL to lastL) + + // Next line output + outIt.NextLine(); + // If topographic phase has Main output geo + if (sameGeoAsMainOutput) + { + inTopoPhaseIt.NextLine(); } + + } delete [] complexMulConjTab_Re; delete [] complexMulConjTab_Im; delete [] complexMulConjTab_Mod; delete [] isDataCounter; - } - - //////////// Optionnal output //////////////// - // Copy for optionnal output (ortho image) - if (m_OutputCounter == 2 && m_UseDEMGeoAsOutput) - { - // Streming is on main output or orhto geo is very different => to guarantee Thread-safety only - // threadId = 0 makes the copy (the whole copy) - if (threadId == 0) - { - int sizeDEM = m_nbColDEM * m_nbLinesDEM; - ImageOutIndexType outDEMIndex; - - for (int indOrtho = 0; indOrtho < sizeDEM; indOrtho++) - { - // Index - outDEMIndex[0] = indOrtho % m_nbColDEM; - outDEMIndex[1] = indOrtho / m_nbColDEM; // ninteger division - - // Amplitude, Phase and coherency - if (m_OrthoCounter[indOrtho] != 0) - { - double mod_Acc = sqrt(m_OrthoRealAcc[indOrtho]*m_OrthoRealAcc[indOrtho] - + m_OrthoImagAcc[indOrtho]* m_OrthoImagAcc[indOrtho]); - - - // Amplitude - outPixel[0] = m_Gain * sqrt(m_OrthoModAcc[indOrtho]/m_OrthoCounter[indOrtho]); - - // Phase - outPixel[1] = std::atan2(m_OrthoImagAcc[indOrtho], - m_OrthoRealAcc[indOrtho]); - - // Mod 2*Pi - outPixel[1] = outPixel[1]-(2*M_PI)*floor(outPixel[1]/(2*M_PI)); - - if (m_ApproxDiapason) - { - outPixel[1] = std::atan2(m_OrthoImagAcc[indOrtho], - m_OrthoRealAcc[indOrtho])* 128 * M_1_PI; - - //outPixel[1] = outPixel[1]-(256)*floor(outPixel[1]/(256)); - - outPixel[1] = std::round(outPixel[1]); - } - - // Coherency - if (m_OrthoModAcc[indOrtho] != 0) - { - outPixel[2] = mod_Acc / m_OrthoModAcc[indOrtho]; - } - else - { - outPixel[2] = 0; - } - - // isData set to 1 - outPixel[3] = 1; - - } - else - { - outPixel[0] = 0; - outPixel[1] = 0; - outPixel[2] = 0; - outPixel[3] = 0; - } + - this->GetOutputIntoDEMGeo()->SetPixel(outDEMIndex, outPixel); - } - } - } } -} /*namespace otb*/ + } /*namespace otb*/ #endif diff --git a/include/otbSARQuadraticAveragingImageFilter.txx b/include/otbSARQuadraticAveragingImageFilter.txx index 60846082a1f0bcf92a91fd0fef2c418fcd0341dd..7a3bb715ea72d0431450a10f023345b8fa7df256 100644 --- a/include/otbSARQuadraticAveragingImageFilter.txx +++ b/include/otbSARQuadraticAveragingImageFilter.txx @@ -78,7 +78,7 @@ SARQuadraticAveragingImageFilter< TImage > ::GenerateOutputInformation() { // Call the superclass' implementation of this method - Superclass::GenerateInputRequestedRegion(); + Superclass :: GenerateOutputInformation(); // Get pointers to the input and output ImageConstPointer inputPtr = this->GetInput(); diff --git a/include/otbSARTemporalCorrelationGridImageFilter.txx b/include/otbSARTemporalCorrelationGridImageFilter.txx index a7ec5551a48aa3cbd05ccc7bc03f7421596f5a9f..8f8fe2cbc0bf79e75d8e04c2dc28441521ea2a91 100644 --- a/include/otbSARTemporalCorrelationGridImageFilter.txx +++ b/include/otbSARTemporalCorrelationGridImageFilter.txx @@ -478,7 +478,6 @@ namespace otb // Typedef for iterators typedef itk::ImageScanlineIterator< ImageOutType > OutputIterator; typedef itk::ImageRegionConstIterator<ImageInType> MasterSlaveIt; - typedef itk::ImageRegionIterator<ImageInType> ExtractIt; // Iterator on output (Grid geometry) OutputIterator OutIt(this->GetOutput(), outputRegionForThread); diff --git a/include/otbSARUpdateMetadataImageFilter.txx b/include/otbSARUpdateMetadataImageFilter.txx index 13bbffbe204bb4d2da2195555902fe767ae19ff0..e6e0c1b634161ab47edef24f3bdf130051f35d3f 100644 --- a/include/otbSARUpdateMetadataImageFilter.txx +++ b/include/otbSARUpdateMetadataImageFilter.txx @@ -81,7 +81,7 @@ namespace otb template<class TImage> void SARUpdateMetadataImageFilter< TImage > - ::ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) + ::ThreadedGenerateData(const ImageRegionType& outputRegionForThread, itk::ThreadIdType /*threadId*/) { // Get Input and Output ptr ImagePointer outputPtr = this->GetOutput(); diff --git a/include/otbTilesAnalysisImageFilter.h b/include/otbTilesAnalysisImageFilter.h index 544a6eede6c1a25592fc8ca7b664b42168697d84..980412b5788c4edd64e27fd2c2f52cfd1d82335d 100644 --- a/include/otbTilesAnalysisImageFilter.h +++ b/include/otbTilesAnalysisImageFilter.h @@ -188,7 +188,7 @@ protected: /** startIndex and stopIndex represent the indices of tiles to process in thread threadId and index for the first tile */ - virtual void ThreadedGenerateData(unsigned int startTileId, unsigned int stopTileId, + void ThreadedGenerateData(unsigned int startTileId, unsigned int stopTileId, unsigned int firstTileIndexL, unsigned int firstTileIndexC, itk::ThreadIdType threadId); diff --git a/python_src/diapOTB.py b/python_src/diapOTB.py index e59c71d7d96435155d164c365d9cd20961bc63a6..9255952bb8e0ecbc743163b34af92a750803c34c 100644 --- a/python_src/diapOTB.py +++ b/python_src/diapOTB.py @@ -140,7 +140,6 @@ if __name__ == "__main__": ml_geoGrid_range = ml_range ml_geoGrid_azimut = ml_azimut gain_interfero = dict_DInSAR['parameter']['Interferogram_gain'] - activateOrthoInterferogram = dict_DInSAR['parameter']['Interferogram_ortho'] if (geoGrid_threshold < 0) or (geoGrid_threshold > 1) : print("Wrong Threshold for fine deformation grid") @@ -413,7 +412,6 @@ if __name__ == "__main__": ######## SARRobustInterferogram Application (interf step) ####### print("\n SARRobustInterferogram Application \n") interferogram = "interferogram.tif" - interferogram_ortho = "interferogram_ortho.tif" appInterferogram = otb.Registry.CreateApplication("SARRobustInterferogram") appInterferogram.SetParameterString("insarmaster", master_Image) appInterferogram.SetParameterString("incoregistratedslave", os.path.join(output_dir, slave_Image_CoRe)) @@ -427,8 +425,4 @@ if __name__ == "__main__": appInterferogram.SetParameterFloat("gain", gain_interfero) appInterferogram.SetParameterString("ram", "4000") appInterferogram.SetParameterString("out", os.path.join(output_dir, interferogram)) - if activateOrthoInterferogram : - appInterferogram.SetParameterString("ortho", "true") - appInterferogram.SetParameterString("indem", dem) - appInterferogram.SetParameterString("outopt", os.path.join(output_dir, interferogram_ortho)) appInterferogram.ExecuteAndWriteOutput() diff --git a/python_src/diapOTB_S1IW.py b/python_src/diapOTB_S1IW.py index 352de09c6561991f7d30076e3b605e515ee82f43..0dcf6edff3916d0e5d2b1c099d351d430aea639a 100644 --- a/python_src/diapOTB_S1IW.py +++ b/python_src/diapOTB_S1IW.py @@ -164,7 +164,6 @@ if __name__ == "__main__": ml_geoGrid_range = ml_range ml_geoGrid_azimut = ml_azimut gain_interfero = dict_DInSAR['parameter']['Interferogram_gain'] - activateOrthoInterferogram = dict_DInSAR['parameter']['Interferogram_ortho'] # esd loop esd_AutoMode = False # automatic mode to apply a threshold inside the esd loop esd_NbIter = 0 @@ -591,8 +590,7 @@ if __name__ == "__main__": ######## SARRobustInterferogram Application (interf step) ####### print("\n SARRobustInterferogram Application \n") interferogram_path = os.path.join(burst_dir, "interferogram" + "_burst" + str(burstId) + ".tif") - interferogram_ortho_path = os.path.join(burst_dir, "interferogram_ortho" + "_burst" + str(burstId) + ".tif") - + if esd_NbIter > 0 : esd_dir = os.path.join(burst_dir, "esd") @@ -600,8 +598,7 @@ if __name__ == "__main__": os.makedirs(esd_dir) interferogram_path = os.path.join(esd_dir, "interferogram" + "_burst" + str(burstId) + "_iter" + str(0) + ".tif") - interferogram_ortho_path = os.path.join(esd_dir, "interferogram_ortho" + "_burst" + str(burstId) + "_iter" + str(0) + ".tif") - + appInterferogram = otb.Registry.CreateApplication("SARRobustInterferogram") appInterferogram.SetParameterString("insarmaster", os.path.join(burst_dir, burstM)) appInterferogram.SetParameterString("incoregistratedslave", os.path.join(burst_dir, burstCoReRerampS)) @@ -617,10 +614,6 @@ if __name__ == "__main__": appInterferogram.SetParameterFloat("gain", gain_interfero) appInterferogram.SetParameterString("ram", "4000") appInterferogram.SetParameterString("out", interferogram_path) - if activateOrthoInterferogram : - appInterferogram.SetParameterString("ortho", "true") - appInterferogram.SetParameterString("indem", dem) - appInterferogram.SetParameterString("outopt", interferogram_ortho_path) appInterferogram.ExecuteAndWriteOutput() list_of_Interferograms.append(interferogram_path) @@ -749,7 +742,6 @@ if __name__ == "__main__": ######## SARRobustInterferogram Application (interf step) ####### print("\n SARRobustInterferogram Application \n") interferogram_path = os.path.join(esd_dir, "interferogram" + "_burst" + str(burstId) + "_iter" + str(iter_esd) + ".tif") - interferogram_ortho_path = os.path.join(esd_dir, "interferogram_ortho" + "_burst" + str(burstId) + "_iter" + str(iter_esd) + ".tif") appInterferogram = otb.Registry.CreateApplication("SARRobustInterferogram") appInterferogram.SetParameterString("insarmaster", os.path.join(burst_dir, burstM)) @@ -768,10 +760,6 @@ if __name__ == "__main__": appInterferogram.SetParameterFloat("gain", gain_interfero) appInterferogram.SetParameterString("ram", "4000") appInterferogram.SetParameterString("out", interferogram_path) - if activateOrthoInterferogram : - appInterferogram.SetParameterString("ortho", "true") - appInterferogram.SetParameterString("indem", dem) - appInterferogram.SetParameterString("outopt", interferogram_ortho_path) appInterferogram.ExecuteAndWriteOutput() # Store the new interferogram paths