[vtkusers] Get voxel values from vtkNIFTIImageReader
M. Jordan
mjordan at live.at
Mon Mar 25 10:18:39 EDT 2019
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 = vtkSmartPointer<vtkNIFTIImageReader>::New();
readerVol->SetFileName(image.toStdString().c_str());
readerVol->Update();
vtkSmartPointer<vtkImageData> volume = vtkSmartPointer<vtkImageData>:: New();
volume->DeepCopy(readerVol->GetOutput());
float value = volume->GetScalarComponentAsFloat(4, 17, 52, 0);
I also tried to do it like this: https://vtk.org/Wiki/VTK/Examples/Cxx/ImageData/IterateImageData, but it is the same.
When I load the image into an external Nifti viewer, the viewer shows the expected voxel intensity for the given voxel.
What I am doing wrong?
Thank you very much!
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20190325/f97fb1a5/attachment.html>
More information about the vtkusers
mailing list