예제 #1
0
        private void AdjustFusionImage_Edit(object sender, AnnRectangleObject fusionEditRect)
        {
            int subCellIndex = _cell.ActiveSubCell;
            int index        = _cmbFusedIndex.SelectedIndex;

            MedicalViewerFusion fusion = _cell.SubCells[subCellIndex].Fusion[index];

            AnnContainer _Container = GetContainer(_cell, fusionEditRect);

            fusion.Rotation = (float)fusionEditRect.Angle;

            LeadPointD[] pt = new LeadPointD[1];


            LeadRectD rect = _Container.Mapper.RectFromContainerCoordinates(fusionEditRect.Rect, AnnFixedStateOperations.None);

            Rectangle displayRect = _cell.GetDisplayedImageRectangle();

            rect.Offset(-displayRect.Left, -displayRect.Top);


            pt[0].X = (float)(rect.X + rect.Width / 2);
            pt[0].Y = (float)(rect.Y + rect.Height / 2);

            LeadPointD point = LeadPointD.Create(pt[0].X, pt[0].Y);


            _cell.AutomationContainer.Mapper.Transform.TransformPoints(pt);

            float normalizedXPosition = (float)(((float)point.X - (float)displayRect.Width / 2) / fusion.FusedImage.Width * 100 / _cell.GetScale(subCellIndex));
            float normalizedYPosition = (float)(((float)point.Y - (float)displayRect.Height / 2) / fusion.FusedImage.Height * 100 / _cell.GetScale(subCellIndex));

            float scaleX = (float)((rect.Width / fusion.FusedImage.Width) * 100 / _cell.GetScale(subCellIndex));
            float scaleY = (float)((rect.Height / fusion.FusedImage.Height) * 100 / _cell.GetScale(subCellIndex));

            if (scaleX == 0)
            {
                scaleX = 0.1F;
            }

            if (scaleY == 0)
            {
                scaleY = 0.1F;
            }

            RectangleF rectangle = new RectangleF(normalizedXPosition, normalizedYPosition, Math.Abs(scaleX), Math.Abs(scaleY));

            fusion.DisplayRectangle = rectangle;

            UpdateFusionUI(index);

            CellData cellData = (CellData)_cell.Tag;

            if (cellData.SyncCellFusion)
            {
                UpdateCellFusions(fusion, subCellIndex, index);
            }

            _cell.Invalidate();
        }
예제 #2
0
        void CreateDefaultLayers()
        {
            string[] layers = new string[] { "Red", "Green", "Blue" };

            LeadRectD rect = new LeadRectD(LeadPointD.Create(860, 700), LeadPointD.Create(5200, 1850));

            foreach (string layer in layers)
            {
                CreateRectangle(rect, AnnSolidColorBrush.Create(layer), CreateLayer(string.Format("{0} Layer", layer)));
                rect.Offset(360, 360);
            }
        }