Re: [Insight-users] NthElementImageAdaptor and ImageRegionIterators

Tomáš Kazmar Tomash.Kazmar at seznam.cz
Thu May 24 04:04:51 EDT 2007


Thank you for your response.


# It is a long story, but it comes down to the fact that
# the IteratorsWithIndex provide better support for
# image adaptors than the other iterators.

I am starting to understand this, have been searching through the source for
iterators, adaptors and pixel accessors. I see a difference between the two
types of iterators, eg. their Set methods:

  void Set( const PixelType & value) const  
    { 
    this->m_PixelAccessorFunctor.Set(*(const_cast<InternalPixelType *>(
            this->m_Buffer+this->m_Offset)),value); 
    }

and

  void Set( const PixelType & value) const  
    { this->m_PixelAccessorFunctor.Set(*(const_cast<InternalPixelType *>(this->m_Position)),value); }

A reason why the former one does not set value correctly while the latter does
is not clear to me. The only thing that i came upon is that the first one passes
a wrong address to pixel accessor (But somehow it must be still inside
allocated memory, it does not segfault, all use it afterall and immediately after
Set i can get the same value from Get).

But still i do not completely understand why one type of iterators should
behave differently, nevermind, i'll keep reading the sources.



# You may want to read the chapter on Image Iterators
# in the ITK Software Guide
I have read it before and continue to read it while i use the toolkit. And maybe
it can be improved in the following, it says adaptors do no work with Value()
but there is no such warning concerning the Set() method (p.705):


  in the image. The disadvantage of using Value is that it cannot support image adapters (see
  Section 12 on page 745 for more information about image adaptors).



# What was your motivation for changing the Iterators ?
Did not have any real motivation;) tried to understand the code, how it works.


Regards,

Tomas


More information about the Insight-users mailing list