Skip to content
Snippets Groups Projects
Commit aca8a524 authored by Cyrille Valladeau's avatar Cyrille Valladeau
Browse files

TEST

parent 7f62e561
No related branches found
No related tags found
No related merge requests found
......@@ -122,19 +122,16 @@ SarParametricMapFunction<TInputImage, TCoordRep>
}
else if (pointSet->GetNumberOfPoints() == 1)
{
std::cout<<"EvaluateParam lol1"<<std::endl;
pointSet->GetPointData(0, &pointValue);
m_Coeff(0, 0) = pointValue;
}
else
{
std::cout<<"EvaluateParam lol2"<<std::endl;
// Get input region for normalization of coordinates
const itk::MetaDataDictionary& dict = this->GetInputImage()->GetMetaDataDictionary();
ImageKeywordlist imageKeywordlist;
if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey))
{
std::cout<<"EvaluateParam lol2.1"<<std::endl;
itk::ExposeMetaData<ImageKeywordlist>(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist);
ossimKeywordlist kwl;
imageKeywordlist.convertToOSSIMKeywordlist(kwl);
......@@ -145,12 +142,11 @@ SarParametricMapFunction<TInputImage, TCoordRep>
}
else
{
std::cout<<"EvaluateParam lol2.2"<<std::endl;
m_ProductHeight = this->GetInputImage()->GetLargestPossibleRegion().GetSize()[0] ;
m_ProductWidth = this->GetInputImage()->GetLargestPossibleRegion().GetSize()[1];
}
std::cout<<"EvaluateParam loli"<<std::endl;
// Perform the plane least square estimation
// Perform the plane least square estimation
unsigned int nbRecords = pointSet->GetNumberOfPoints();
const unsigned int coeffRows = m_Coeff.Rows();
const unsigned int coeffCols = m_Coeff.Cols();
......@@ -162,8 +158,8 @@ std::cout<<"EvaluateParam loli"<<std::endl;
vnl_vector<double> b(nbRecords), bestParams(nbCoef);
b.fill(0);
bestParams.fill(0);
std::cout<<"EvaluateParam lolo"<<std::endl;
// Fill the linear system
// Fill the linear system
for (unsigned int i = 0; i < nbRecords; ++i)
{
this->GetPointSet()->GetPoint(i, &point);
......@@ -183,23 +179,22 @@ std::cout<<"EvaluateParam lolo"<<std::endl;
}
}
}
std::cout<<"EvaluateParam lol"<<std::endl;
// Create the linear system
// Create the linear system
std::cout<<a.cols()<<","<<a.rows()<<" === "<<b.size()<<" === "<<bestParams.size()<<std::endl;
vnl_sparse_matrix_linear_system<double> linearSystem(a, b);
std::cout << "EvaluateParam lol =" << std::endl;
// And solve it
// And solve it
vnl_lsqr linearSystemSolver(linearSystem);
std::cout << "EvaluateParam bestParams: " <<bestParams<< std::endl;
linearSystemSolver.minimize(bestParams);
std::cout << "m_Coeff bis: " << coeffCols<< " , " << m_Coeff.Rows() << std::endl;
for (unsigned int xcoeff = 0; xcoeff < coeffCols; ++xcoeff)
{
for (unsigned int ycoeff = 0; ycoeff < coeffRows; ++ycoeff)
{
m_Coeff(ycoeff, xcoeff) = bestParams(xcoeff * coeffRows + ycoeff);
std::cout << "m_Coeff(" << ycoeff << "," << xcoeff << ") = " << m_Coeff(ycoeff, xcoeff) << std::endl;
//std::cout << "m_Coeff(" << ycoeff << "," << xcoeff << ") = " << m_Coeff(ycoeff, xcoeff) << std::endl;
}
}
}
......
......@@ -43,7 +43,6 @@ void
SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
::BeforeThreadedGenerateData()
{
std::cout<<"Before Starts"<<std::endl;
// will SetInputImage on the function
Superclass::BeforeThreadedGenerateData();
......@@ -53,7 +52,7 @@ SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
FunctionPointer function = this->GetFunction();
function->SetScale(imageMetadataInterface->GetRadiometricCalibrationScale());
std::cout<<"Before Starts 1"<<std::endl;
ParametricFunctionPointer noise;
ParametricFunctionPointer antennaPatternNewGain;
ParametricFunctionPointer antennaPatternOldGain;
......@@ -64,7 +63,7 @@ SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
noise->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationNoise());
noise->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationNoisePolynomialDegree());
noise->EvaluateParametricCoefficient();
std::cout<<"Before Starts 2"<<std::endl;
antennaPatternNewGain = function->GetAntennaPatternNewGain();
antennaPatternNewGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGain());
antennaPatternNewGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternNewGainPolynomialDegree());
......@@ -74,21 +73,25 @@ SarRadiometricCalibrationToImageFilter<TInputImage, TOutputImage>
antennaPatternOldGain->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGain());
antennaPatternOldGain->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationAntennaPatternOldGainPolynomialDegree());
antennaPatternOldGain->EvaluateParametricCoefficient();
std::cout<<"Before Starts 3"<<std::endl;
std::cout<<"SarRadiometricCalibrationToImageFilter starts trouble"<<std::endl;
incidenceAngle = function->GetIncidenceAngle();
std::cout<<"function->GetIncidenceAngle():"<<std::endl;
std::cout<<function->GetIncidenceAngle()<<std::endl;
incidenceAngle->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle());
std::cout<<"imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle():"<<std::endl;
std::cout<<imageMetadataInterface->GetRadiometricCalibrationIncidenceAngle()<<std::endl;
incidenceAngle->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationIncidenceAnglePolynomialDegree());
std::cout<<"================================ Before Starts 3.5"<<std::endl;
std::cout<<"imageMetadataInterface->GetRadiometricCalibrationIncidenceAnglePolynomialDegree():"<<std::endl;
std::cout<<imageMetadataInterface->GetRadiometricCalibrationIncidenceAnglePolynomialDegree()<<std::endl;
std::cout<<"SarRadiometricCalibrationToImageFilter trouble passed !!!"<<std::endl;
incidenceAngle->EvaluateParametricCoefficient();
std::cout<<"Before Starts 4"<<std::endl;
rangeSpreadLoss = function->GetRangeSpreadLoss();
rangeSpreadLoss->SetPointSet(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLoss());
rangeSpreadLoss->SetPolynomalSize(imageMetadataInterface->GetRadiometricCalibrationRangeSpreadLossPolynomialDegree());
rangeSpreadLoss->EvaluateParametricCoefficient();
std::cout<<"Before Done"<<std::endl;
}
......
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