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

WRG : Code review

parent 50263edc
No related branches found
No related tags found
2 merge requests!621Release 7.0 (master),!355Enhance SARConcatenateBursts
......@@ -80,7 +80,7 @@ private:
SetParameterDescription("out", "The concatenated and debursted output image.");
AddParameter(ParameterType_Int, "burstindex", "Index of the first Burst");
SetParameterDescription("burstindex", "Index for the first required Burst (By default 0)");
SetParameterDescription("burstindex", "Index for the first required Burst");
MandatoryOff("burstindex");
SetDefaultParameterInt("burstindex", 0);
......@@ -125,7 +125,7 @@ private:
catch( ... )
{
// Throw an execption
throw std::runtime_error("Failed to retrieve bursts.number value from .geom file.");
otbAppLogFATAL(<< "Failed to retrieve bursts.number value from .geom file.");
}
nbBursts = inList->Size();
......@@ -140,14 +140,13 @@ private:
// Get Invalid pixel Key (from Image 0)
FloatVectorImageType::Pointer Im0 = inList->GetNthElement(0);
Im0->UpdateOutputInformation();
bool inputWithInvalidPixels = false;
if (Im0->GetImageKeywordlist().HasKey("support_data.invalid_pixels"))
{
if (Im0->GetImageKeywordlist().GetMetadataByKey("support_data.invalid_pixels") == "yes")
{
inputWithInvalidPixels = true;
}
}
auto const& kwl = Im0->GetImageKeywordlist();
const bool inputWithInvalidPixels = kwl.HasKey("support_data.invalid_pixels")
&& kwl.GetMetadataByKey("support_data.invalid_pixels") == "yes";
fusionFilter->getDeburstLinesAndSamples(lines, samples, burst_index, inputWithInvalidPixels);
// Split each input burst to keep only interested region
......@@ -156,21 +155,14 @@ private:
FloatVectorImageType::Pointer vectIm = inList->GetNthElement(i);
vectIm->UpdateOutputInformation();
bool inputWithInvalidPixels_loop = false;
// Check invalid Pixel Key
if (vectIm->GetImageKeywordlist().HasKey("support_data.invalid_pixels"))
{
if (vectIm->GetImageKeywordlist().GetMetadataByKey("support_data.invalid_pixels") == "yes")
{
inputWithInvalidPixels_loop = true;
}
}
const bool inputWithInvalidPixels_loop = vectIm->GetImageKeywordlist().HasKey("support_data.invalid_pixels")
&& vectIm->GetImageKeywordlist().GetMetadataByKey("support_data.invalid_pixels") == "yes";
if (inputWithInvalidPixels_loop != inputWithInvalidPixels)
{
// Throw an execption
throw std::runtime_error("Incoherency between input images (for support_data.invalid_pixels key).");
otbAppLogFATAL(<< "Incoherency between input images (for support_data.invalid_pixels key).");
}
unsigned long originOffset_samples = static_cast<long>(vectIm->GetOrigin()[0]-0.5);
......
......@@ -1870,8 +1870,7 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u
if (inputWithInvalidPixels)
{
currentStart_L = itBursts->startLine - counter*theNumberOfLinesPerBurst +
halfLineOverlapBegin[counter];
currentStart_L += itBursts->startLine - counter*theNumberOfLinesPerBurst;
}
unsigned long currentStop_L = itBursts->endLine - itBursts->startLine - halfLineOverlapEnd[counter];
......@@ -1886,15 +1885,18 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u
unsigned long currentStart_S = 0;
unsigned long currentStop_S = samples.second-samples.first;
if (itBursts->startSample < samples.first)
{
currentStart_S = samples.first - itBursts->startSample;
}
if (inputWithInvalidPixels)
{
currentStart_S = samples.first;
}
else
{
if (itBursts->startSample < samples.first)
{
currentStart_S = samples.first - itBursts->startSample;
}
}
currentStop_S += currentStart_S;
samplesBursts.push_back(std::make_pair(currentStart_S, currentStop_S));
......
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