I am trying to get HU value along a trajectory. The target coordinates and the tangent to this target (hence the trajectory) are calculated using Matlab on a mesh file, giving a set of xyz coordinates and the direction vector (tangents). Then, I load the dicom file (from which the mesh was extracted but not the binary mask itself which was used to get the Mesh) in C++ using ITK. Then, I used the function image->TransformPhysicalPointToIndex(point, pixelIndex);
. I read the target x,y,z coordinates of the target and construct a vector of double[3] with coordinates at every 0.02 mm from the target till 2mm from the target. When I call the function image->TransformPhysicalPointToIndex(point, pixelIndex);
, it always returns false, as in the points don't lie in the image.
So, after the default values, I changed the origin of image as the value in the Metadata with tag (0020|0032) Image Position (Patient) = -3.125-12\13.125.
With this, all the Physical points lie in the image but the HU values are wrong (the pixel indexes are on the top-left, instead of bottom right). Can anyone let me know the steps I need to follow to achieve this task?