[Insight-users] Reading an image (64 bits program)

Ali Mouizina ali.mouizina at gmail.com
Sun Jan 22 10:09:16 EST 2012


Hi,

 

I started to build ITK with a 64 bits compiler and I'm having a problem when
I read a jpg image. The dimension of my image is 300*225,  but when I try to
read the values of my image I can go further than the image dimension.

 

typedef unsigned char PixelType;

typedef itk::Image<PixelType, 2> ImageType2D;

 

int main(){

 

       typedef itk::ImageFileReader< ImageType2D > ReaderType;

       ReaderType::Pointer reader = ReaderType::New();

 

       const char *inputFilename="tour_b.jpg";

       reader->SetFileName(inputFilename);

       reader->Update();

 

       

       

       ImageType2D::Pointer image=reader->GetOutput();

 

       cout << sizeof(unsigned char) << endl; // -> It displays 1

 

       ImageType2D::IndexType pix;

 

       for (int i=0;i<1000;i++)

             for (int j=0;j<300;j++)

                    {

                           pix[0]=i;

                           pix[1]=j;

                           //pix[2]=k;

                           

                           image->GetPixel(pix);

 

                    }

}

 

Regards,

 

Ali

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120122/f1be8e8a/attachment.htm>


More information about the Insight-users mailing list