[Insight-users] 'and/or' operation between images

Dženan Zukić dzenanz at gmail.com
Tue Aug 9 16:15:29 EDT 2011


Well, AND <http://www.itk.org/Doxygen/html/classitk_1_1AndImageFilter.html>and
OR <http://www.itk.org/Doxygen/html/classitk_1_1OrImageFilter.html> image
filters already exist. Is this what you were looking for?

On Tue, Aug 9, 2011 at 18:06, iamrndm b <arindam.osu.cse at gmail.com> wrote:

> hi all ,
> I am writing  a simple filter where I need to be able to do 'and' 'or'
> operation between 2 binary images , I am reading in to images into 'image'
> and iterating through using a very simple
>
> //
> template<class TImage>
> void OilPaintingImageFilter<TImage>
> ::ThreadedGenerateData(const typename Superclass::OutputImageRegionType&
> outputRegionForThread,
> int threadId)
> {
>   cerr <<" thread id " <<  threadId << endl;
>
>   typename TImage::ConstPointer input1 = this->GetInput(0);
>    typename TImage::ConstPointer input2 = this->GetInput(1);
>   typename TImage::Pointer output = this->GetOutput();
>
>
>   itk::ImageRegionIterator<TImage> outputIterator(output,
> outputRegionForThread);
>   itk::ImageRegionConstIterator<TImage> inputIterator1(input1,
> outputRegionForThread);
>   itk::ImageRegionConstIterator<TImage> inputIterator2(input2,
> outputRegionForThread);
>
>   while(!outputIterator.IsAtEnd())
>     {
>    // if(inputIterator1.GetIndex()[0] == inputIterator2.GetIndex()[1])
>    // if(inputIterator1.GetIndex()[0] == inputIterator2.GetIndex()[0])
>     if(inputIterator1.Get() == inputIterator2.Get())
>       {
>       outputIterator.Set(255);
>       }
>     else
>       {
>       outputIterator.Set(128);
>       }
>
>     ++inputIterator1;
>     ++inputIterator2;
>     ++outputIterator;
>     }
>  }
> }
> //
>
> My question is is there and easier way  of reading the entire image into a
> VECTOR and just do a 'and/or'  operation on the entire vector.
>
> Thanks
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110809/9fa6b526/attachment.htm>


More information about the Insight-users mailing list