[ITK] new starter

Gib Bogle g.bogle at auckland.ac.nz
Mon May 4 01:43:56 EDT 2015


Hi Michael,

It may not be strictly approved of, because it breaks the object model of ITK, but this is what I do for 8-bit 3D images:

typedef itk::Image<unsigned char,3> ImageType;
ImageType::Pointer im;
unsigned char *p;
long long width, height, depth, xysize;

#define V(a,b,c)  p[(c)*xysize+(b)*width+(a)]

...

    im = reader->GetOutput();
    width = im->GetLargestPossibleRegion().GetSize()[0];
    height = im->GetLargestPossibleRegion().GetSize()[1];
    depth = im->GetLargestPossibleRegion().GetSize()[2];
    xysize = width*height;
    printf("Image dimensions: width, height, depth: %d %d %d\n",width,height,depth);
    p = (unsigned char *)(im->GetBufferPointer());

Then I access the voxel at (x,y,z) by val = V(x,y,z)

Cheers
Gib
________________________________
From: Community [community-bounces at itk.org] on behalf of Michael Yonghui Fan [fhjfyh at hotmail.com]
Sent: Monday, 4 May 2015 5:00 p.m.
To: community at itk.org
Subject: Re: [ITK] new starter

correction. how to store the pixels in a 2-D array?

________________________________
From: fhjfyh at hotmail.com
To: community at itk.org
Date: Mon, 4 May 2015 11:36:35 +0800
Subject: [ITK] new starter

Hi all,

I'm new in using GDCM, i cannot figure it out what should I do after reading image. What I want to do is to read in a dicom image, do the low-pass filter and then write the result image. it is quite basic but i just dont know how to access to the pixel value and also the buffer. Can anyone give me some tips or examples? Thanks a lot~

M

_______________________________________________ Community mailing list Community at itk.org http://public.kitware.com/mailman/listinfo/community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150504/35aef3a7/attachment.html>


More information about the Community mailing list