Skip to content
Snippets Groups Projects
Commit 35c9f3a3 authored by Jordi Inglada's avatar Jordi Inglada
Browse files

BUG: wrong logic on the threshold for isolated

parent d49648cb
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ typename NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage,
//Get a histogram of label frequencies where the 2 highest are at the beginning and sorted
unsigned int freqCenterLabel = this->FillNeighborhoodHistogram(histoNeighVec, nit, kernelBegin, kernelEnd);
if(m_OnlyIsolatedPixels && freqCenterLabel < m_IsolatedThreshold)
if(m_OnlyIsolatedPixels && freqCenterLabel > m_IsolatedThreshold)
{
//If we want to filter only isolated pixels, keep the label if
//there are enough pixels with the center label to consider that
......@@ -70,23 +70,25 @@ typename NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage,
}
else
{
//Extraction of the more representative Label in the neighborhood (majorityLabel) and its Frequency (majorityFreq)
majorityFreq = histoNeighVec[0].second; //Frequency
majorityLabel = histoNeighVec[0].first; //Label
//If the majorityLabel is NOT unique in the neighborhood
if(histoNeighVec[1].second == majorityFreq && histoNeighVec[1].first != majorityLabel)
//Extraction of the more representative Label in the neighborhood (majorityLabel) and its Frequency (majorityFreq)
majorityFreq = histoNeighVec[0].second; //Frequency
majorityLabel = histoNeighVec[0].first; //Label
//If the majorityLabel is NOT unique in the neighborhood
if(histoNeighVec[1].second == majorityFreq && histoNeighVec[1].first != majorityLabel)
{
if (m_KeepOriginalLabelBool == true)
{
majorityLabel = centerPixel;
}
else
{
if (m_KeepOriginalLabelBool == true)
{
majorityLabel = centerPixel;
}
else
{
majorityLabel = m_LabelForUndecidedPixels;
}
majorityLabel = m_LabelForUndecidedPixels;
}
}
}
}//END if (centerPixel != m_LabelForNoDataPixels)
//If (centerPixel == m_LabelForNoDataPixels)
......
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