private void RefreshReferenceLines(IPresentationImage targetImage)
        {
            try
            {
                DicomImagePlane targetImagePlane = DicomImagePlane.FromImage(targetImage);
                if (targetImagePlane == null)
                {
                    return;
                }

                ReferenceLineCompositeGraphic referenceLineCompositeGraphic = _coordinator.GetReferenceLineCompositeGraphic(targetImage);
                if (referenceLineCompositeGraphic == null)
                {
                    return;
                }
                //bool showReferenceLines = this.Active && _currentReferenceImagePlane != null &&
                //    _currentReferenceImagePlane.IsInSameFrameOfReference(targetImagePlane);

                bool showReferenceLines = targetImage.ParentDisplaySet.ImageBox.ShowReferenceLine;
                if (!showReferenceLines)
                {
                    referenceLineCompositeGraphic.HideAllReferenceLines();
                    return;
                }

                int i = 0;

                foreach (ReferenceLine referenceLine in GetAllReferenceLines(targetImagePlane))
                {
                    ReferenceLineGraphic referenceLineGraphic = referenceLineCompositeGraphic[i++];
                    referenceLineGraphic.Point1  = referenceLine.StartPoint;
                    referenceLineGraphic.Point2  = referenceLine.EndPoint;
                    referenceLineGraphic.Text    = referenceLine.Label;
                    referenceLineGraphic.Visible = true;
                }
                // make any that aren't valid invisible.

                for (int j = i; j < referenceLineCompositeGraphic.Graphics.Count; ++j)
                {
                    referenceLineCompositeGraphic[j].Visible = false;
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Error, ex.ToString());
            }
        }
Example #2
0
        private void RefreshReferenceLines(IPresentationImage targetImage)
        {
            DicomImagePlane targetImagePlane = targetImage is BasicPresentationImage3D ? null : DicomImagePlane.FromImage(targetImage);

            if (targetImagePlane == null)
            {
                return;
            }

            ReferenceLineCompositeGraphic referenceLineCompositeGraphic = _coordinator.GetReferenceLineCompositeGraphic(targetImage);

            if (referenceLineCompositeGraphic == null)
            {
                return;
            }

            bool showReferenceLines = this.Active && _currentReferenceImagePlane != null &&
                                      _currentReferenceImagePlane.IsInSameFrameOfReference(targetImagePlane);

            if (!showReferenceLines)
            {
                referenceLineCompositeGraphic.HideAllReferenceLines();
                return;
            }

            int i = 0;

            foreach (ReferenceLine referenceLine in GetAllReferenceLines(targetImagePlane))
            {
                ReferenceLineGraphic referenceLineGraphic = referenceLineCompositeGraphic[i++];
                referenceLineGraphic.Point1  = referenceLine.StartPoint;
                referenceLineGraphic.Point2  = referenceLine.EndPoint;
                referenceLineGraphic.Text    = referenceLine.Label;
                referenceLineGraphic.Visible = true;
            }

            // make any that aren't valid invisible.
            for (int j = i; j < referenceLineCompositeGraphic.Graphics.Count; ++j)
            {
                referenceLineCompositeGraphic[j].Visible = false;
            }
        }
Example #3
0
        private void SetCurrentReferencePlane()
        {
            if (CurrentReferenceImage == this.SelectedPresentationImage)
            {
                return;
            }

            _currentReferenceImagePlane = SelectedPresentationImage is BasicPresentationImage3D ? null : DicomImagePlane.FromImage(this.SelectedPresentationImage);
            if (_currentReferenceImagePlane == null)
            {
                return;
            }

            ReferenceLineCompositeGraphic referenceLineCompositeGraphic =
                _coordinator.GetReferenceLineCompositeGraphic(CurrentReferenceImage);

            //Hide the current image's reference lines
            if (referenceLineCompositeGraphic != null)
            {
                referenceLineCompositeGraphic.HideAllReferenceLines();
            }
        }