Hi again,<br><br>I never used that but it may be what you want: there is a SetDataMask function in vtkImageReader. Try to set it as you want. Then, connect your reader to a vtkImageCast filter. This should do the trick.<br>
<br>HTH,<br>Jerome<br><br><div class="gmail_quote">2009/10/19 Orlinn <span dir="ltr"><<a href="mailto:MeinDatenLaufwerk@googlemail.com">MeinDatenLaufwerk@googlemail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
hello jerome,<br>
<br>
i use the data from vtkImageReader show the the MIP (maximum intensity<br>
projection) but i see not the right result. With other raw files it works. i<br>
have to use SetDataScalarTypeToUnsignedShort() or<br>
SetDataScalarTypeToUnsignedChar() because vtkVolumeRayCastMapper can only<br>
render data of type unsigned Short or unsigned char.<br>
<br>
i use 32-bit signed integer so i have 4 bytes and i need the last 2 bytes.<br>
but i have no ideas how can cast these data into unsigned Short or unsigned<br>
Char.<br>
<br>
thank you<br>
<div><div></div><div class="h5"><br>
<br>
<br>
Jérôme-2 wrote:<br>
><br>
> Hi,<br>
><br>
> First of all, I thought that unsigned short are 2 bytes integers. Correct<br>
> me<br>
> if I mistake!<br>
> Then, could you give more precision on what doesn't work? Do you get a VTK<br>
> error message, an empty volume, a segfault, or something else?<br>
><br>
> Best regards,<br>
> Jerome<br>
><br>
> 2009/10/19 Orlinn <<a href="mailto:MeinDatenLaufwerk@googlemail.com">MeinDatenLaufwerk@googlemail.com</a>><br>
><br>
>><br>
>> hello VTK world,<br>
>><br>
>> i have a raw(32-bit signed integers) file which contains my images.<br>
>> From the 4 bytes i need only the 2 last bytes, i thought i can set a mask<br>
>> like 0x00FF.<br>
>> but it does not work. I use the the class vtkImageReader.<br>
>> When i try with 16 and 8 bit raw files, it works.<br>
>><br>
>> this is my code<br>
>> vtkImageReader rawreader= new vtkImageReader();<br>
>> rawRedaer.SetFileName("C:/Desktop/rawFile.dat");<br>
>> rawReader.SetDataExtent(0, 511, 0, 511, 0, 249);<br>
>> rawReader.SetDataScalarTypeToUnsignedShort();<br>
>> rawReader.SetDataByteOrderToBigEndian();<br>
>> rawReader.SetFileDimensionality(3);<br>
>> rawReader.SetDataSpacing(0.40234375, 0.40234375, 0.5);<br>
>> rawReader.SetNumberOfScalarComponents(1);<br>
>> rawReader.Update();<br>
>><br>
>> can somebody tell me what i have to add????<br>
>><br>
>> sorry for my english and my VTK knowledge<br>
>><br>
>> thank you<br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://www.nabble.com/read-a-raw-file-%2832-bit-signed-integers%29-with-vtkImageReader-tp25956561p25956561.html" target="_blank">http://www.nabble.com/read-a-raw-file-%2832-bit-signed-integers%29-with-vtkImageReader-tp25956561p25956561.html</a><br>
>> Sent from the VTK - Users mailing list archive at Nabble.com.<br>
>><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Please keep messages on-topic and check the VTK FAQ at:<br>
>> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
>><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
<br>
</div></div><font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/read-a-raw-file-%2832-bit-signed-integers%29-with-vtkImageReader-tp25956561p25956898.html" target="_blank">http://www.nabble.com/read-a-raw-file-%2832-bit-signed-integers%29-with-vtkImageReader-tp25956561p25956898.html</a><br>
</font><div><div></div><div class="h5">Sent from the VTK - Users mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br>