public bool IsInSameFrameOfReference(DicomImagePlane other) { Frame otherFrame = other._sourceFrame; if (_sourceFrame.ParentImageSop.StudyInstanceUid != otherFrame.ParentImageSop.StudyInstanceUid) { return(false); } return(_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 bool IsOrthogonalTo(DicomImagePlane other, float angleTolerance) { return Normal.IsOrthogonalTo(other.Normal, angleTolerance); }
public bool IsParallelTo(DicomImagePlane other, float angleTolerance) { return Normal.IsParallelTo(other.Normal, angleTolerance); }
public bool IsInSameFrameOfReference(DicomImagePlane other) { Frame otherFrame = other._sourceFrame; if (_sourceFrame.ParentImageSop.StudyInstanceUid != otherFrame.ParentImageSop.StudyInstanceUid) return false; return this._sourceFrame.FrameOfReferenceUid == otherFrame.FrameOfReferenceUid; }
private void InitializeWithCachedData(DicomImagePlane cachedData) { Normal = cachedData.Normal; PositionPatientTopLeft = cachedData.PositionPatientTopLeft; PositionPatientTopRight = cachedData.PositionPatientTopRight; PositionPatientBottomLeft = cachedData.PositionPatientBottomLeft; PositionPatientBottomRight = cachedData.PositionPatientBottomRight; PositionPatientCenterOfImage = cachedData.PositionPatientCenterOfImage; PositionImagePlaneTopLeft = cachedData.PositionImagePlaneTopLeft; }
private static DicomImagePlane CreateFromFrame(Frame frame) { int height = frame.Rows - 1; int width = frame.Columns - 1; DicomImagePlane plane = new DicomImagePlane(); plane.PositionPatientTopLeft = frame.ImagePlaneHelper.ConvertToPatient(new PointF(0, 0)); plane.PositionPatientTopRight = frame.ImagePlaneHelper.ConvertToPatient(new PointF(width, 0)); plane.PositionPatientBottomLeft = frame.ImagePlaneHelper.ConvertToPatient(new PointF(0, height)); plane.PositionPatientBottomRight = frame.ImagePlaneHelper.ConvertToPatient(new PointF(width, height)); plane.PositionPatientCenterOfImage = frame.ImagePlaneHelper.ConvertToPatient(new PointF(width / 2F, height / 2F)); plane.Normal = frame.ImagePlaneHelper.GetNormalVector(); if (plane.Normal == null || plane.PositionPatientCenterOfImage == null) return null; // here, we want the position in the coordinate system of the image plane, // without moving the origin (e.g. leave it at the patient origin). plane.PositionImagePlaneTopLeft = frame.ImagePlaneHelper.ConvertToImagePlane(plane.PositionPatientTopLeft, Vector3D.Null); return plane; }
private static DicomImagePlane CreateFromCache(Frame frame) { string key = String.Format("{0}:{1}", frame.ParentImageSop.SopInstanceUid, frame.FrameNumber); DicomImagePlane cachedData; if (ImagePlaneDataCache.ContainsKey(key)) { cachedData = ImagePlaneDataCache[key]; } else { cachedData = CreateFromFrame(frame); if (cachedData != null) ImagePlaneDataCache[key] = cachedData; } if (cachedData != null) { DicomImagePlane plane = new DicomImagePlane(); plane.InitializeWithCachedData(cachedData); return plane; } return null; }
public float GetAngleBetween(DicomImagePlane other) { return _sourceFrame.ImagePlaneHelper.GetAngleBetween(other._sourceFrame.ImagePlaneHelper); }
public float GetAngleBetween(DicomImagePlane other) { return(_sourceFrame.ImagePlaneHelper.GetAngleBetween(other._sourceFrame.ImagePlaneHelper)); }
public bool IsOrthogonalTo(DicomImagePlane other, float angleTolerance) { return(_sourceFrame.ImagePlaneHelper.IsOrthogonalTo(other._sourceFrame.ImagePlaneHelper, angleTolerance)); }
public float GetAngleBetween(DicomImagePlane other) { return(Normal.GetAngleBetween(other.Normal)); }
public bool IsOrthogonalTo(DicomImagePlane other, float angleTolerance) { return(Normal.IsOrthogonalTo(other.Normal, angleTolerance)); }
public bool GetIntersectionPoints(DicomImagePlane other, out Vector3D intersectionPointPatient1, out Vector3D intersectionPointPatient2) { return _sourceFrame.ImagePlaneHelper.IntersectsWith(other._sourceFrame.ImagePlaneHelper, out intersectionPointPatient1, out intersectionPointPatient2); }
public float GetAngleBetween(DicomImagePlane other) { return Normal.GetAngleBetween(other.Normal); }
public bool GetIntersectionPoints(DicomImagePlane other, out Vector3D intersectionPointPatient1, out Vector3D intersectionPointPatient2) { return(_sourceFrame.ImagePlaneHelper.IntersectsWith(other._sourceFrame.ImagePlaneHelper, out intersectionPointPatient1, out intersectionPointPatient2)); }
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 bool IsOrthogonalTo(DicomImagePlane other, float angleTolerance) { return _sourceFrame.ImagePlaneHelper.IsOrthogonalTo(other._sourceFrame.ImagePlaneHelper, angleTolerance); }