I have a question pertaining to the conversion of patient coordinates into voxel coordinates
of a 3D MRI point cloud
model obtained from DICOM
. I have a 3D point cloud file obtained from 2D MRI images, and the points are in the patient coordinate system. I am trying to convert those points in the cloud into voxel coordinates
using the inverse of an affine matrix that I had initially created. But the affine matrix I have is singular and hence I cannot directly apply the inverse function on it. Is there a way to either construct an inverse affine matrix without applying the inverse function on the affine matrix? Or is there any other way to implement this conversion? I have also tried to get the pseudo-inverse matrix from the affine matrix, but I am not sure if that would help in any way.
I am working in Python 3.7
. The shape of the affine matrix is (160, 4, 4)
, that of the pseudo-inverse matrix is also (160, 4, 4)
, and that of the point cloud array is (2086604, 4)
.
To convert to voxel coordinates, the code and resulting shape of the array are as follows:
voxels = np.dot(p_inverse_whole, stack_patient.T)
(160, 4, 2086604)
Ideally I would like to have the resulting array in the following shape: (160, 4, 4)
instead of (160, 4, 2086604)
Could anyone of you please help me solving this problem?