Skip to content
Snippets Groups Projects
Commit 43884838 authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

Two kinds of Pipeline into AmplitudeEstimation (standard and Strip)

parent 37209e08
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
#include "otbWrapperApplicationFactory.h"
#include "otbImageFileReader.h"
#include "otbImageFileWriter.h"
#include "otbSARAmplitudeEstimationImageFilter.h"
#include <iostream>
......@@ -24,6 +25,7 @@ public:
// Filters
typedef otb::ImageFileReader <ComplexFloatImageType> ReaderComplexType ;
typedef otb::ImageFileWriter <FloatImageType> WriterType ;
typedef otb::ImageFileReader <FloatImageType> ReaderType ;
typedef otb::SARAmplitudeEstimationImageFilter < FloatVectorImageType, FloatImageType, FloatImageType, ComplexFloatImageType > FilterType;
......@@ -46,7 +48,7 @@ private:
AddParameter(ParameterType_InputImage, "indemproj", "Input vector of DEM projected into SAR geometry");
SetParameterDescription("indemproj", "Input vector image for amplitude estimation.");
AddParameter(ParameterType_InputImage, "indem", "Input DEM");
AddParameter(ParameterType_InputFilename, "indem", "Input DEM");
SetParameterDescription("indem", "DEM to extract DEM geometry.");
AddParameter(ParameterType_InputFilename, "insar", "Input SAR image");
......@@ -55,8 +57,16 @@ private:
AddParameter(ParameterType_Float, "ingain", "Multiplying gain");
SetParameterDescription("ingain", "Multiplying gain to obtain a mean radiometry at 100.");
AddParameter(ParameterType_OutputImage, "out", "Output amplitude Image");
SetParameterDescription("out","Output amplitude Image.");
//AddParameter(ParameterType_OutputImage, "out", "Output amplitude Image");
//SetParameterDescription("out","Output amplitude Image.");
AddParameter(ParameterType_OutputFilename, "out", "Output amplitude Image");
SetParameterDescription("out", "Output amplitude Image.");
AddParameter(ParameterType_Int, "nblineperstrip", "Number of Lines to execute the Pipeline");
SetParameterDescription("nblineperstrip","Number of Lines to execute the Pipeline");
SetDefaultParameterInt("nblineperstrip", 0);
MandatoryOff("nblineperstrip");
AddRAMParameter();
......@@ -93,7 +103,7 @@ void DoExecute()
FloatImageType::Pointer DEMPtr = reader_DEM->GetOutput();
reader_DEM->UpdateOutputInformation();
// Get numeric parameters (gain)
// Get numeric parameters : gain
double gain = GetParameterFloat("ingain");
otbAppLogINFO(<<"Gain : "<<gain);
......@@ -105,9 +115,37 @@ void DoExecute()
filterAmplitudeEstimation->SetDEMImagePtr(DEMPtr);
filterAmplitudeEstimation->SetGain(gain);
// Define the main pipeline
// Define the main pipeline (two kind of Pipeline : controlled with nbLinesPerStrip or automatic)
// Get numeric parameters : nbLinePerStrip
int nbLinesPerStrip = GetParameterInt("nblineperstrip");;
filterAmplitudeEstimation->SetInput(GetParameterImage("indemproj"));
SetParameterOutputImage("out", filterAmplitudeEstimation->GetOutput());
// Writer with the mode "strip"
std::string outSARFilename = GetParameterString("out");
WriterType::Pointer writer = WriterType::New();
writer->SetFileName(outSARFilename);
writer->SetInput(filterAmplitudeEstimation->GetOutput());
// Mode Strip with the indication of nbLinesPerStrip to the witer
if (nbLinesPerStrip > 0)
{
writer->SetNumberOfLinesStrippedStreaming(nbLinesPerStrip);
}
//Execute Pipeline
try
{
writer->Update();
}
catch (itk::ExceptionObject& err)
{
std::cerr << "ExceptionObject caught !" << std::endl;
std::cerr << err << std::endl;
}
//SetParameterOutputImage("out", filterAmplitudeEstimation->GetOutput());
}
// Vector for filters
std::vector<itk::ProcessObject::Pointer> m_Ref;
......
......@@ -183,7 +183,7 @@ SARAmplitudeEstimationImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR >
// Margin to apply on inverse localisation for the four sides.
int marge = 30;
int marge = 100;
// Indice for the SAR bloc (determined by the Pipeline)
ImageOutIndexType id[4] ;
......@@ -433,6 +433,7 @@ SARAmplitudeEstimationImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR >
{
return false;
}
}
......@@ -547,7 +548,7 @@ SARAmplitudeEstimationImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR >
// Loop on colunm
for (int k = std::max(firstCol_into_outputRegion, col1); k<= std::min(col2, nbCol_into_outputRegion); k++)
for (int k = std::max(col1, firstCol_into_outputRegion); k<= std::min(col2, nbCol_into_outputRegion); k++)
{
a = (cS - k) / dc;
b = 1.0 - a;
......@@ -682,6 +683,8 @@ SARAmplitudeEstimationImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR >
ImageInPixelType CLZY_InSideUp, CLZY_InSideDown, CLZY_OutSideUp, CLZY_OutSideDown;
counterMailles = 0;
int marge = 100;
// For each Line of input
while ( !InIt_LR.IsAtEnd() && !InIt_LL.IsAtEnd())// && !InIt_UR.IsAtEnd() && !InIt_UL.IsAtEnd())
......@@ -702,37 +705,41 @@ SARAmplitudeEstimationImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR >
{
// Get the sides (L,C) of the current maille
CLZY_UL = InIt_UL.Get();
CLZY_UR = InIt_UR.Get();
CLZY_LR = InIt_LR.Get();
CLZY_LL = InIt_LL.Get();
// Check if No Data
if (!(CLZY_UL[0] == -32768 || CLZY_UR[0] == -32768 || CLZY_LR[0] == -32768
|| CLZY_LL[0] == -32768))
{
// Determine if intersection
bool hasIntersection = this->MaillesAndSarLineIntersection(ind_Line, CLZY_UL, CLZY_UR,
CLZY_LR, CLZY_LL,
CLZY_InSideUp, CLZY_InSideDown,
CLZY_OutSideUp, CLZY_OutSideDown);
// Protect Memory access and input access
if (CLZY_UL[1] > ind_Line - marge && CLZY_UL[1] < ind_Line + marge)
{
CLZY_UR = InIt_UR.Get();
CLZY_LR = InIt_LR.Get();
CLZY_LL = InIt_LL.Get();
// Check if No Data
if (!(CLZY_UL[0] == -32768 || CLZY_UR[0] == -32768 || CLZY_LR[0] == -32768
|| CLZY_LL[0] == -32768))
{
// Determine if intersection
bool hasIntersection = this->MaillesAndSarLineIntersection(ind_Line, CLZY_UL, CLZY_UR,
CLZY_LR, CLZY_LL,
CLZY_InSideUp, CLZY_InSideDown,
CLZY_OutSideUp, CLZY_OutSideDown);
// If intersection == true : Retrive the intersected sides (two intersected among
// the four sides of the maille)
if (hasIntersection)
{
// Store the mailles
Mailles_SideInUp_Tab[counterMailles] = CLZY_InSideUp;
Mailles_SideInDown_Tab[counterMailles] = CLZY_InSideDown;
Mailles_SideOutUp_Tab[counterMailles] = CLZY_OutSideUp;
Mailles_SideOutDown_Tab[counterMailles] = CLZY_OutSideDown;
// Increment counter on mailles
++counterMailles ;
}
// If intersection == true : Retrive the intersected sides (two intersected among
// the four sides of the maille)
if (hasIntersection)
{
// Store the mailles
Mailles_SideInUp_Tab[counterMailles] = CLZY_InSideUp;
Mailles_SideInDown_Tab[counterMailles] = CLZY_InSideDown;
Mailles_SideOutUp_Tab[counterMailles] = CLZY_OutSideUp;
Mailles_SideOutDown_Tab[counterMailles] = CLZY_OutSideDown;
// Increment counter on mailles
++counterMailles ;
}
}
}
// Next Column For input
++InIt_UL;
++InIt_UR;
......@@ -759,6 +766,8 @@ SARAmplitudeEstimationImageFilter< TImageIn, TImageOut, TImageDEM, TImageSAR >
int counter = 0;
while (!OutIt.IsAtEndOfLine())
{
//ImageOutPixelType out_save = OutIt.Get();
// Affect OutIt
OutIt.Set(outValueTab[counter]);
++counter;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment