Skip to content
Snippets Groups Projects
Commit 88ca95e9 authored by Sebastien Harasse's avatar Sebastien Harasse
Browse files

BUG: mean shift. fixed wrong allocation code

parent f9845c8f
No related branches found
No related tags found
No related merge requests found
......@@ -237,6 +237,8 @@ MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIterati
OutputSpatialImagePointerType outSpatialPtr = this->GetSpatialOutput();
OutputImagePointerType outRangePtr = this->GetRangeOutput();
typename InputImageType::ConstPointer inputPtr = this->GetInput();
typename OutputIterationImageType::Pointer iterationOutput = this->GetIterationOutput();
typename OutputSpatialImageType::Pointer spatialOutput = this->GetSpatialOutput();
//InputIndexType index;
......@@ -246,6 +248,17 @@ MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIterati
m_NumberOfComponentsPerPixel = this->GetInput()->GetNumberOfComponentsPerPixel();
// Allocate output images
this->AllocateOutputs();
// Initialize output images to zero
iterationOutput->FillBuffer(0);
OutputSpatialPixelType zero(spatialOutput->GetNumberOfComponentsPerPixel());
zero.Fill(0);
spatialOutput->FillBuffer(zero);
// m_JointImage is the input data expressed in the joint spatial-range
// domain, i.e. spatial coordinates are concatenated to the range values.
// Moreover, pixel components in this image are normalized by their respective
......@@ -537,8 +550,6 @@ MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIterati
{
// at the first iteration
// Allocate output images
this->AllocateOutputs();
// Retrieve output images pointers
typename OutputSpatialImageType::Pointer spatialOutput = this->GetSpatialOutput();
......@@ -563,11 +574,6 @@ MeanShiftSmoothingImageFilter<TInputImage, TOutputImage, TKernel, TOutputIterati
RealVector jointPixel;
// Initialize output images to zero
iterationOutput->FillBuffer(0);
OutputSpatialPixelType zero(spatialOutput->GetNumberOfComponentsPerPixel());
zero.Fill(0);
spatialOutput->FillBuffer(zero);
RealVector bandwidth(jointDimension);
for (unsigned int comp = 0; comp < ImageDimension; comp++) bandwidth[comp] = m_SpatialBandwidth;
......
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