[vtkusers] 3D volume problem with vtkImageReader reading RAW file

-Daniel- dk-80 at gmx.de
Thu Jun 4 15:02:40 EDT 2009


Hello,

I wrote in my last message
>     reader.SetDataScalarTypeToUnsignedChar();
but the raw format is "16bits unsigned". <Thanks burlen>
Therefore I changed this to:
      reader.SetDataScalarTypeToUnsignedShort();

But that won't solve my case. The result is a colorized cube.
Please look at the attached picture.
http://www.nabble.com/file/p23875911/snapshot_1.jpg snapshot_1.jpg 

Any ideas about a Solution is welcomed, thanks!



-Daniel- wrote:
> 
> Hi all,
> 
> I want to read a 3D raw file (512x512x151) of a head with vtkImageReader. 
> But the result is a cube and this is wrong. It should be a 3D volume.
> Please look at the attached picture.
> 
> information about this raw file:
> 	16bits unsigned 
>         BigEndian
>         min 0 max 4096 (12 bits)
> 	Dimensions: 512x512x151
> 	voxel size: 0.4863 0.4863 1 (mm)
> 
> My java-code is following:
> 	vtkImageReader reader = new vtkImageReader();
> 	reader.SetFileName(file);
> 	reader.SetFileDimensionality(3);
> 	reader.SetDataExtent(0,511,0,511,0,150);
> 	reader.SetDataSpacing(0.4863, 0.4863, 1);
> 	reader.SetDataByteOrderToBigEndian();
> 	reader.SetDataScalarTypeToUnsignedChar();
> 	reader.Update(); 
> 
> 	vtkDataSetMapper map = new vtkDataSetMapper();
> 	map.SetInputConnection(reader.GetOutputPort());
> 
> 
> what's wrong in my code? and how I can create a volume?
> thanks in advance,
> 
> Daniel
> 
> -- 
> GMX FreeDSL mit DSL 6.000 Flatrate und Telefonanschluss nur 17,95
> Euro/mtl.!
> http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a
> 
>  
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 

-- 
View this message in context: http://www.nabble.com/3D-volume-problem-with-vtkImageReader-reading-RAW-file-tp23870080p23875911.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list