[Insight-users] rounding an index pointer

john smith mkitkinsightuser at gmail.com
Sun Jun 12 12:32:25 EDT 2011


Hi to all,

I am using a reader to read an image and then pass the reader to a
RescaleIntensityImageFilter, with which I rescale the image from 0 to
255.Then I am using an index type pointer tto get the pixel value, as it
seems bellow:

* InputImageType::Pointer image = filter_rescale->GetOutput();
             InputImageType::IndexType index =
filter_rescale->GetOutput()->GetLargestPossibleRegion().GetIndex();

                           InputImageType::IndexType currentIndex;
                           currentIndex[0] = k2;
                           currentIndex[1] = k1;
                           currentIndex[2] =
ui->verticalScrollBar_z->value();
                           InputImageType::PixelType currentValue =
image->GetPixel(currentIndex);*

But when I get the values of currentIndex, I get for example a value
113.581. I want to know in this case which rounding would be correct, the
113 value or the 114 value.And how I could achieve this rounding?

Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20110612/ee007080/attachment.htm>


More information about the Insight-users mailing list