[Insight-users] [new]4-neighbors or 2-neighbors?

Luis Ibanez luis.ibanez at kitware.com
Thu Jul 22 10:01:43 EDT 2004


Hi Martino,

Welcome to ITK !

You will find useful to follow the instructions in
the Welcoming package in order to get introduced to
the fundamental concepts behind the implementation
of ITK.

     http://www.itk.org/HTML/Welcome.htm


For example,
you will find that ITK is mostly N-Dimensional, and that
this influences a lot the writing style of the code.

The function "PushNeighbors" that you are looking at in
the file

     Insight/Code/Algorithms/
       itkSimpleFuzzyConnectednessImageFilterBase.txx

If using a Nearest Neighbors approach in N-Dimensions.

You probably missed to noticed the for() loop that
goes along the ImageDimensions:


> ::PushNeighbors(const IndexType &center)
> {
>   IndexType currentIndex =center;
>     
>   for(unsigned int i = 0; i < ImageDimension; i++)
>     {
>     if( currentIndex[i] < static_cast<typename IndexType::IndexValueType>(m_Size[i])-1)
>       {
>       currentIndex[i]++;
>       m_Queue.push(currentIndex);
>       currentIndex[i]--;
>       }
>   
>     if(currentIndex[i]>0)
>       {
>       currentIndex[i]--;
>       m_Queue.push(currentIndex);
>       currentIndex[i]++;
>       }
>     }
> }


If you examine the code (preferably in the company of a cup of coffee)
you will notice that the for loop is done in such a way that the "left"
and "right" neighbors are added along ALL image dimensions. Therefore
you will get 2 neighbors in 1D, 4 neighbors in 2D, 6 neighbors in 3D,
8 neighbors in 4D, and so on.

The "currentIndex" variable is an N-D index, and it is being used for
constructing the index of the immediate neighbors in all directions.


Details about the background of this algorithm can
be found in the ITK Software Guide:

     http://www.itk.org/ItkSoftwareGuide.pdf



Please let us know if you have further questions.



     Thanks


        Luis



----------------------------------
Martino Gabriele wrote:

> Hi,
> im sorry but my text in last topic was not clear.
> Ive tried to rewrite it.
> Im working with image segmentation and also 
> with itk to tests my alghoritms.
> ive tried to see itk code about fuzzy 
> segmentation and ive found, 
> in itkSimpleFuzzyConnectednessImageFilterBase.txx, 
> a procedure, pushneighbors,
>  in which only the right and left neighbors of current 
> index are filled in a queue.....but hasnt itk 
> used 4-neighbors approch?
> Ive seen there are a lots of alghoritms about 
> fuzzy segmentation and so there are a lots 
> of implementations about fuzzy affinity....
> can you indicate me all this implementation?
> 
> Thanks a lot.
> 
> Bye
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 





More information about the Insight-users mailing list