Exemplo n.º 1
0
        private static ReferenceLine GetReferenceLine(DicomImagePlane referenceImagePlane, DicomImagePlane targetImagePlane)
        {
            // if planes are parallel within tolerance, then they do not intersect and thus no reference lines should be shown
            float parallelTolerance = SynchronizationToolSettingsHelper.Default.ParallelPlanesToleranceAngleRadians;

            if (referenceImagePlane.IsParallelTo(targetImagePlane, parallelTolerance))
            {
                return(null);
            }

            Vector3D intersectionPatient1, intersectionPatient2;

            if (!referenceImagePlane.GetIntersectionPoints(targetImagePlane, out intersectionPatient1, out intersectionPatient2))
            {
                return(null);
            }

            Vector3D intersectionImagePlane1 = targetImagePlane.ConvertToImagePlane(intersectionPatient1);
            Vector3D intersectionImagePlane2 = targetImagePlane.ConvertToImagePlane(intersectionPatient2);

            //The coordinates need to be converted to pixel coordinates because right now they are in mm.
            PointF intersectionImage1 = targetImagePlane.ConvertToImage(new PointF(intersectionImagePlane1.X, intersectionImagePlane1.Y));
            PointF intersectionImage2 = targetImagePlane.ConvertToImage(new PointF(intersectionImagePlane2.X, intersectionImagePlane2.Y));
            string label = referenceImagePlane.InstanceNumber.ToString();

            return(new ReferenceLine(intersectionImage1, intersectionImage2, label));
        }
Exemplo n.º 2
0
 private IEnumerable <DicomImagePlane> GetPlanesParallelToReferencePlane()
 {
     foreach (IPresentationImage image in CurrentReferenceImage.ParentDisplaySet.PresentationImages.Where(i => !(i is BasicPresentationImage3D)))
     {
         DicomImagePlane plane = DicomImagePlane.FromImage(image);
         if (plane != null)
         {
             if (_currentReferenceImagePlane.IsInSameFrameOfReference(plane) &&
                 _currentReferenceImagePlane.IsParallelTo(plane, _oneDegreeInRadians))
             {
                 yield return(plane);
             }
         }
     }
 }
			public void Calibrate(DicomImagePlane referenceImagePlane, DicomImagePlane targetImagePlane)
			{
				if (!referenceImagePlane.IsInSameFrameOfReference(targetImagePlane) && referenceImagePlane.IsParallelTo(targetImagePlane, _angleTolerance))
				{
					Plane referencePlane = FromDicomImagePlane(referenceImagePlane);
					Plane targetPlane = FromDicomImagePlane(targetImagePlane);

					Dictionary<Plane, Vector3D> referenceOffsets = GetOffsetDictionary(referencePlane);
					Dictionary<Plane, Vector3D> targetOffsets = GetOffsetDictionary(targetPlane);

					Vector3D offset = targetImagePlane.PositionPatientCenterOfImage - referenceImagePlane.PositionPatientCenterOfImage;
					
					referenceOffsets[targetPlane] = offset;
					targetOffsets[referencePlane] = -offset;
				}
			}
Exemplo n.º 4
0
		private static ReferenceLine GetReferenceLine(DicomImagePlane referenceImagePlane, DicomImagePlane targetImagePlane)
		{
			// if planes are parallel within tolerance, then they do not intersect and thus no reference lines should be shown
			float parallelTolerance = SynchronizationToolSettingsHelper.Default.ParallelPlanesToleranceAngleRadians;
			if (referenceImagePlane.IsParallelTo(targetImagePlane, parallelTolerance))
				return null;

			Vector3D intersectionPatient1, intersectionPatient2;
			if (!referenceImagePlane.GetIntersectionPoints(targetImagePlane, out intersectionPatient1, out intersectionPatient2))
				return null;

			Vector3D intersectionImagePlane1 = targetImagePlane.ConvertToImagePlane(intersectionPatient1);
			Vector3D intersectionImagePlane2 = targetImagePlane.ConvertToImagePlane(intersectionPatient2);

			//The coordinates need to be converted to pixel coordinates because right now they are in mm.
			PointF intersectionImage1 = targetImagePlane.ConvertToImage(new PointF(intersectionImagePlane1.X, intersectionImagePlane1.Y));
			PointF intersectionImage2 = targetImagePlane.ConvertToImage(new PointF(intersectionImagePlane2.X, intersectionImagePlane2.Y));
			string label = referenceImagePlane.InstanceNumber.ToString();

			return new ReferenceLine(intersectionImage1, intersectionImage2, label);
		}
            public void Calibrate(DicomImagePlane referenceImagePlane, DicomImagePlane targetImagePlane)
            {
                if (!referenceImagePlane.IsInSameFrameOfReference(targetImagePlane) && referenceImagePlane.IsParallelTo(targetImagePlane, _angleTolerance))
                {
                    Plane referencePlane = FromDicomImagePlane(referenceImagePlane);
                    Plane targetPlane    = FromDicomImagePlane(targetImagePlane);

                    Dictionary <Plane, Vector3D> referenceOffsets = GetOffsetDictionary(referencePlane);
                    Dictionary <Plane, Vector3D> targetOffsets    = GetOffsetDictionary(targetPlane);

                    Vector3D offset = targetImagePlane.PositionPatientCenterOfImage - referenceImagePlane.PositionPatientCenterOfImage;

                    referenceOffsets[targetPlane] = offset;
                    targetOffsets[referencePlane] = -offset;
                }
            }