public Vector3D RotateToVolumeOrientation(Vector3D patientVec) { Matrix patientPos = new Matrix(1, 4); patientPos.SetRow(0, patientVec.X, patientVec.Y, patientVec.Z, 1F); Matrix volumePos = patientPos * OrientationPatientMatrix.Transpose(); return(new Vector3D(volumePos[0, 0], volumePos[0, 1], volumePos[0, 2])); }
public Vector3D ConvertToVolume(Vector3D patientPosition) { // Set orientation transform Matrix patientVolumeTransform = new Matrix(OrientationPatientMatrix.Transpose()); // Set origin translation Vector3D rotatedOrigin = RotateToVolumeOrientation(OriginPatient); patientVolumeTransform.SetRow(3, -rotatedOrigin.X, -rotatedOrigin.Y, -rotatedOrigin.Z, 1); // Transform patient position to volume position Matrix patientPositionMatrix = new Matrix(1, 4); patientPositionMatrix.SetRow(0, patientPosition.X, patientPosition.Y, patientPosition.Z, 1F); Matrix imagePositionMatrix = patientPositionMatrix * patientVolumeTransform; Vector3D imagePosition = new Vector3D(imagePositionMatrix[0, 0], imagePositionMatrix[0, 1], imagePositionMatrix[0, 2]); return(imagePosition); }
public Matrix RotateToVolumeOrientation(Matrix orientationPatient) { Matrix orientationVolume = orientationPatient * OrientationPatientMatrix.Transpose(); return(orientationVolume); }