Get voxel values from vtkNIFTIImageReader
"M. Jordan" <[email protected]> Mon, 25 Mar 2019 14:18:39 +0000
| Newsgroups | gmane.comp.lib.vtk.user |
|---|---|
| Message-ID | <VI1PR05MB593688EF61BA5EC4CC01C556A65E0@VI1PR05MB5936.eurprd05.prod.outlook.com> |
--===============2096700232==
Content-Language: de-AT
Content-Type: multipart/alternative;
boundary="_000_VI1PR05MB593688EF61BA5EC4CC01C556A65E0VI1PR05MB5936eurp_"
--_000_VI1PR05MB593688EF61BA5EC4CC01C556A65E0VI1PR05MB5936eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
I am using the vtkNIFTIImageReader to use Nifti files within VTK (e.g. for =
creating surfaces using marching cubes).
Now I want to simply get the intensity of a certain voxel (e.g. 4 / 17 / 52=
). Nevertheless, I always get a value of zero.
vtkSmartPointer<vtkNIFTIImageReader> readerVol =3D vtkSmartPointer<vtkNIFTI=
ImageReader>::New();
readerVol->SetFileName(image.toStdString().c_str());
readerVol->Update();
vtkSmartPointer<vtkImageData> volume =3D vtkSmartPointer<vtkImageData>:: Ne=
w();
volume->DeepCopy(readerVol->GetOutput());
float value =3D volume->GetScalarComponentAsFloat(4, 17, 52, 0);
I also tried to do it like this: https://vtk.org/Wiki/VTK/Examples/Cxx/Imag=
eData/IterateImageData, but it is the same.
When I load the image into an external Nifti viewer, the viewer shows the e=
xpected voxel intensity for the given voxel.
What I am doing wrong?
Thank you very much!
Regards
--_000_VI1PR05MB593688EF61BA5EC4CC01C556A65E0VI1PR05MB5936eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
color: rgb(0, 0, 0);">
Hi, <br>
<br>
I am using the vtkNIFTIImageReader to use Nifti files within VTK (e.g. for =
creating surfaces using marching cubes).<br>
Now I want to simply get the intensity of a certain voxel (e.g. 4 / 17 / 52=
). Nevertheless, I always get a value of zero.<br>
<br>
<span>vtkSmartPointer<vtkNIFTIImageReader> readerVol =3D vtkSmartPoin=
ter<vtkNIFTIImageReader>::New();<br>
</span>
<div>readerVol->SetFileName(image.toStdString().c_str());<br>
</div>
<span>readerVol->Update();</span><br>
<br>
<span>vtkSmartPointer<vtkImageData> volume =3D vtkSmartPointer<vtk=
ImageData>:: New();<br>
</span><span>volume->DeepCopy(readerVol->GetOutput());</span><br>
<br>
float value =3D volume->GetScalarComponentAsFloat(4, 17, 52, 0);<br>
<br>
I also tried to do it like this: <a href=3D"https://vtk.org/Wiki/VTK/Exampl=
es/Cxx/ImageData/IterateImageData" id=3D"LPNoLP541099">
https://vtk.org/Wiki/VTK/Examples/Cxx/ImageData/IterateImageData</a>, but i=
t is the same.<br>
<br>
When I load the image into an external Nifti viewer, the viewer shows the e=
xpected voxel intensity for the given voxel.<br>
<br>
What I am doing wrong?<br>
<br>
Thank you very much!<br>
Regards<br>
</div>
</body>
</html>
--_000_VI1PR05MB593688EF61BA5EC4CC01C556A65E0VI1PR05MB5936eurp_--
--===============2096700232==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
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
Search the list archives at: http://markmail.org/search/?q=vtkusers
Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers
--===============2096700232==--