[Insight-users] fast_tracking() functin of
VectorFuzzyConnectednessImageFilter()
陵 邱
oliveqiu2004 at yahoo.com.cn
Wed Jul 6 03:46:11 EDT 2005
hi:
this function is a member of VectorFuzzyConnectednessImageFilter.txx,
my question is :
is this function used to compute the fuzzyconnectedness object of each voxels in the image?is this equall to the Algotithms kVMRFOE in paper
"Vectorial scale-based fuzzy connected image segmentation"?
program code is as followed:
template <class TInputImage, class TOutputImage>
void
VectorFuzzyConnectednessImageFilter<TInputImage,TOutputImage>
::Fast_Tracking(const int object)
{
std::vector<ListSeedType> chash;
typename ListSeedType::iterator iter;
IndexType current,max_index,index1,index2;
AffinityVector vectorValue;
unsigned short topIndex = 4096;
ImageRegionConstIterator<AffinityImageType> it;
it = ImageRegionConstIterator<AffinityImageType>(m_AffinityImage,m_AffinityImage->GetRequestedRegion());
chash.resize(topIndex+1);
for(int i=0;i<=topIndex;i++)
chash[i].clear();
unsigned short initialValue=0;
m_FuzzyConnImage->FillBuffer( initialValue );
/** object tracking...*/
while(!m_ObjectSeeds[object].empty())
{
current = m_ObjectSeeds[object].back();
m_ObjectSeeds[object].pop_back();
m_FuzzyConnImage->SetPixel(current,topIndex);
chash[topIndex].push_front(current);
}
SizeType size;
size = m_AffinityImage->GetLargestPossibleRegion().GetSize();
for(int i = 0;i<static_cast<int>(ImageDimension);i++)
{
max_index[i] = static_cast<typename IndexType::IndexValueType>(size[i])-1;
}
while((topIndex>0) && (chash[topIndex].size() !=0))
{
current = chash[topIndex].back();
chash[topIndex].pop_back();
while((topIndex>0) && (chash[topIndex].size() == 0))
{
topIndex--;
}
unsigned short pmax,pmin,dimensionValue;
pmax = m_FuzzyConnImage->GetPixel(current);
for(unsigned int i = 0;i<ImageDimension;i++)
{
index1 = current;
if(index1[i] < max_index[i])
{
index1[i]++;
vectorValue = m_AffinityImage->GetPixel(current);
dimensionValue = (vectorValue[i]);
pmin = (pmax < dimensionValue ? pmax: dimensionValue);
unsigned short value = m_FuzzyConnImage->GetPixel(index1);
if (pmin > value)
{
if (value == 0)
{
chash[pmin].push_front(index1);
}
else
{
for( iter = chash[value].begin();iter !=chash[value].end();iter++)
{
index2 = *iter;
if(index2 == index1)
{
chash[value].erase(iter);
break;
}
}
chash[pmin].push_front(index1);
}
if (pmin>topIndex)
{topIndex = pmin;}
m_FuzzyConnImage->SetPixel(index1,pmin);
}
}
index1 = current;
if(index1[i]>0)
{
index1[i]--;
vectorValue = m_AffinityImage->GetPixel(index1);
dimensionValue = vectorValue[i];
pmin = (pmax < dimensionValue ? pmax: dimensionValue);
unsigned short value = m_FuzzyConnImage->GetPixel(index1);
if (pmin > value)
{
if (value == 0)
{
chash[pmin].push_front(index1);
}
else
{
for( iter = chash[value].begin();iter !=chash[value].end();iter++)
{
index2 = *iter;
if(index2 == index1)
{
chash[value].erase(iter);
break;
}
}
chash[pmin].push_front(index1);
}
if (pmin>topIndex)
{topIndex = pmin;}
m_FuzzyConnImage->SetPixel(index1,pmin);
}
}
}
}
}
---------------------------------
DO YOU YAHOO!?
雅虎邮箱超强增值服务-2G超大空间、pop3收信、无限量邮件提醒
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050706/e9c48ca2/attachment.htm
More information about the Insight-users
mailing list