Beispiel #1
0
        public Vector3D ConvertToPatient(Vector3D volumePosition)
        {
            Platform.CheckForNullReference(volumePosition, "volumePosition");

            // Set orientation transform
            var volumePatientTransform = _volumeOrientationPatient.Augment();

            // Set origin translation
            volumePatientTransform.SetRow(3, VolumePositionPatient.X, VolumePositionPatient.Y, VolumePositionPatient.Z, 1);

            // Transform volume position to patient position
            var imagePositionMatrix = new Matrix(1, 4);

            imagePositionMatrix.SetRow(0, volumePosition.X, volumePosition.Y, volumePosition.Z, 1F);
            var patientPositionMatrix = imagePositionMatrix * volumePatientTransform;

            var patientPosition = new Vector3D(patientPositionMatrix[0, 0], patientPositionMatrix[0, 1], patientPositionMatrix[0, 2]);

            return(patientPosition);
        }
        public static void Rotate(this Matrix m, Matrix3D rotation)
        {
            var r = rotation != null?rotation.Augment() : Matrix.GetIdentity(4);

            m.Set(r * m);
        }