[vtkusers] How get Binary data of vtkimagedata.

Francois Louis LAILLIER flaillier at eldim.fr
Tue Mar 27 04:39:19 EDT 2007


Thanks' David for your help.

I want to put the data in non Vtk Object like a list or array, if
possible, by using a double for boucle.

Example:

For (i=0 to length)
	For (j=0 to height)
		Array(i,j)=DATAARRAY(x,y) // How do that.
	J++
I++

Array it is non Vtk object.

Thanks' for your future help!

Best regards, Francois Louis.












-----Original Message-----
From: David Gobbi [mailto:david.gobbi at gmail.com] On Behalf Of David
Gobbi
Sent: lundi 26 mars 2007 15:38
To: Francois Louis LAILLIER
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] How get Binary data of vtkimagedata.

Hi Francois,

The vtkImageWriter will write an image as a raw binary file. Depending 
on what software you will use to read the .bin image, you might have to 
use vtkImageShiftScale to convert the data to the correct scalar type 
(unsigned char, short, unsigned short) before you write the data with 
vtkImageWriter.

To access the data directly without writing it to disk, you can use
this:

// "image" is a vtkImageData
image->Update();
vtkDataArray *array = image->GetPointData()->GetScalars();

This will give you the vtkDataArray that contains all of the voxel
values.

In vtkImageData, the pixel values are associated with the "points" in 
the data set. The "CellData" is never used in a vtkImageData.

- David


Francois Louis LAILLIER wrote:
>
> Hello everybody.
>
> I have a vtkimagedata,with data of a slice.
>
> I want extract binary data, to put it in .bin files to read with other

> procedure.
>
> Maybe I can extract celldata, but I don't find document for the 
> function Copydata.....
>
> If you have other solution, can you help me please?
>
> Thanks in advance,
>
> Best regards, Francois Louis
>
>
------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   




More information about the vtkusers mailing list