Commit 35800ce4 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

REFAC: update MultiDisparityMapTo3DFilter (RPC refactoring)

parent 23478eac
Pipeline #6656 failed with stages
in 80 minutes and 20 seconds
...@@ -156,9 +156,6 @@ protected: ...@@ -156,9 +156,6 @@ protected:
/** Generate input requested region */ /** Generate input requested region */
void GenerateInputRequestedRegion() override; void GenerateInputRequestedRegion() override;
/** Before threaded generate data */
void BeforeThreadedGenerateData() override;
/** Threaded generate data */ /** Threaded generate data */
void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override; void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
...@@ -166,12 +163,6 @@ private: ...@@ -166,12 +163,6 @@ private:
MultiDisparityMapTo3DFilter(const Self&) = delete; MultiDisparityMapTo3DFilter(const Self&) = delete;
void operator=(const Self&) = delete; void operator=(const Self&) = delete;
/** Reference sensor image transform */
RSTransformType::Pointer m_ReferenceToGroundTransform;
/** Moving sensor image transforms */
std::vector<RSTransformType::Pointer> m_MovingToGroundTransform;
/** ImageMetadata of reference sensor image */ /** ImageMetadata of reference sensor image */
const ImageMetadata* m_ReferenceImageMetadata = nullptr; const ImageMetadata* m_ReferenceImageMetadata = nullptr;
......
...@@ -278,28 +278,26 @@ void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TRes ...@@ -278,28 +278,26 @@ void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TRes
} }
template <class TDisparityImage, class TOutputImage, class TMaskImage, class TResidueImage> template <class TDisparityImage, class TOutputImage, class TMaskImage, class TResidueImage>
void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TResidueImage>::BeforeThreadedGenerateData() void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TResidueImage>::ThreadedGenerateData(const RegionType& outputRegionForThread,
{ itk::ThreadIdType itkNotUsed(threadId))
// Instantiate all transforms { // Instantiate all transforms
this->m_ReferenceToGroundTransform = RSTransformType::New(); auto referenceToGroundTransform = RSTransformType::New();
this->m_ReferenceToGroundTransform->SetInputImageMetadata(this->m_ReferenceImageMetadata); referenceToGroundTransform->SetInputImageMetadata(this->m_ReferenceImageMetadata);
this->m_ReferenceToGroundTransform->InstantiateTransform(); referenceToGroundTransform->InstantiateTransform();
/** Moving sensor image transforms */
std::vector<RSTransformType::Pointer> movingToGroundTransform;
this->m_MovingToGroundTransform.clear();
for (unsigned int k = 0; k < this->m_MovingImageMetadatas.size(); ++k) for (unsigned int k = 0; k < this->m_MovingImageMetadatas.size(); ++k)
{ {
RSTransformType::Pointer transfo = RSTransformType::New(); RSTransformType::Pointer transfo = RSTransformType::New();
transfo->SetInputImageMetadata(this->m_MovingImageMetadatas[k]); transfo->SetInputImageMetadata(this->m_MovingImageMetadatas[k]);
transfo->InstantiateTransform(); transfo->InstantiateTransform();
this->m_MovingToGroundTransform.push_back(transfo); movingToGroundTransform.push_back(transfo);
} }
}
template <class TDisparityImage, class TOutputImage, class TMaskImage, class TResidueImage>
void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TResidueImage>::ThreadedGenerateData(const RegionType& outputRegionForThread,
itk::ThreadIdType itkNotUsed(threadId))
{
TOutputImage* outputPtr = this->GetOutput(); TOutputImage* outputPtr = this->GetOutput();
TResidueImage* residuePtr = this->GetResidueOutput(); TResidueImage* residuePtr = this->GetResidueOutput();
...@@ -359,10 +357,11 @@ void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TRes ...@@ -359,10 +357,11 @@ void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TRes
currentPoint[0] = pointRef[0]; currentPoint[0] = pointRef[0];
currentPoint[1] = pointRef[1]; currentPoint[1] = pointRef[1];
currentPoint[2] = altiMax; currentPoint[2] = altiMax;
pointA = this->m_ReferenceToGroundTransform->TransformPoint(currentPoint);
pointA = referenceToGroundTransform->TransformPoint(currentPoint);
currentPoint[2] = altiMin; currentPoint[2] = altiMin;
pointB = this->m_ReferenceToGroundTransform->TransformPoint(currentPoint); pointB = referenceToGroundTransform->TransformPoint(currentPoint);
pointSetA->SetPoint(0, pointA); pointSetA->SetPoint(0, pointA);
pointSetB->SetPoint(0, pointB); pointSetB->SetPoint(0, pointB);
...@@ -389,9 +388,9 @@ void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TRes ...@@ -389,9 +388,9 @@ void MultiDisparityMapTo3DFilter<TDisparityImage, TOutputImage, TMaskImage, TRes
} }
currentPoint[2] = altiMax; currentPoint[2] = altiMax;
pointAi = this->m_MovingToGroundTransform[k]->TransformPoint(currentPoint); pointAi = movingToGroundTransform[k]->TransformPoint(currentPoint);
currentPoint[2] = altiMin; currentPoint[2] = altiMin;
pointBi = this->m_MovingToGroundTransform[k]->TransformPoint(currentPoint); pointBi = movingToGroundTransform[k]->TransformPoint(currentPoint);
pointSetA->SetPoint(nbPoints, pointAi); pointSetA->SetPoint(nbPoints, pointAi);
pointSetB->SetPoint(nbPoints, pointBi); pointSetB->SetPoint(nbPoints, pointBi);
pointSetA->SetPointData(nbPoints, k + 1); pointSetA->SetPointData(nbPoints, k + 1);
......
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