[vtkusers] (Fwd) Fw: Question of reading CT and MRI data with vtkImageRea
Lisa Sobierajski Avila
lisa.avila at kitware.com
Fri Oct 5 22:13:37 EDT 2001
Hello,
It looks like you should have
reader->SetDataScalarTypeToShort();
An integer is four bytes in VTK, a short is 2.
Lisa
At 12:10 PM 10/4/2001, Jianlong Zhou wrote:
>----- Original Message -----=20
>From: zhangzhijun=20
>To: vtkusers at public.kitware.com=20
>Sent: Thursday, October 04, 2001 11:44 PM
>Subject: Question of reading CT and MRI data with vtkImageReader!
>
>
>
>I have a CT data set file. It is a binary file . it has a header file =
>where the parameters are setted there.=20
>and in the binary file there is only raw data which is stored one voxel =
>by one voxel.and every voxel is=20
>represented by a two-byte two's complement integers. I tried to read =
>this file but there is=20
>always some error prompt like this:
>
>Debug: In C:\vtk\vtk32\vtksrc\imaging\vtkImageReader.cxx, line 570
>vtkImageReader (0x007F5EE0): Initialize: opening file =
>D:/regdata/ct/head.bin
>
>Generic Warning: In C:\vtk\vtk32\vtksrc\imaging\vtkImageReader.cxx, line =
>762
>File operation failed. row =3D 0, Read =3D 2048, Skip0 =3D -4096, Skip1 =
>=3D 2097152, FilePos =3D 15726592
>
>The code I used like this:
> vtkImageReader *reader=3DvtkImageReader::New();
> reader->DebugOn();
> reader->SetFileName("D:/regdata/patient_001/ct/image.bin");
> reader->SetFileDimensionality(3);
> =
>reader->SetDataExtent(0,511,0,511,1,28);//(0,255,0,255,1,26);//(0,255,0,2=
>55,1,26);//
> reader->SetDataOrigin(0,0,0);
> reader->SetDataScalarTypeToInt();
> reader->SetDataMask(0x7fff);
> reader->SetDataSpacing(0.653595,0.653595,4);
> reader->SetDataByteOrderToBigEndian(); =20
> reader->SetHeaderSize(0);
>
>can you give me some hints about this?
>Thank you very much.
>
>regards,
>zj zhang
>
>
>------- End of forwarded message -------
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list