[vtkusers] re ad a raw file (32-bit signed integers) with vtkImageReader
Orlinn
MeinDatenLaufwerk at googlemail.com
Mon Oct 19 07:41:42 EDT 2009
hello jerome,
i use the data from vtkImageReader show the the MIP (maximum intensity
projection) but i see not the right result. With other raw files it works. i
have to use SetDataScalarTypeToUnsignedShort() or
SetDataScalarTypeToUnsignedChar() because vtkVolumeRayCastMapper can only
render data of type unsigned Short or unsigned char.
i use 32-bit signed integer so i have 4 bytes and i need the last 2 bytes.
but i have no ideas how can cast these data into unsigned Short or unsigned
Char.
thank you
Jérôme-2 wrote:
>
> Hi,
>
> First of all, I thought that unsigned short are 2 bytes integers. Correct
> me
> if I mistake!
> Then, could you give more precision on what doesn't work? Do you get a VTK
> error message, an empty volume, a segfault, or something else?
>
> Best regards,
> Jerome
>
> 2009/10/19 Orlinn <MeinDatenLaufwerk at googlemail.com>
>
>>
>> hello VTK world,
>>
>> i have a raw(32-bit signed integers) file which contains my images.
>> From the 4 bytes i need only the 2 last bytes, i thought i can set a mask
>> like 0x00FF.
>> but it does not work. I use the the class vtkImageReader.
>> When i try with 16 and 8 bit raw files, it works.
>>
>> this is my code
>> vtkImageReader rawreader= new vtkImageReader();
>> rawRedaer.SetFileName("C:/Desktop/rawFile.dat");
>> rawReader.SetDataExtent(0, 511, 0, 511, 0, 249);
>> rawReader.SetDataScalarTypeToUnsignedShort();
>> rawReader.SetDataByteOrderToBigEndian();
>> rawReader.SetFileDimensionality(3);
>> rawReader.SetDataSpacing(0.40234375, 0.40234375, 0.5);
>> rawReader.SetNumberOfScalarComponents(1);
>> rawReader.Update();
>>
>> can somebody tell me what i have to add????
>>
>> sorry for my english and my VTK knowledge
>>
>> thank you
>> --
>> View this message in context:
>> http://www.nabble.com/read-a-raw-file-%2832-bit-signed-integers%29-with-vtkImageReader-tp25956561p25956561.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> 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
>>
>
> _______________________________________________
> 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/read-a-raw-file-%2832-bit-signed-integers%29-with-vtkImageReader-tp25956561p25956898.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list