Commit 7b56d464 authored by Julien Osman's avatar Julien Osman

WIP: Analyse of a segfault

parent a92b6226
Pipeline #5747 failed with stages
in 91 minutes and 9 seconds
......@@ -116,6 +116,11 @@ struct OTBMetadata_EXPORT GCPParam
*/
struct OTBMetadata_EXPORT RPCParam
{
// Constructors
RPCParam() = default;
RPCParam( const RPCParam & ); // CopyConstructible required for boost::any
Please register or sign in to reply
RPCParam& operator=(RPCParam); //CopyAssignment optional for boost::any
// Offsets
double LineOffset = 0.0;
double SampleOffset = 0.0;
......
......@@ -77,6 +77,49 @@ std::string GCPParam::ToJSON(bool multiline) const
return oss.str();
}
RPCParam::RPCParam( const RPCParam & other )
: LineOffset(other.LineOffset),
SampleOffset(other.SampleOffset),
LatOffset(other.LatOffset),
LonOffset(other.LonOffset),
HeightOffset(other.HeightOffset),
LineScale(other.LineScale),
SampleScale(other.SampleScale),
LatScale(other.LatScale),
LonScale(other.LonScale),
HeightScale(other.HeightScale)
{
for(int i = 0 ; i < 20 ; ++i)
{
LineNum[i] = other.LineNum[i];
LineDen[i] = other.LineDen[i];
SampleNum[i] = other.SampleNum[i];
SampleDen[i] = other.SampleDen[i];
}
}
RPCParam& RPCParam::operator=(RPCParam other)
{
LineOffset = other.LineOffset;
SampleOffset = other.SampleOffset;
LatOffset = other.LatOffset;
LonOffset = other.LonOffset;
HeightOffset = other.HeightOffset;
LineScale = other.LineScale;
SampleScale = other.SampleScale;
LatScale = other.LatScale;
LonScale = other.LonScale;
HeightScale = other.HeightScale;
for(int i = 0 ; i < 20 ; ++i)
{
LineNum[i] = other.LineNum[i];
LineDen[i] = other.LineDen[i];
SampleNum[i] = other.SampleNum[i];
SampleDen[i] = other.SampleDen[i];
}
return *this;
}
std::string RPCParam::ToJSON(bool multiline) const
{
std::ostringstream oss;
......
......@@ -718,7 +718,8 @@ const boost::any& ImageMetadataInterfaceBase::FetchRPC(
coeffs = mds.GetAsVector<double>("RPC/SAMP_DEN_COEFF",' ',20);
std::copy(coeffs.begin(), coeffs.end(), rpcStruct.SampleDen);
m_Imd.Add(MDGeom::RPC, rpcStruct);
boost::any to_append = rpcStruct;
m_Imd.Add(MDGeom::RPC, to_append);
return m_Imd[MDGeom::RPC];
}
......
......@@ -33,6 +33,9 @@ bool RPCTransformBase<TScalarType, NInputDimensions, NOutputDimensions>::SetMeta
return false;
try
{
const boost::any any_rpc = imd[MDGeom::RPC]; //TODO: Segfault here.
if (any_rpc.empty())
return false;
Projection::RPCParam newParam = boost::any_cast<Projection::RPCParam>(imd[MDGeom::RPC]);
this->m_RPCParam = std::make_unique<Projection::RPCParam>(newParam);
}
......
......@@ -198,7 +198,7 @@ void GenericRSResampleImageFilter<TInputImage, TOutputImage>::SetOutputParameter
this->SetOutputStartIndex(src->GetLargestPossibleRegion().GetIndex());
this->SetOutputSize(src->GetLargestPossibleRegion().GetSize());
this->SetOutputProjectionRef(src->GetProjectionRef());
this->SetOutputKeywordList(src->GetImageKeywordlist());
this->GetOutput()->SetImageMetadata(src->GetImageKeywordlist());
}
/**
......@@ -214,7 +214,7 @@ void GenericRSResampleImageFilter<TInputImage, TOutputImage>::SetOutputParameter
this->SetOutputStartIndex(image->GetLargestPossibleRegion().GetIndex());
this->SetOutputSize(image->GetLargestPossibleRegion().GetSize());
this->SetOutputProjectionRef(image->GetProjectionRef());
this->SetOutputKeywordList(image->GetImageKeywordlist());
this->GetOutput()->SetImageMetadata(image->GetImageKeywordlist());
}
/**
......
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