loubna
(dev)
April 9, 2020, 10:58am
1
Hi,
My question is how can I extract points from vtkImageData. For example, considering 3D image(labelMap), if in voxels
there are 3 voxel values, I would get the coordinates of those voxels.
vtkImageData->getPoint() return the point coordiantes in physical space. However I want the point coordinates in ijk space then convert them to RAS space.
Thank’s in advance
Sam_Horvath
(Sam Horvath (Kitware))
April 9, 2020, 2:11pm
2
To get the coordinates in index space [ijk], You would use
vtkImageData->TransformPhysicalPointToContinuousIndex(point[3], index[3])
See: https://vtk.org/doc/nightly/html/classvtkImageData.html#aa37a2184cb38394a8828d4998f0628fc
loubna
(dev)
April 9, 2020, 2:58pm
3
Thank’s for the response. What about if I takes I,J,K voxel coordinates directly? where
vtkImageData-- >GetExtent(Kmin,Kmax,Jmin,Jmax,IMin,Imax)
i in range (kmin, kmax)
j in range (jMin,Jmax)
k in range (iMin,Imax)
lassoan
(Andras Lasso)
April 9, 2020, 5:12pm
5
2 Likes
loubna
(dev)
April 10, 2020, 5:51pm
6
Thank’s for your responses.
I will try to clarify more my issue.
I have a label Map (vtkImage Data) on which I have applied “vtkImageLabelOutlines” filter to keep only labelMap boundries.
What I want is to recover the 3D points corresponding to labelMap boundries labelMapBoundry) and store them in vtkPoints array
I am trying athe following test, but I don’t know if it can resolve the issue:
vtkVariant variant = labelMapBoundry->GetPointData()->GetScalars()->GetVariantValue(labelMapBoundry->computePointId(ijk_coords);
if(variant==1)
then store (i,j,k).
lassoan
(Andras Lasso)
April 10, 2020, 11:47pm
7
I don’t understand this. You can convert between voxel and physical coordinates as described in the script repository examples I linked above.