[vtkusers] vtk structure

Peter F Bradshaw pfb at exadios.com
Mon Jun 23 04:02:38 EDT 2008


Hi;

On Thu, 19 Jun 2008 mmavila at unex.es wrote:

>
> Hi,
> I have got several 512x512 images in a folder, and I load all of them by
> means of vtkJPEGReader. After that, I build a three-dimensional image,
> using these simple images:
>
>   vtkJPEGReader *Image = vtkJPEGReader::New();
>   Image->SetFilePrefix("../../Imagenes/MR00");
>   Image->SetFilePattern("%s%i.jpg");
>   Image->SetFileDimensionality(3);
>   Image->SetDataExtent(0, 512, 0, 512, 40,55 );
>   Image->SetDataOrigin(0,0,0);
>   Image->SetDataScalarTypeToUnsignedChar();
>   Image->SetDataSpacing(1, 1,2);
>   Image->Update();
>
> Totally, I have got 16 images. The gap between each pair of them (slice
> thickness) is about 2 pixels. So, (1 image + 2 pixel) x 16 images = 48 – 2
> (last gap) = 46 in the Z-axis. I use the following code to build the
> 3D-image (using interpolation):
>
>   vtkVolumeProperty *vp = vtkVolumeProperty::New();
>   vp->SetColor(colTransFunc);
>   vp->SetScalarOpacity(opaTransFunc);
>   vp->ShadeOn();
>   vp->SetInterpolationTypeToLinear();
>
> I suppose the result is a 512 x 512 x 46 matrix.
> How can I read / write data from this final matrix?
> What is the best structure to deal with this matrix?

I am not sure but I think you can write the data from Image using
vtkStructuredPointsWriter.

Other than that it seems that the only other method is to get the data
by:

vtkImageData *imageData = Image->GetOutput();

write the data yourself by interrogating imageData;

>
> Thanks in advance!!
>

Cheers

-- 
Peter F Bradshaw: http://www.exadios.com (public keys avaliable there).
Personal site: http://personal.exadios.com
"I love truth, and the way the government still uses it occasionally to
 keep us guessing." - Sam Kekovich.



More information about the vtkusers mailing list