[Insight-users] how to use operator+=(OffsetType)?

Luis Ibanez luis.ibanez at kitware.com
Mon May 25 17:13:45 EDT 2009


Hi Ra,

If you are going to do this systematically
in an image, (that is, if you plan to search
for the diagonal pixel of every pixel), then
you probably should be using the

          NeighborhoodIterator

Please look at the "Image Iterators" chapter
of the ITK Software Guide

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


Otherwise, if you are going to do this in only
one pixel, then the following code will suffice

 ImageType::IndexType  index = iterator.GetIndex();

 ImageType::OffsetType offset;

 offset[0] = 1;
 offset[1] = 1;
 offset[2] = 0;

 index += offset;

 ImageType::PixelType  pixelvalue = image->GetPixel( index );


This second method for accessing pixel values
is a lot slower than using Image Iterators.


   Regards,


        Luis


-------------------------------------------------------------------
On Mon, May 25, 2009 at 3:56 PM, Raquel Itk <raquelitk at gmail.com> wrote:

> Hi,
> I have an iterator and I want to increment it by a specific value because I
> wan to know only the values of the pixel in the diagonal of an DICOM image.
> I want to use *operator*+=(*OffsetType*) but I don't know how I should do.
> My image is 512x512 so I would like an offset of 512.
> Than you in advance
> Ra
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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/20090525/12360a7c/attachment.htm>


More information about the Insight-users mailing list