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">&lt;<a href="mailto:MeinDatenLaufwerk@googlemail.com">MeinDatenLaufwerk@googlemail.com</a>&gt;</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>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; First of all, I thought that unsigned short are 2 bytes integers. Correct<br>
&gt; me<br>
&gt; if I mistake!<br>
&gt; Then, could you give more precision on what doesn&#39;t work? Do you get a VTK<br>
&gt; error message, an empty volume, a segfault, or something else?<br>
&gt;<br>
&gt; Best regards,<br>
&gt; Jerome<br>
&gt;<br>
&gt; 2009/10/19 Orlinn &lt;<a href="mailto:MeinDatenLaufwerk@googlemail.com">MeinDatenLaufwerk@googlemail.com</a>&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; hello VTK world,<br>
&gt;&gt;<br>
&gt;&gt; i have a raw(32-bit signed integers) file which contains my images.<br>
&gt;&gt; From the 4 bytes i need only the 2 last bytes, i thought i can set a mask<br>
&gt;&gt; like 0x00FF.<br>
&gt;&gt; but it does not work. I use the the class vtkImageReader.<br>
&gt;&gt; When i try with 16 and 8 bit raw files, it works.<br>
&gt;&gt;<br>
&gt;&gt; this is my code<br>
&gt;&gt;                vtkImageReader rawreader= new vtkImageReader();<br>
&gt;&gt;                rawRedaer.SetFileName(&quot;C:/Desktop/rawFile.dat&quot;);<br>
&gt;&gt;                rawReader.SetDataExtent(0, 511, 0, 511, 0, 249);<br>
&gt;&gt;                rawReader.SetDataScalarTypeToUnsignedShort();<br>
&gt;&gt;                rawReader.SetDataByteOrderToBigEndian();<br>
&gt;&gt;                rawReader.SetFileDimensionality(3);<br>
&gt;&gt;                rawReader.SetDataSpacing(0.40234375, 0.40234375, 0.5);<br>
&gt;&gt;                rawReader.SetNumberOfScalarComponents(1);<br>
&gt;&gt;                rawReader.Update();<br>
&gt;&gt;<br>
&gt;&gt; can somebody tell me what i have to add????<br>
&gt;&gt;<br>
&gt;&gt; sorry for my english and my VTK knowledge<br>
&gt;&gt;<br>
&gt;&gt; thank you<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <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>

&gt;&gt; Sent from the VTK - Users mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;<br>
&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;<br>
&gt;&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt;&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;&gt;<br>
&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<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>