[vtkusers] problems with vtkImageReader reading RAW data

Veelion Chong veelion at gmail.com
Thu Apr 20 09:55:46 EDT 2006


Hi, dear all,

I want to read raw data(3D) which is skull.raw(128x128x69). I have tried
vtkImageReader, but the result is wrong. my code is following:


vtkImageReader *RawReader = vtkImageReader::New();
            RawReader->SetFileDimensionality(3);
            RawReader->SetFileName("skull.raw");
    //        RawReader->SetNumberOfScalarComponents(1);
            RawReader->SetDataExtent(0, 127, 0, 127, 0, 68);
            RawReader->SetHeaderSize(headersize);
            RawReader->SetDataByteOrderToLittleEndian();
            RawReader->SetDataScalarTypeToUnsignedShort();
//            RawReader->SetDataOrigin(0,0,0);
            RawReader->SetDataSpacing(spacing_x, spacing_y, spacing_z);
            RawReader->Update();
and when it be run, it gived a warning:
Generic Warning: In E:\WorkSation\VtkWork\new_down_VTK\vtk-
5.0.0\IO\vtkImageReader.cxx, line 313
File operation failed. row = 0, Tried to Read = 256, Read = 0, Skip0 = -512,
Skip1 = 65536, FilePos = 1146624

but the raw data had been read in to memery, but the rendering result is
very wrong!!! the skull.raw data is  only a skull, but the rendering result
of data read in my way(with vtkImageReader) is 4 small skull on a white
cube. why?

who can help? Thanks
Best Regards

--
veelion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060420/88b02dd0/attachment.htm>


More information about the vtkusers mailing list