src/util/pointProjector.js
/**
 * Projects a patient point to an image point
 * @export @public @method
 * @name projectPatientPointToImagePlane
 *
 * @param  {Object} patientPoint The patient point.
 * @param  {Object} imagePlane   The image plane used for projection.
 * @returns {Object}              The projected coordinates.
 */
Projects a patient point to an image point
@export @public @method
@name projectPatientPointToImagePlane

@param  {Object} patientPoint The patient point.
@param  {Object} imagePlane   The image plane used for projection.
@returns {Object}              The projected coordinates.
Projects a patient point to an image point @export @public @method @name projectPatientPointToImagePlane @param { Object } patientPoint The patient point . @param { Object } imagePlane The image plane used for projection . @returns { Object } The projected coordinates .
function projectPatientPointToImagePlane(patientPoint, imagePlane) {
  const rowCosines = convertToVector3(imagePlane.rowCosines);
  const columnCosines = convertToVector3(imagePlane.columnCosines);
  const imagePositionPatient = convertToVector3(
    imagePlane.imagePositionPatient
  );
  const point = patientPoint.clone().sub(imagePositionPatient);
  const x = rowCosines.dot(point) / imagePlane.columnPixelSpacing;
  const y = columnCosines.dot(point) / imagePlane.rowPixelSpacing;
  return {
    x,
    y,
  };
}
function projectPatientPointToImagePlane ( patientPoint , imagePlane ) { const rowCosines = convertToVector3 ( imagePlane . rowCosines ) ; const columnCosines = convertToVector3 ( imagePlane . columnCosines ) ; const imagePositionPatient = convertToVector3 ( imagePlane . imagePositionPatient ) ; const point = patientPoint . clone ( ) . sub ( imagePositionPatient ) ; const x = rowCosines . dot ( point ) / imagePlane . columnPixelSpacing ; const y = columnCosines . dot ( point ) / imagePlane . rowPixelSpacing ; return { x , y , } ; }
Projects a patient point to an image point
 @export @public @method
 @name projectPatientPointToImagePlane
Projects a patient point to an image point @export @public @method @name projectPatientPointToImagePlane