Discrepancy between image coordinates and seed points centerline extraction

Hello,

I am using VMTK to extract the hepatic arteries from contrast-enhanced CT scans. After centerline extraction I need to make the connection between the outlets of the centerlines and the original image. While I was working on this, I found out there is a discepancy between the coordinates used in the centerline extraction and the coordinates of the image. Hopefully it is my own mistake, but I cannot seem to find where the problem lies.
As I am not able to share my own data, I am using some open-source CT data and walk you through it. (In this example I am using the vertebra instead of vessels, but it only serves the goal of showing the discepancy):

When using the centerline extractor, I use the point picker to select some landmarks on the generated surface.
Landmarks_on_surface

I made sure that vmtkcenterlines.py prints out the pickPositions (line 161) in physical (xyz) coordinates.
The positions were: [[406, 393, 1563],[362, 390, 1562],[412, 391, 1537],[357, 387, 1538]].

I transform these positions to image (ijk) coordinates by transforming to ras coordinates first, following by transforming to ijk coordinates by the following transformation matrices:
XyzToRasMatrixCoefficients = [-1.0, 0.0, 0.0, 382.00000000000017, 0.0, -1.0, 0.0, 222.00000000000009, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
RasToIjkMatrixCoefficients = [-1.2864321608040201, -0.0, 0.0, 245.70854271356794, -0.0, -1.2864321608040201, -0.0, 142.79396984924628, 0.0, -0.0, 0.5, -747.5, -0.0, 0.0, -0.0, 1.0]

The resulting image (ijk) coordinates are: [[276, 362, 34],[219, 358, 33],[284, 360, 21],[213, 355, 21]].

I looked up these coordinates in the original image using the vmtk image viewer and the crosshair:
Landmark_1
Landmark_2
Landmark_3
Landmark_4

Although not far, they are obviously off.

I cross-checked the transformation from xyz to ijk by setting the ContinuousCursor to true in the image viewer and found the same result. Therefore, I assume the transformation from physical coordinates to image coordinates is not the problem.

Could anyone help my indicate why this goes wrong and what to do to overcome this issue?

Thank you in advance.

I would recommend to cross-check with results you get in 3D Slicer - install VMTK extension and exteact centerline using “Extract centerline” module.

Thank you for your fast suggestion @lassoan.

In 3D slicer I have done something similar and found that the EndPointPositions in the Centerline Quantification table match the positions of the markups I have placed, after transforming them from xyz to ijk coordinates.

This would suggest that the issue lies somewhere in the vmtk point seed selector that works differently from the placement of the markups in 3D slicer.

Unfortunately, I cannot use 3D slicer for my purpose, so the question still remains why there is a discrepancy in vmtk point seed selector and the original image.

I don’t think many people use VMTK’s GUI components, so you may need to investigate and fix any issues in them yourself.

I’m just curious, is there anything specific that prevents you from using Slicer?

@lassoan that is a pity. The reason I posted this is because I seem to be unable to find and fix the issue myself… Do you know if there are developers of the VMTK GUI components active on this platform?

The reason I am not using Slicer is because we might want to incorporate part of it in our own software in a later stage.

I don’t know of anyone actively developing VMTK GUI, but if you use it please do contribute to that project to keep it healthy. As you’ve seen it’s very complicated to keep all these pieces working.