diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h index 075ecf3c711716d58d072d7ac195954692d33203..009462af47680c6516d562bc1cd3bb15eb1f2d93 100644 --- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h +++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.h @@ -175,10 +175,8 @@ protected: struct HistoSummary { unsigned int freqCenterLabel; - unsigned int majorityFreq; PixelType majorityLabel; - unsigned int secondFreq; - PixelType secondLabel; + bool majorityUnique; }; struct CompareHistoFequencies diff --git a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx index 3154646ea22ea50df0d368858224f1155af9cd51..9c4de263463dfb2ace173423bc4bc19dd5c05253 100644 --- a/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx +++ b/Modules/Fusion/MajorityVoting/include/otbNeighborhoodMajorityVotingImageFilter.txx @@ -72,8 +72,7 @@ NeighborhoodMajorityVotingImageFilter<TInputImage, else { //If the majorityLabel is NOT unique in the neighborhood - if(histoSummary.secondFreq == histoSummary.majorityFreq && - histoSummary.secondLabel != histoSummary.majorityLabel) + if(!histoSummary.majorityUnique) { if (m_KeepOriginalLabelBool == true) { @@ -123,10 +122,8 @@ NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage, typename NeighborhoodMajorityVotingImageFilter<TInputImage, TOutputImage, TKernel>::HistoSummary result; result.freqCenterLabel = histoNeigh[nit.GetCenterPixel()]; - result.majorityFreq = histoNeighVec[0].second; result.majorityLabel = histoNeighVec[0].first; - result.secondFreq = histoNeighVec[1].second; - result.secondLabel = histoNeighVec[1].first; + result.majorityUnique = (histoNeighVec[0].second != histoNeighVec[1].second); return result; }