Commit ede0b58d authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO
Browse files

UPDATE : Test on Diapason approximations into SARTopographicPhase and SARInterferogram applications

parent d2a982e2
Pipeline #17 failed with stages
......@@ -143,6 +143,7 @@ public:
itkSetMacro(MarginAzi, unsigned int);
itkSetMacro(Gain, float);
itkSetMacro(UseDEMGeoAsOutput, bool);
itkSetMacro(ApproxDiapason, bool);
void SetDEMPtr(ImageDEMPointer DEMPtr);
// Getter
itkGetMacro(MLRan, unsigned int);
......@@ -293,6 +294,8 @@ protected:
// Dimensions of DEM
int m_nbLinesDEM;
int m_nbColDEM;
bool m_ApproxDiapason;
};
} // End namespace otb
......
......@@ -42,7 +42,7 @@ namespace otb
template <class TImageSAR, class TImageDEM, class TImagePhase, class TImageOut>
SARInterferogramImageFilter< TImageSAR, TImageDEM, TImagePhase, TImageOut >::SARInterferogramImageFilter()
: m_MLRan(1), m_MLAzi(1), m_UseDEMGeoAsOutput(false), m_Gain(1), m_nbLinesSAR(0), m_nbColSAR(0),
m_MarginRan(1), m_MarginAzi(1), m_nbLinesDEM(0), m_nbColDEM(0)
m_MarginRan(1), m_MarginAzi(1), m_nbLinesDEM(0), m_nbColDEM(0), m_ApproxDiapason(true)
{
// Inputs required and/or needed
this->SetNumberOfRequiredInputs(2);
......@@ -341,7 +341,7 @@ namespace otb
// This output is defined with the DEM geometry
outputOptionnalPtr->SetLargestPossibleRegion(m_DEMPtr->GetLargestPossibleRegion());
outputOptionnalPtr->SetOrigin(m_DEMPtr->GetOrigin());
outputOptionnalPtr->SetSpacing(m_DEMPtr->GetSpacing());
outputOptionnalPtr->SetSignedSpacing(m_DEMPtr->GetSignedSpacing());
// Projection Ref
outputOptionnalPtr->SetProjectionRef(m_DEMPtr->GetProjectionRef());
......@@ -1143,8 +1143,17 @@ namespace otb
inMasterIt.Get().real()*inSlaveIt.Get().imag());
///////////// Topographoc phase as complex number ////////////////
double complexTopoPhase_Re = std::cos(inTopoPhaseIt.Get()[0]);
double complexTopoPhase_Im = std::sin(inTopoPhaseIt.Get()[0]);
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);
// Multiply the conj(complexTopoPhase) with complex raw interferogram
......@@ -1246,6 +1255,16 @@ namespace otb
// Mod 2*Pi
outPixel[1] = outPixel[1]-(2*M_PI)*floor(outPixel[1]/(2*M_PI));
if (m_ApproxDiapason)
{
outPixel[1] = std::atan2(complexMulConjTab_Im[colCounter],
complexMulConjTab_Re[colCounter])* 128 * M_1_PI;
outPixel[1] = outPixel[1]-(256)*floor(outPixel[1]/(256));
outPixel[1] = std::round(outPixel[1]);
}
// Coherency
if (complexMulConjTab_Mod[colCounter] != 0)
{
......@@ -1332,11 +1351,21 @@ namespace otb
// Phase
outPixel[1] = std::atan2(m_OrthoImagAcc[indOrtho],
m_OrthoRealAcc[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)
{
......
......@@ -130,6 +130,7 @@ public:
itkSetMacro(MaxShiftInRange, float);
itkSetMacro(MaxShiftInAzimut, float);
itkSetMacro(MasterCopy, bool);
itkSetMacro(ApproxDiapason, bool);
// Getter
itkGetMacro(MLRan, unsigned int);
itkGetMacro(MLAzi, unsigned int);
......@@ -265,6 +266,8 @@ protected:
SarSensorModelAdapter::Pointer m_SarSensorModelAdapterForMaster;
int m_OutputCounter;
bool m_ApproxDiapason;
};
} // End namespace otb
......
......@@ -43,7 +43,7 @@ namespace otb
SARTopographicPhaseImageFilter< TImageIn, TImageOut >::SARTopographicPhaseImageFilter()
: m_MLRan(1), m_MLAzi(1), m_MaxShiftInRange(0), m_MaxShiftInAzimut(0), m_Factor(2),
m_SarSensorModelAdapterForSlave(ITK_NULLPTR), m_SarSensorModelAdapterForMaster(ITK_NULLPTR),
m_MasterCopy(false), m_OutputCounter(0)
m_MasterCopy(false), m_OutputCounter(0), m_ApproxDiapason(true)
{
// Inputs required and/or needed
this->SetNumberOfRequiredInputs(4);
......@@ -599,8 +599,12 @@ namespace otb
pixelOut.Reserve(2);
}
//double constMul = static_cast<double>(m_Factor*256)/m_Lambda;
double constMul = static_cast<double>(m_Factor*2*M_PI)/m_Lambda;
if (m_ApproxDiapason)
{
constMul = static_cast<double>(m_Factor*256)/m_Lambda;
}
Point3DType worldSlave;
Point3DType satPosSlave;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment