public bool IsInSameFrameOfReference(DicomImagePlane other)
        {
            Frame otherFrame = other._sourceFrame;

            if (_sourceFrame.ParentImageSop.StudyInstanceUid != otherFrame.ParentImageSop.StudyInstanceUid)
            {
                return(false);
            }

            return(this._sourceFrame.FrameOfReferenceUid == otherFrame.FrameOfReferenceUid);
        }
        public bool GetIntersectionPoints(DicomImagePlane other, out Vector3D intersectionPointPatient1, out Vector3D intersectionPointPatient2)
        {
            intersectionPointPatient1 = intersectionPointPatient2 = null;

            Vector3D[,] lineSegmentsImagePlaneBounds = new Vector3D[, ]
            {
                // Bounding line segments of this (reference) image plane.
                { PositionPatientTopLeft, PositionPatientTopRight },
                { PositionPatientTopLeft, PositionPatientBottomLeft },
                { PositionPatientBottomRight, PositionPatientTopRight },
                { PositionPatientBottomRight, PositionPatientBottomLeft }
            };

            List <Vector3D> planeIntersectionPoints = new List <Vector3D>();

            for (int i = 0; i < 4; ++i)
            {
                // Intersect the bounding line segments of the reference image with the plane of the target image.
                Vector3D intersectionPoint = Vector3D.GetLinePlaneIntersection(other.Normal, other.PositionPatientCenterOfImage,
                                                                               lineSegmentsImagePlaneBounds[i, 0],
                                                                               lineSegmentsImagePlaneBounds[i, 1], true);
                if (intersectionPoint != null)
                {
                    planeIntersectionPoints.Add(intersectionPoint);
                }
            }

            if (planeIntersectionPoints.Count < 2)
            {
                return(false);
            }

            intersectionPointPatient1 = planeIntersectionPoints[0];
            intersectionPointPatient2 = CollectionUtils.SelectFirst(planeIntersectionPoints,
                                                                    delegate(Vector3D point) { return(!planeIntersectionPoints[0].Equals(point)); });

            return(intersectionPointPatient1 != null && intersectionPointPatient2 != null);
        }
 public float GetAngleBetween(DicomImagePlane other)
 {
     return(Normal.GetAngleBetween(other.Normal));
 }
 public bool IsOrthogonalTo(DicomImagePlane other, float angleTolerance)
 {
     return(Normal.IsOrthogonalTo(other.Normal, angleTolerance));
 }