[vtkusers] Creating a 3D vtkStructuredPoints with a series of bmp images

Thomas Deschamps tdeschamps at lbl.gov
Wed Nov 13 17:28:19 EST 2002


Hi vtkUsers,

I have several bmp images which represent slices of the same volume.
I would like to create a vtkStructuredPoints with all these files, but 
with the following code I obtain a 3D datasets of color data

------------------------------------------------------
vtkBMPReader reader
    reader SetDataByteOrderToLittleEndian;
    reader SetFileDimensionality 2;
    reader SetNumberOfScalarComponents 1;
    reader SetFilePrefix $filePrefix;
    reader SetFilePattern $filePattern
    reader SetFileNameSliceOffset 1
    reader SetDataExtent 0 $xSize 0 $ySize 0 $zSize
    reader SetDataSpacing $pixelWidth $pixelHeight $pixelDepth
    reader Update

vtkImageExtractComponents extract
    extract SetInput [reader GetOutput]
    extract SetComponents 1

vtkImageToStructuredPoints i2sp
    i2sp SetInput [extract GetOutput]

vtkStructuredPointsWriter writer
    writer SetInput [i2sp GetOutput]
    writer SetFileName $outputFileName
    writer SetFileTypeToBinary
    writer Update
------------------------------------------------------

I thaught maybe the vtkImageExtractComponents would b enough.
But at the end the header of my file contains

------------------------------------------------------
# vtk DataFile Version 3.0
vtk output
BINARY
DATASET STRUCTURED_POINTS
DIMENSIONS 326 211 30
SPACING 1 1 1
ORIGIN 0 0 0
CELL_DATA 1979250
POINT_DATA 2063580
COLOR_SCALARS scalars 1  <------------Pb
------------------------------------------------------

Does someone know how to handle that?
Thank you.

Thomas (TDeschamps at lbl.gov)




More information about the vtkusers mailing list