Commit 52d39687 authored by Gaëlle USSEGLIO's avatar Gaëlle USSEGLIO

WRG : Code review

parent 50263edc
...@@ -80,7 +80,7 @@ private: ...@@ -80,7 +80,7 @@ private:
SetParameterDescription("out", "The concatenated and debursted output image."); SetParameterDescription("out", "The concatenated and debursted output image.");
AddParameter(ParameterType_Int, "burstindex", "Index of the first Burst"); 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"); MandatoryOff("burstindex");
SetDefaultParameterInt("burstindex", 0); SetDefaultParameterInt("burstindex", 0);
...@@ -125,7 +125,7 @@ private: ...@@ -125,7 +125,7 @@ private:
catch( ... ) catch( ... )
{ {
// Throw an execption // 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(); nbBursts = inList->Size();
...@@ -140,14 +140,13 @@ private: ...@@ -140,14 +140,13 @@ private:
// Get Invalid pixel Key (from Image 0) // Get Invalid pixel Key (from Image 0)
FloatVectorImageType::Pointer Im0 = inList->GetNthElement(0); FloatVectorImageType::Pointer Im0 = inList->GetNthElement(0);
Im0->UpdateOutputInformation(); Im0->UpdateOutputInformation();
bool inputWithInvalidPixels = false;
if (Im0->GetImageKeywordlist().HasKey("support_data.invalid_pixels")) auto const& kwl = Im0->GetImageKeywordlist();
{
if (Im0->GetImageKeywordlist().GetMetadataByKey("support_data.invalid_pixels") == "yes") const bool inputWithInvalidPixels = kwl.HasKey("support_data.invalid_pixels")
{ && kwl.GetMetadataByKey("support_data.invalid_pixels") == "yes";
inputWithInvalidPixels = true;
}
}
fusionFilter->getDeburstLinesAndSamples(lines, samples, burst_index, inputWithInvalidPixels); fusionFilter->getDeburstLinesAndSamples(lines, samples, burst_index, inputWithInvalidPixels);
// Split each input burst to keep only interested region // Split each input burst to keep only interested region
...@@ -156,21 +155,14 @@ private: ...@@ -156,21 +155,14 @@ private:
FloatVectorImageType::Pointer vectIm = inList->GetNthElement(i); FloatVectorImageType::Pointer vectIm = inList->GetNthElement(i);
vectIm->UpdateOutputInformation(); vectIm->UpdateOutputInformation();
bool inputWithInvalidPixels_loop = false;
// Check invalid Pixel Key // Check invalid Pixel Key
if (vectIm->GetImageKeywordlist().HasKey("support_data.invalid_pixels")) const bool inputWithInvalidPixels_loop = vectIm->GetImageKeywordlist().HasKey("support_data.invalid_pixels")
{ && vectIm->GetImageKeywordlist().GetMetadataByKey("support_data.invalid_pixels") == "yes";
if (vectIm->GetImageKeywordlist().GetMetadataByKey("support_data.invalid_pixels") == "yes")
{
inputWithInvalidPixels_loop = true;
}
}
if (inputWithInvalidPixels_loop != inputWithInvalidPixels) if (inputWithInvalidPixels_loop != inputWithInvalidPixels)
{ {
// Throw an execption // 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); 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 ...@@ -1870,8 +1870,7 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u
if (inputWithInvalidPixels) if (inputWithInvalidPixels)
{ {
currentStart_L = itBursts->startLine - counter*theNumberOfLinesPerBurst + currentStart_L += itBursts->startLine - counter*theNumberOfLinesPerBurst;
halfLineOverlapBegin[counter];
} }
unsigned long currentStop_L = itBursts->endLine - itBursts->startLine - halfLineOverlapEnd[counter]; unsigned long currentStop_L = itBursts->endLine - itBursts->startLine - halfLineOverlapEnd[counter];
...@@ -1886,15 +1885,18 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u ...@@ -1886,15 +1885,18 @@ ossimSarSensorModel::deburstAndConcatenate(std::vector<std::pair<unsigned long,u
unsigned long currentStart_S = 0; unsigned long currentStart_S = 0;
unsigned long currentStop_S = samples.second-samples.first; unsigned long currentStop_S = samples.second-samples.first;
if (itBursts->startSample < samples.first)
{
currentStart_S = samples.first - itBursts->startSample;
}
if (inputWithInvalidPixels) if (inputWithInvalidPixels)
{ {
currentStart_S = samples.first; currentStart_S = samples.first;
} }
else
{
if (itBursts->startSample < samples.first)
{
currentStart_S = samples.first - itBursts->startSample;
}
}
currentStop_S += currentStart_S; currentStop_S += currentStart_S;
samplesBursts.push_back(std::make_pair(currentStart_S, currentStop_S)); samplesBursts.push_back(std::make_pair(currentStart_S, currentStop_S));
......
Markdown is supported
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