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.
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:
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.