[Insight-users] difference between get and getPixel

pengpeng helloliupengxin at gmail.com
Sun Aug 4 22:17:29 EDT 2013


Dear ITK Friend

I want to get any position pixel value of 3D DICOM volume. 
But when I use iterator.get and getpixel, the results are different. 
The first one reads 179 while the second reads 435. Can anyone help? 
Thanks a lot. 

< iterator code >
              InternalImageType::Pointer imageForI =reader->GetOutput();
              InternalImageType::SizeType regionSize;
              regionSize[0]=1;
              regionSize[1]=1;
              regionSize[2]=1;

              InternalImageType::IndexType regionIndex;
              regionIndex[0]=128;
              regionIndex[1]=128;
              regionIndex[2]=2;

              InternalImageType::RegionType region;
              region.SetSize(regionSize);
              region.SetIndex(regionIndex);

              itk::ImageRegionConstIterator<InternalImageType>
imageIterator(imageForI,region);
              while(!imageIterator.IsAtEnd())
                {
                unsigned char val = imageIterator.Get();
                std::cout <<" Pixel is "<< (int)val << std::endl;
                ++imageIterator;
                }
< end iterator code >
<getpixel code>
             InternalImageType::IndexType pi={128,128,2};
             std::cout<<"pixel is
"<<reader->GetOutput()->GetPixel(pi)<<std::endl;
&lt;end getpixel code>




--
View this message in context: http://itk-users.7.n7.nabble.com/difference-between-get-and-getPixel-tp32048.html
Sent from the ITK - Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list