vtkOrientedImageData giving offset when sampling segmented tumor volume

segmentation
(Joshua Jacobs) #1

I have several segmented tumors with catheters inserted to sample the biological environment. I know the shape and location of each catheter membrane. I want to sample this to determine what percentage of the membrane is in the tumor versus out of the tumor.

Using Slicer 4.10.1

N = slicer.util.getNodes('Segmentation').GetSegmentation()
B=Seg.GetSegmentRepresentation('Segment_1','Binary labelmap')

Gives me a vtkSegmentationCorePython.vtkOrientedImageData object.

Using,

cell_ID=B.FindCell(point,...)
cell=B.GetCell(cell_ID) 
for i in range(8):
       pointValue+= weights[i]*pointData.GetValue(cell.GetPointId(i))

I can check for a given “point” on my membrane being within or without the segmented tumor.

However, the above predicts points that are offset from world coordinates by a consistent direction (scale invariant)…that varies between original volumes.

Exporting the above segmentation to a new labelmap (“Segmentation-label”) and sampling:

SegLabel=slicer.util.getNode('Segmentation-label')
B=SegLabel.GetImageData()

I am able to sample points and tell if they are within or without the segmented tumor.

Is there something I could do better to get the point-by-point segmentation label?

(Andras Lasso) #2

This example in the script repository contains everything you need.

You can also export segments to a labelmap volume node and convert between IJK and RAS coordinatesas shown in these examples: RAS->IJK and IJK->RAS.

Oriented images have been recently introduced in VTK, which will allow us to simplify image coordinate system transformations in Slicer, but it will take us at least a couple of months to make all the necessary updates.

1 Like
(Joshua Jacobs) #3

Thank You!

The insight is appreciated!