コード例 #1
0
        public void ApplyDisplayForMg(IViewerControlCell cell)
        {
            DisplayData          displayData = cell.Image.CurrentPage;
            ICoordinateTransform transform   = CoordinateTransformFactoryHelper.CoordinateTransformFactory.CreateCoordinateTransform(cell);
            Point  point1          = new Point();
            Point  point2          = new Point();
            Vector v               = new Vector();
            var    imageLaterality = string.Empty;
            var    isLaterality    = displayData.ImageHeader.DicomHeader.TryGetValue(ServiceTagName.ImageLaterality, out imageLaterality);

            if (!isLaterality)
            {
                return;
            }
            point1 = imageLaterality == "L" ? new Point(0, 0.5) : new Point(1, 0.5);

            var pos = GetPostion(cell);

            if (pos == -1)
            {
                return;
            }
            switch (pos)
            {
            case 0:
            {
                point2 = new Point(0, 0.5);
                break;
            }

            case 1:
            {
                point2 = new Point(0.5, 0);
                break;
            }

            case 2:
            {
                point2 = new Point(1, 0.5);
                break;
            }

            case 3:
            {
                point2 = new Point(0.5, 1);
                break;
            }
            }

            Point p1 = transform.TranslatePoint(point1, PointType.RatioImage, PointType.Cell);
            Point p2 = transform.TranslatePoint(point2, PointType.RatioCell, PointType.Cell);

            v = p2 - p1;
            displayData.PState.Translate(v.X, v.Y);
            cell.Refresh(CellRefreshType.Image);
        }