<div dir="ltr">It looks like you are casting the array pointer to a double array. Are your values actually stored in doubles? Your expected range of [0, 255] suggests they would actually be stored as unsigned chars, so first try to change your<div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">static_cast<double*>(image-></span><wbr style="font-size:12.8px"><span style="font-size:12.8px">GetScalarPointer(ijk)); </span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">to</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">static_cast<unsigned char*>(image-></span><wbr style="font-size:12.8px"><span style="font-size:12.8px">GetScalarPointer(ijk));</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Hope that helps,</span></div><div><span style="font-size:12.8px">Cory</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 20, 2017 at 3:06 AM, arwtyxouymz <span dir="ltr"><<a href="mailto:arw.tyx-ouy_mz@ezweb.ne.jp" target="_blank">arw.tyx-ouy_mz@ezweb.ne.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I wrote the code to pick the DICOM pixel value, but pixel value is strange.<br>
My code is below:<br>
<br>
```<br>
vtkSmartPointer<vtkImageData> image = reader->GetOutput();<br>
<br>
int ijk[3];<br>
double pcoords[3];<br>
<br>
for (vtkIdType id = 0; id < image->GetNumberOfPoints(); ++id) {<br>
        int check = image-><wbr>ComputeStructuredCoordinates(<wbr>image->GetPoint(id),<br>
ijk, pcoords);<br>
        cout << "ID: " << id << ", ";<br>
        cout << "ijk: " << "(" << ijk[0] << ", " << ijk[1] << ", " << ijk[2]<br>
<< "), ";<br>
        auto *pixel = static_cast<double*>(image-><wbr>GetScalarPointer(ijk));<br>
        cout << "Pixel: " << *pixel << endl;<br>
}<br>
```<br>
<br>
I supposed *pixel value is in the range 0 ~ 255, but actual output is like<br>
-2.06898e+289.<br>
Why?<br>
Moreover, *pixel max value is 1.98914e-289, and sometimes *pixel is nan.<br>
It's strange!!!<br>
<br>
Can you help me?<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.<wbr>com/VTK-Users-f1224199.html</a><br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_<wbr>FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/vtkusers</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>
</div>