<div dir="ltr"><div><div>If your data is 512x512x512 then<br>reader-&gt;SetDataExtent(0,512,0,512,0,512);<br></div>should be:<br>reader-&gt;SetDataExtent(0,511,0,511,0,511);<br><br></div>Also be certain you are setting the correct endianness.<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 9, 2013 at 10:25 AM, Massinissa Bandou <span dir="ltr">&lt;<a href="mailto:Massinissa.Bandou@usherbrooke.ca" target="_blank">Massinissa.Bandou@usherbrooke.ca</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everyone,<br>
<br>
I tried to read a (.raw) file with the following code but it displays a RED<br>
CUBE. Here is some information about my file  dataInfo.txt<br>
&lt;<a href="http://vtk.1045678.n5.nabble.com/file/n5721842/dataInfo.txt" target="_blank">http://vtk.1045678.n5.nabble.com/file/n5721842/dataInfo.txt</a>&gt;  . Is there<br>
something wrong in my code?<br>
<br>
thx for your time and help!<br>
<br>
sorry my file is too large to be send.<br>
<br>
#include &lt;vtkSmartPointer.h&gt;<br>
#include &lt;vtkRenderWindow.h&gt;<br>
#include &lt;vtkRenderWindowInteractor.h&gt;<br>
#include &lt;vtkRenderer.h&gt;<br>
#include &lt;vtkActor&gt;<br>
#include &lt;vtkImageReader&gt;<br>
#include &lt;vtkDataSetMapper&gt;<br>
<br>
int main(int argc, char *argv[])<br>
{<br>
        vtkImageReader *reader = vtkImageReader::New();<br>
        reader-&gt;SetFileName(file.c_str());<br>
        reader-&gt;SetFileDimensionality(3);<br>
        reader-&gt;SetNumberOfScalarComponents(1);<br>
        reader-&gt;SetDataExtent(0,512,0,512,0,512);<br>
        reader-&gt;SetDataSpacing(0.145, 0.145, 0.145);<br>
        reader-&gt;SetDataByteOrderToBigEndian();<br>
        reader-&gt;SetDataScalarTypeToChar();<br>
        reader-&gt;Update();<br>
<br>
        vtkSmartPointer&lt;vtkDataSetMapper&gt; map =<br>
vtkSmartPointer&lt;vtkDataSetMapper&gt;::New();<br>
        map-&gt;SetInputConnection(reader-&gt;GetOutputPort());<br>
<br>
<br>
        vtkSmartPointer&lt;vtkActor&gt; actor = vtkSmartPointer&lt;vtkActor&gt;::New();<br>
        actor-&gt;SetMapper(map);<br>
<br>
        vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; interactor =<br>
vtkSmartPointer&lt;vtkRenderWindowInteractor&gt;::New();<br>
<br>
        vtkSmartPointer&lt;vtkRenderWindow&gt; renderWindow =<br>
vtkSmartPointer&lt;vtkRenderWindow&gt;::New();<br>
        interactor-&gt;SetRenderWindow(renderWindow);<br>
        vtkSmartPointer&lt;vtkRenderer&gt; renderer =<br>
vtkSmartPointer&lt;vtkRenderer&gt;::New();<br>
        renderWindow-&gt;AddRenderer(renderer);<br>
        renderer-&gt;AddActor(actor);<br>
<br>
        renderWindow-&gt;Render();<br>
        interactor-&gt;Start();<br>
}<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/RAW-file-tp5721842.html" target="_blank">http://vtk.1045678.n5.nabble.com/RAW-file-tp5721842.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<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>
</blockquote></div><br><br clear="all"><br>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>