예제 #1
0
        public void ApplyMoreFeatures(MedicalViewerMultiCell cell, int subCellIndex)
        {
            cell.UseWindowLevelBoundaries = _chkUseWindowLevelBoundaries.Checked;


            int from = 0;
            int to   = 1;

            switch (subCellIndex)
            {
            case -2:
                from = cell.ActiveSubCell;
                to   = from + 1;
                break;

            case -1:
                from = 0;
                to   = cell.SubCells.Count;
                break;

            default:
                from = subCellIndex;
                to   = subCellIndex + 1;
                break;
            }


            int counter;

            for (counter = from; counter < to; counter++)
            {
                cell.SubCells[counter].PaletteType = (MedicalViewerPaletteType)(_cmbBoxPaletteType.SelectedIndex);
            }
        }
예제 #2
0
        private void _cmbApplyToCell_SelectedIndexChanged(object sender, EventArgs e)
        {
            bool enableControls        = (_cmbApplyToCell.SelectedIndex != 0);
            bool enableSubCellControls = (_cmbApplyToSubCell.Text == "Custom");

            if (_Viewer.Cells.Count == 0)
            {
                return;
            }

            MedicalViewerMultiCell myCell = (MedicalViewerMultiCell)_Viewer.Cells[_txtCellIndex.Value];

            _chkUseWindowLevelBoundaries.Checked = myCell.UseWindowLevelBoundaries;


            _txtCellIndex.Enabled      = enableControls && (_cmbApplyToCell.Text == "Custom");
            _cmbApplyToSubCell.Enabled = enableControls;
            _txtSubcellIndex.Enabled   = (enableControls && enableSubCellControls);
            _txtWidth.Enabled          = enableControls;
            _txtCenter.Enabled         = enableControls;
            _cmbFillType.Enabled       = enableControls;

            _cmbBoxPaletteType.Enabled           = enableControls;
            _chkUseWindowLevelBoundaries.Enabled = enableControls;
        }
예제 #3
0
        private void InitializeMedicalViewer()
        {
            try
            {
                MedicalViewerMultiCell cell = new MedicalViewerMultiCell();


                cell.KeepDrawingAnnotation = true;

                cell.AddAction(MedicalViewerActionType.Stack);
                cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);
                cell.AddAction(MedicalViewerActionType.AnnotationRedaction);
                cell.SetAction(MedicalViewerActionType.AnnotationRedaction, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);
                cell.AddAction(MedicalViewerActionType.Scale);
                cell.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);
                cell.AnnotationCreated += new EventHandler <MedicalViewerAnnotationCreatedEventArgs>(cell_AnnotationCreated);
                cell.DesignerCreated   += new EventHandler <MedicalViewerDesignerCreatedEventArgs>(cell_DesignerCreated);

                _MedicalViewer               = new MedicalViewer(1, 1);
                _MedicalViewer.Dock          = DockStyle.Fill;
                _MedicalViewer.SplitterStyle = MedicalViewerSplitterStyle.None;
                _MedicalViewer.Cells.Add(cell);
                _MedicalViewer.Dock = DockStyle.Fill;
                panelView.Controls.Add(_MedicalViewer);
            }
            catch (Exception e)
            {
                Messager.ShowError(this, e);
                Close();
            }
        }
예제 #4
0
        public ViewerPropertiesDialog(MainForm owner, MedicalViewerMultiCell cell)
        {
            InitializeComponent();
            MainForm _mainForm = (MainForm)owner;

            _cell = cell;

            _cmbRuler.SelectedIndex          = (int)(_cell.RulerStyle);
            _cmbPaintMethod.SelectedIndex    = (int)(_cell.PaintingMethod);
            _cmbTextQuality.SelectedIndex    = (int)(_cell.TextQuality);
            _cmbBorderStyle.SelectedIndex    = (int)(_cell.BorderStyle);
            _cmbMeasurmentUnit.SelectedIndex = (int)(_cell.MeasurementUnit);
            _chkShowCellScroll.Checked       = _cell.ShowCellScroll;
            _chkMaintainSize.Checked         = _mainForm.Viewer.CellMaintenance;
            _chkShowFreeze.Checked           = _cell.ShowFreezeText;

            _lblBackgroundColor.BoxColor      = _cell.CellBackColor;
            _lblText.BoxColor                 = _cell.TextColor;
            _lblShadowColor.BoxColor          = _cell.TextShadowColor;
            _lblActiveBorderColor.BoxColor    = _cell.ActiveBorderColor;
            _lblNonActiveBorderColor.BoxColor = _cell.NonActiveBorderColor;
            _lblRulerInColor.BoxColor         = _cell.RulerInColor;
            _lblRulerOutColor.BoxColor        = _cell.RulerOutColor;
            _lblActiveSubcellColor.BoxColor   = _cell.ActiveSubCellBorderColor;
            _labelDesignForeColor.BoxColor    = _mainForm.Viewer.LayoutOptions.RectForeColor;
            _labelDesignBackColor.BoxColor    = _mainForm.Viewer.LayoutOptions.RectBackColor;
        }
예제 #5
0
        public CellPropertiesDialog(MainForm mainForm, MedicalViewerMultiCell multiCell)
        {
            InitializeComponent();

            _cell = multiCell;

            if (multiCell != null)
            {
                _rdoApplyToSelected.Checked = true;
            }
            else
            {
                _cell = (MedicalViewerMultiCell)(mainForm.Viewer.Cells[0]);
                _rdoApplyToAll.Checked      = true;
                _rdoApplyToSelected.Enabled = false;
            }

            _chkShowTags.Checked           = _cell.ShowTags;
            _cmbDisplayRuler.SelectedIndex = (int)_cell.DisplayRulers;
            _chkApplyOnMove.Checked        = _cell.ApplyActionOnMove;
            _chkApplyWLToAll.Checked       = !_cell.ApplyOnIndividualSubCell;
            _chkFitImage.Checked           = _cell.FitImageToCell;
            _txtRows.Text    = _cell.Rows.ToString();
            _txtColumns.Text = _cell.Columns.ToString();
        }
예제 #6
0
        private void InitializeFusionList()
        {
            int cellIndex = _form.GetFirstSelectedMultiCellIndex();

            if (cellIndex == -1)
            {
                return;
            }

            _cell = (MedicalViewerMultiCell)_viewer.Cells[cellIndex];
            if (_cell == null)
            {
                return;
            }

            _cellFusionNames = _form.FusionListNames[cellIndex];

            int subCellIndex = _cell.ActiveSubCell;

            if (_cellFusionNames[subCellIndex] == null)
            {
                return;
            }

            int index = 0;

            for (index = 0; index < _cellFusionNames[subCellIndex].Count; index++)
            {
                _listFusionImages.Items.Add(_cellFusionNames[subCellIndex][index].Name);
                _cellFusionPaths.Add(_cellFusionNames[subCellIndex][index].Filename);
                _weightList.Add((int)(_cell.SubCells[subCellIndex].Fusion[index].FusionScale * 100));
                _images.Add(_cell.SubCells[subCellIndex].Fusion[index].FusedImage);
            }
        }
예제 #7
0
        void InitializeAdjustFusionImageForm()
        {
            _currentAnnDesigner = null;

            int cellIndex = _form.GetFirstSelectedMultiCellIndex();

            if (cellIndex == -1)
            {
                return;
            }

            _cell = (MedicalViewerMultiCell)_viewer.Cells[cellIndex];
            if (_cell == null)
            {
                return;
            }

            _cell.Automation.Edit          += new EventHandler <AnnEditDesignerEventArgs>(Automation_Edit);
            _cell.Automation.SetCursor     += new EventHandler <AnnCursorEventArgs>(Automation_SetCursor);
            _cell.Automation.RestoreCursor += Automation_RestoreCursor;

            _cellFusionNames = _form.FusionListNames[cellIndex];
            UpdateFusionUI(0);
            UpdateFusionComboBox();
            MedicalViewerSubCell subCell = _cell.SubCells[_cell.ActiveSubCell];

            this.FormClosing += new FormClosingEventHandler(AdjustFusionImage_FormClosing);

            _cell.Paint                += new PaintEventHandler(_cell_Paint);
            _cell.DesignerCreated      += new EventHandler <MedicalViewerDesignerCreatedEventArgs>(_cell_DesignerCreated);
            _cell.ActiveSubCellChanged += new EventHandler <MedicalViewerActiveSubCellChangedEventArgs>(_cell_ActiveSubCellChanged);
            _cell.DeleteAnnotation     += new EventHandler <MedicalViewerDeleteEventArgs>(_cell_DeleteAnnotation);
        }
예제 #8
0
        public CellPropertiesDialog(MainForm mainForm, int i)
        {
            InitializeComponent();

            if (i != mainForm.Viewer.Cells.Count)
            {
                _rdoApplyToSelected.Checked = true;
            }
            else
            {
                i = 0;
                _rdoApplyToAll.Checked = true;
            }

            MedicalViewerMultiCell cell = (MedicalViewerMultiCell)mainForm.Viewer.Cells[i];

            _chkShowTags.Checked           = cell.ShowTags;
            _cmbDisplayRuler.SelectedIndex = (int)cell.DisplayRulers;
            _chkApplyOnMove.Checked        = cell.ApplyActionOnMove;
            _chkApplyWLToAll.Checked       = !cell.ApplyOnIndividualSubCell;
            _chkFitImage.Checked           = cell.FitImageToCell;
            _txtRows.Text    = cell.Rows.ToString();
            _txtColumns.Text = cell.Columns.ToString();

            _chkSnapRulers.Checked           = cell.SnapRulers;
            _chkDisableControlPoints.Checked = !cell.ShowControlPoints;
        }
예제 #9
0
 private void ModifyStent_FormClosing(object sender, FormClosingEventArgs e)
 {
     _form._modifyStentDlg = null;
     _cell         = null;
     _frameEnabled = null;
     _form         = null;
     _firstTime    = true;
 }
예제 #10
0
        public void Initialize(MainForm owner, MedicalViewerActionType actionType)
        {
            InitializeComponent();

            cell   = MainForm.DefaultCell;
            viewer = owner.Viewer;
            _owner = owner;


            _owner.CobbAngleStarted = false;


            _actionType = actionType;
            this.Text   = "Set " + GetSeparatedText(actionType.ToString()) + " Action";

            if (cell.IsValidForAction(actionType, MedicalViewerMouseButtons.Wheel))
            {
                _cmbMouseButton.Items.Insert(4, "Wheel");
            }

            if (cell.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyTo.Items.Add("Selected Cells");
                _cmbApplyTo.Items.Add("All Cells");
            }

            if (cell.IsValidForAction(actionType, MedicalViewerActionFlags.Selected))
            {
                _cmbApplyingMethod.Items.Add("On Release");
            }

            MedicalViewerActionFlags actionFlags = cell.GetActionFlags(actionType);


            if ((actionFlags | MedicalViewerActionFlags.OnRelease) == actionFlags)
            {
                _cmbApplyingMethod.SelectedIndex = 1;
            }
            else
            {
                _cmbApplyingMethod.SelectedIndex = 0;
            }

            if ((actionFlags & MedicalViewerActionFlags.Selected) == MedicalViewerActionFlags.Selected)
            {
                _cmbApplyTo.SelectedIndex = 1;
            }
            else if ((actionFlags & MedicalViewerActionFlags.AllCells) == MedicalViewerActionFlags.AllCells)
            {
                _cmbApplyTo.SelectedIndex = 2;
            }
            else
            {
                _cmbApplyTo.SelectedIndex = 0;
            }

            _cmbMouseButton.SelectedIndex = (int)cell.GetActionButton(actionType);
        }
예제 #11
0
 public HistogramEqualizeDialog(MedicalViewerMultiCell cell, MainForm mainForm)
 {
     _cell     = cell;
     _mainForm = mainForm;
     InitializeComponent();
     _cbColorSpace.SelectedIndex = 0;
     _firstTime       = true;
     _oldWindowWidth  = _cell.GetWindowLevelWidth();
     _oldWindowCenter = _cell.GetWindowLevelCenter();
 }
예제 #12
0
        public AngleAnnotationDialog(MainForm owner)
        {
            InitializeComponent();

            cell   = MainForm.DefaultCell;
            viewer = owner.Viewer;

            _angleAnnotation          = (MedicalViewerAnnotationAngle)(cell.GetActionProperties(MedicalViewerActionType.AnnotationAngle));
            _lblColor.BackColor       = Color.FromArgb(0xff, _angleAnnotation.AnnotationColor);
            _cmbApplyTo.SelectedIndex = (int)_angleAnnotation.Flags;
        }
예제 #13
0
        public ModifyStent(MedicalViewerMultiCell cell, StentEnhancementCommand stentCommand, MainForm form)
        {
            _firstTime = true;
            _cell      = (MedicalViewerMultiCell)cell;
            _form      = form;

            _frameEnabled = _form.FrameEnabled;


            InitializeComponent();
        }
예제 #14
0
        public AnnotationPropertiesDialog(MedicalViewerMultiCell cell)
        {
            InitializeComponent();
            _cell = cell;

            _annObj = _cell.Automation.CurrentEditObject;

            if (!_annObj.SupportsStroke)
            {
                _tabAnnProperties.TabPages.Remove(_penTab);
            }
            if (!_annObj.SupportsFill && !(_annObj is AnnHiliteObject))
            {
                _tabAnnProperties.TabPages.Remove(_brushTab);
            }
            if (!_annObj.SupportsFont)
            {
                _tabAnnProperties.TabPages.Remove(_fontTab);
            }

            _chkUsePen.Checked = _annObj.SupportsStroke;

            _chkUseBrush.Checked = _annObj.SupportsFill | (_annObj is AnnHiliteObject);

            if (_annObj is AnnHiliteObject)
            {
                _chkUseBrush.Visible = false;
                _brushTab.Text       = "Hilite";
            }

            //if (_annObj.SupportsStroke)
            //{
            //   foreach (AnnStrokeLineCap dash in (AnnStrokeLineCap[])Enum.GetValues(typeof(AnnStrokeLineCap)))
            //   {
            //      _cmbDashStyle.Items.Add(dash.ToString());
            //   }
            //}
            //else
            //   _cmbDashStyle.Enabled = false;

            if (_annObj.SupportsFont)
            {
                AnnTextObject AnnTempText = _annObj as AnnTextObject;
                AnnFont       objFont     = _annObj.Font;
                _annFont           = new AnnFont(objFont.FontFamilyName.ToString(), objFont.FontSize);
                _annFont.FontStyle = objFont.FontStyle;
                AnnSolidColorBrush CurrentBrush = AnnTempText.TextForeground as AnnSolidColorBrush;
                _fontColor = Color.FromName(CurrentBrush.Color);
            }

            UpdateFont();
            UpdateBrush();
            UpdatePen();
        }
예제 #15
0
        public RulerAnnotationDialog(MainForm owner)
        {
            InitializeComponent();

            cell   = MainForm.DefaultCell;
            viewer = owner.Viewer;

            _rulerAnnotation          = (MedicalViewerAnnotationRuler)(cell.GetActionProperties(MedicalViewerActionType.AnnotationRuler));
            _lblColor.BackColor       = Color.FromArgb(0xff, _rulerAnnotation.AnnotationColor);
            _cmbApplyTo.SelectedIndex = (int)_rulerAnnotation.Flags;
            _chkSimpleRuler.Checked   = _rulerAnnotation.SimpleRuler;
        }
예제 #16
0
        public StatisticsDialog(MainForm owner)
        {
            InitializeComponent();

            int cellIndex = owner.SearchForFirstSelected();

            MedicalViewerMultiCell cell = null;

            if (cellIndex != -1)
            {
                cell = (MedicalViewerMultiCell)owner.Viewer.Cells[cellIndex];
            }

            if (cell == null)
            {
                return;
            }

            if (cell.Image.GetRegionBounds(null).IsEmpty)
            {
                cell.Image.MakeRegionEmpty();
            }



            int         page  = cell.Image.Page;
            RasterImage image = cell.Image;

            image.Page = cell.ActiveSubCell + 1;

            if (cell.Image.HasRegion)
            {
                _hasRegionLbl.Text      = "True";
                _hasRegionLbl.BackColor = Color.FromArgb(128, 255, 128);

                LeadRect bounds = image.GetRegionBounds(null);

                _xLbl.Text      = bounds.X.ToString();
                _yLbl.Text      = bounds.Y.ToString();
                _widthLbl.Text  = bounds.Width.ToString();
                _heightLbl.Text = bounds.Height.ToString();

                _areaLbl.Text = image.CalculateRegionArea().ToString();
            }
            else
            {
                _hasRegionLbl.Text      = "False";
                _hasRegionLbl.BackColor = Color.FromArgb(255, 128, 128);
            }

            image.Page = page;
        }
예제 #17
0
        public EllipseAnnotationDialog(MainForm owner)
        {
            InitializeComponent();
            int cellIndex = owner.SearchForFirstSelected();

            cell   = MainForm.DefaultCell; //(MedicalViewerMultiCell)owner.Viewer.Cells[cellIndex];
            viewer = owner.Viewer;

            _cmbApplyTo.SelectedIndex = 0;
            _ellipseAnnotation        = (MedicalViewerAnnotationEllipse)(cell.GetActionProperties(MedicalViewerActionType.AnnotationEllipse));
            _lblColor.BackColor       = Color.FromArgb(0xff, _ellipseAnnotation.AnnotationColor);
            _radCenter.Checked        = _ellipseAnnotation.CreateFromCenter;
        }
예제 #18
0
        public ContainerProperties(Medical3DControl control3D, MedicalViewer viewer, Medical3DContainer container)
        {
            _container = container;
            _control3D = control3D;
            _viewer    = viewer;

            _mprCell = FindFirstMPRCell(viewer);
            _cell    = FindFirstMultiCell(viewer);


            InitializeComponent();
            FillDialogWithOldValues();
        }
예제 #19
0
        public CalibrateRulerDialog(MainForm owner)
        {
            InitializeComponent();

            int cellIndex = owner.SearchForFirstSelected();

            _cell = (MedicalViewerMultiCell)owner.Viewer.Cells[cellIndex];

            _cmbUnit.SelectedIndex      = (int)(_cell.MeasurementUnit);
            _txtDistance.MinimumAllowed = 1;
            _txtDistance.MaximumAllowed = 100;
            _txtDistance.Text           = (1).ToString();
            _chkApplyToAll.Checked      = owner.ApplyToAll;
        }
        private static void FillSeriesThumbnail(LoadSeriesEventArgs e, SeriesInformation seriesInfo)
        {
            if (e.LoadedSeries.Streamer.SeriesCells.Length > 0)
            {
                MedicalViewerMultiCell cell = e.LoadedSeries.Streamer.SeriesCells[0];

                if (cell.VirtualImage != null)
                {
                    if (cell.VirtualImage[cell.ActiveSubCell].ImageExist)
                    {
                        using (RasterImage image = cell.VirtualImage[cell.ActiveSubCell].Image.Clone())
                        {
                            Image thumbImage;

                            if (image.Width != 64 || image.Height != 64)
                            {
                                SizeCommand sizeCommand;


                                sizeCommand = new SizeCommand(64, 64, RasterSizeFlags.None);

                                sizeCommand.Run(image);
                            }

                            if (image.BitsPerPixel != 24)
                            {
                                ColorResolutionCommand colorRes = new ColorResolutionCommand(ColorResolutionCommandMode.InPlace,
                                                                                             24,
                                                                                             RasterByteOrder.Bgr,
                                                                                             RasterDitheringMethod.None,
                                                                                             ColorResolutionCommandPaletteFlags.FastMatch,
                                                                                             null);


                                colorRes.Run(image);
                            }

                            thumbImage = RasterImageConverter.ConvertToImage(image, ConvertToImageOptions.InitAlpha);

                            seriesInfo.Thumbnail = thumbImage;
                        }
                    }
                }
            }
        }
예제 #21
0
        private bool ApplyFusion()
        {
            if (GetTotalCount() > 100)
            {
                MessageBox.Show("the weight total for the fused images should not exceed 100", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }
            else
            {
                int cellIndex = _form.GetFirstSelectedMultiCellIndex();

                if (cellIndex == -1)
                {
                    return(false);
                }

                MedicalViewerMultiCell cell = (MedicalViewerMultiCell)_viewer.Cells[cellIndex];
                if (cell == null)
                {
                    return(false);
                }

                _cellFusionNames = _form.FusionListNames[cellIndex];

                int subCellIndex = cell.ActiveSubCell;

                if (_form.FusionListNames[cellIndex][subCellIndex] == null)
                {
                    _form.FusionListNames[cellIndex][subCellIndex] = new List <FusionData>();
                }



                int index = 0;

                _form.FusionListNames[cellIndex][subCellIndex].Clear();

                for (index = 0; index < _listFusionImages.Items.Count; index++)
                {
                    _form.FusionListNames[cellIndex][subCellIndex].Add(new FusionData(_cellFusionPaths[index], _listFusionImages.Items[index].ToString(), 0));
                }
            }

            return(true);
        }
예제 #22
0
        public FuseTwoCellsProperties(MedicalViewerMultiCell orgCell, MedicalViewerMultiCell fuCell)
        {
            InitializeComponent();

            _orgCellImagesCount = orgCell.VirtualImage.Count;
            _fuCellImagesCount  = fuCell.VirtualImage.Count;

            _numStart.Minimum = 1;
            _numStart.Value   = 1;
            _numStart.Maximum = _orgCellImagesCount;

            _numEnd.Minimum = 1;
            _numEnd.Maximum = _orgCellImagesCount;
            _numEnd.Value   = Math.Min(_orgCellImagesCount, _fuCellImagesCount);

            _numStart.ValueChanged += new EventHandler(_num_ValueChanged);
            _numEnd.ValueChanged   += new EventHandler(_num_ValueChanged);
        }
예제 #23
0
        private AnnContainer GetContainer(MedicalViewerMultiCell cell, AnnObject annotationObject)
        {
            int index  = 0;
            int length = cell.SubCells.Count;

            AnnContainer container;

            for (index = 0; index < length; index++)
            {
                container = cell.SubCells[index].AnnotationContainer;

                if (container.Children.IndexOf(annotationObject) != -1)
                {
                    return(container);
                }
            }
            return(null);
        }
예제 #24
0
        public CLAHEDialog(MainForm mainForm, MedicalViewerCell cell)
        {
            _mainForm = mainForm;
            _cell     = (MedicalViewerMultiCell)cell;
            _command  = new CLAHECommand();

            InitializeComponent();

            _firstTime = true;

            _cbFlags.SelectedIndex      = 0;
            _cbBinsNumber.SelectedIndex = 6;

            _numAlpha.Value       = (decimal)_command.AlphaFactor;
            _numTilesNumber.Value = (decimal)_command.TilesNumber;
            _numClipLimit.Value   = (decimal)_command.TileHistClipLimit;

            _oldWindowWidth  = _cell.GetWindowLevelWidth();
            _oldWindowCenter = _cell.GetWindowLevelCenter();

            switch (_command.Flags)
            {
            case CLAHECommandFlags.ApplyNormalDistribution:
                _cbFlags.SelectedIndex = 0;
                break;

            case CLAHECommandFlags.ApplyExponentialDistribution:
                _cbFlags.SelectedIndex = 1;
                break;

            case CLAHECommandFlags.ApplyRayliehDistribution:
                _cbFlags.SelectedIndex = 2;
                break;

            case CLAHECommandFlags.ApplySigmoidDistribution:
                _cbFlags.SelectedIndex = 3;
                break;
            }
        }
예제 #25
0
파일: DROC.cs 프로젝트: khaha2210/radio
 void AddNewMecicalViewerCell(MedicalViewer _viewer, MedicalViewerMultiCell _cell)
 {
     try
     {
         if (_viewer.InvokeRequired)
         {
             _viewer.Invoke(new AddCell_temp(AddNewMecicalViewerCell), new object[] { _viewer, _cell });
         }
         else
             _viewer.Cells.Add(_cell);
     }
     catch
     {
     }
 }
예제 #26
0
        public SetNudgeShrinkActionDialog(MainForm owner)
        {
            InitializeComponent();

            cell   = MainForm.DefaultCell;
            viewer = owner.Viewer;
            _owner = owner;

            if (cell.IsValidForAction(MedicalViewerActionType.NudgeTool, MedicalViewerMouseButtons.Wheel))
            {
                _cmbNudgeMouseButton.Items.Insert(4, "Wheel");
            }
            if (cell.IsValidForAction(MedicalViewerActionType.ShrinkTool, MedicalViewerMouseButtons.Wheel))
            {
                _cmbShrinkMouseButton.Items.Insert(4, "Wheel");
            }

            if (cell.IsValidForAction(MedicalViewerActionType.NudgeTool, MedicalViewerActionFlags.Selected))
            {
                _cmbNudgeApplyTo.Items.Add("Selected Cells");
                _cmbNudgeApplyTo.Items.Add("All Cells");
            }
            if (cell.IsValidForAction(MedicalViewerActionType.ShrinkTool, MedicalViewerActionFlags.Selected))
            {
                _cmbShrinkApplyTo.Items.Add("Selected Cells");
                _cmbShrinkApplyTo.Items.Add("All Cells");
            }

            if (cell.IsValidForAction(MedicalViewerActionType.NudgeTool, MedicalViewerActionFlags.Selected))
            {
                _cmbNudgeApplyingMethod.Items.Add("On Release");
            }
            if (cell.IsValidForAction(MedicalViewerActionType.ShrinkTool, MedicalViewerActionFlags.Selected))
            {
                _cmbNudgeMouseButton.Items.Add("On Release");
            }

            MedicalViewerActionFlags actionFlags = cell.GetActionFlags(MedicalViewerActionType.NudgeTool);

            if ((actionFlags | MedicalViewerActionFlags.OnRelease) == actionFlags)
            {
                _cmbNudgeApplyingMethod.SelectedIndex = 1;
            }
            else
            {
                _cmbNudgeApplyingMethod.SelectedIndex = 0;
            }

            if ((actionFlags & MedicalViewerActionFlags.Selected) == MedicalViewerActionFlags.Selected)
            {
                _cmbNudgeApplyTo.SelectedIndex = 1;
            }
            else if ((actionFlags & MedicalViewerActionFlags.AllCells) == MedicalViewerActionFlags.AllCells)
            {
                _cmbNudgeApplyTo.SelectedIndex = 2;
            }
            else
            {
                _cmbNudgeApplyTo.SelectedIndex = 0;
            }

            _cmbNudgeMouseButton.SelectedIndex = (int)cell.GetActionButton(MedicalViewerActionType.NudgeTool);


            actionFlags = cell.GetActionFlags(MedicalViewerActionType.ShrinkTool);
            if ((actionFlags | MedicalViewerActionFlags.OnRelease) == actionFlags)
            {
                _cmbShrinkApplyingMethod.SelectedIndex = 1;
            }
            else
            {
                _cmbShrinkApplyingMethod.SelectedIndex = 0;
            }

            if ((actionFlags & MedicalViewerActionFlags.Selected) == MedicalViewerActionFlags.Selected)
            {
                _cmbShrinkApplyTo.SelectedIndex = 1;
            }
            else if ((actionFlags & MedicalViewerActionFlags.AllCells) == MedicalViewerActionFlags.AllCells)
            {
                _cmbShrinkApplyTo.SelectedIndex = 2;
            }
            else
            {
                _cmbShrinkApplyTo.SelectedIndex = 0;
            }

            _cmbShrinkMouseButton.SelectedIndex = (int)cell.GetActionButton(MedicalViewerActionType.ShrinkTool);
        }
예제 #27
0
        private void ApplyCellProperties(MedicalViewerMultiCell cell)
        {
            MedicalViewer viewer = ((MainForm)this.Owner).Viewer;

            if (cell.CellBackColor != _lblBackgroundColor.BoxColor)
            {
                cell.CellBackColor = _lblBackgroundColor.BoxColor;
            }

            if (cell.TextColor != _lblText.BoxColor)
            {
                cell.TextColor = _lblText.BackColor;
            }

            if (cell.TextShadowColor != _lblShadowColor.BoxColor)
            {
                cell.TextShadowColor = _lblShadowColor.BackColor;
            }

            if (cell.ActiveBorderColor != _lblActiveBorderColor.BoxColor)
            {
                cell.ActiveBorderColor = _lblActiveBorderColor.BackColor;
            }

            if (cell.NonActiveBorderColor != _lblNonActiveBorderColor.BoxColor)
            {
                cell.NonActiveBorderColor = _lblNonActiveBorderColor.BackColor;
            }

            if (cell.ActiveSubCellBorderColor != _lblActiveSubcellColor.BoxColor)
            {
                cell.ActiveSubCellBorderColor = _lblActiveSubcellColor.BackColor;
            }

            if (cell.RulerInColor != _lblRulerInColor.BoxColor)
            {
                cell.RulerInColor = _lblRulerInColor.BackColor;
            }

            if (cell.RulerOutColor != _lblRulerOutColor.BoxColor)
            {
                cell.RulerOutColor = _lblRulerOutColor.BackColor;
            }

            if (cell.TextQuality != (MedicalViewerTextQuality)_cmbTextQuality.SelectedIndex)
            {
                cell.TextQuality = (MedicalViewerTextQuality)_cmbTextQuality.SelectedIndex;
            }

            if (cell.RulerStyle != (MedicalViewerRulerStyle)_cmbRuler.SelectedIndex)
            {
                cell.RulerStyle = (MedicalViewerRulerStyle)_cmbRuler.SelectedIndex;
            }

            if (cell.ShowCellScroll != _chkShowCellScroll.Checked)
            {
                cell.ShowCellScroll = _chkShowCellScroll.Checked;
            }

            if (cell.ShowFreezeText != _chkShowFreeze.Checked)
            {
                cell.ShowFreezeText = _chkShowFreeze.Checked;
            }

            if (cell.PaintingMethod != (MedicalViewerPaintingMethod)_cmbPaintMethod.SelectedIndex)
            {
                cell.PaintingMethod = (MedicalViewerPaintingMethod)_cmbPaintMethod.SelectedIndex;
            }

            if (cell.MeasurementUnit != (MedicalViewerMeasurementUnit)_cmbMeasurmentUnit.SelectedIndex)
            {
                cell.MeasurementUnit = (MedicalViewerMeasurementUnit)_cmbMeasurmentUnit.SelectedIndex;
            }

            if (cell.BorderStyle != (MedicalViewerBorderStyle)_cmbBorderStyle.SelectedIndex)
            {
                cell.BorderStyle = (MedicalViewerBorderStyle)_cmbBorderStyle.SelectedIndex;
            }
        }
예제 #28
0
 private void ApplyDynamicFeature(MedicalViewerMultiCell cell, int subCellIndex)
 {
     cell.ScaleType = _chkBoxDynamic.Checked ? MedicalViewerScaleType.Dynamic : MedicalViewerScaleType.Normal;
 }
예제 #29
0
파일: DROC.cs 프로젝트: khaha2210/radio
        public void SetWL4Cell(MedicalViewerMultiCell cell)
        {
            //try
            //{

            //    _CurrCell.Image.UseLookupTable = false;
            //    MedicalViewerWindowLevel windowLevel = (MedicalViewerWindowLevel)(cell.GetActionProperties(MedicalViewerActionType.WindowLevel, 0));
            //    windowLevel.CircularMouseMove = blnWLCircular;
            //    //windowLevel.StartColor =WStartColor;
            //    //windowLevel.EndColor = WEndColor;
            //    windowLevel.Sensitivity = intWLSensitively;
            //    windowLevel.RelativeSensitivity = true;
            //    // cell.RemoveAction(MedicalViewerActionType.WindowLevel);
            //    //cell.AddAction(MedicalViewerActionType.WindowLevel);
            //    cell.SetActionProperties(MedicalViewerActionType.WindowLevel, windowLevel);
            //    _CurrCell.Image.UseLookupTable = true;

            //}
            //catch
            //{
            //}
        }
예제 #30
0
파일: DROC.cs 프로젝트: khaha2210/radio
 void AddNewMecicalViewerCell(MedicalViewerMultiCell _cell)
 {
     try
     {
         if (_DicomMedicalViewer._medicalViewer.InvokeRequired)
         {
             _DicomMedicalViewer._medicalViewer.Invoke(new AddCell(AddNewMecicalViewerCell), new object[] { _cell });
         }
         else
             _DicomMedicalViewer._medicalViewer.Cells.Add(_cell);
     }
     catch
     {
     }
 }
예제 #31
0
파일: DROC.cs 프로젝트: khaha2210/radio
        public void AutoDetectRowsAndCols(MedicalViewerMultiCell _cell,int PageCount)
        {
            try
            {

                int _expectedRows = 0;
                int _expectedColumns = 0;
                dicRowsAndCols(PageCount, ref _expectedRows, ref _expectedColumns);

                _cell.Rows = _expectedRows;
                _cell.Columns = _expectedColumns;

            }
            catch
            {
            }
        }
예제 #32
0
파일: DROC.cs 프로젝트: khaha2210/radio
        public void SetWL4CellWhenApplyGamma(MedicalViewerMultiCell cell, int _intWLSensitively)
        {
            //try
            //{


            //    MedicalViewerWindowLevel windowLevel = (MedicalViewerWindowLevel)(cell.GetActionProperties(MedicalViewerActionType.WindowLevel, 0));
            //    windowLevel.CircularMouseMove = blnWLCircular;

            //    windowLevel.Sensitivity = _intWLSensitively;
            //    windowLevel.RelativeSensitivity = true;

            //    cell.SetActionProperties(MedicalViewerActionType.WindowLevel, windowLevel);


            //}
            //catch
            //{
            //}
        }
예제 #33
0
파일: DROC.cs 프로젝트: khaha2210/radio
        /// <summary>
        /// Load Annotation của một ảnh để hiển thị cho người dùng xem
        /// </summary>
        /// <param name="cell"></param>
        /// <param name="fileName"></param>
        /// <param name="AutoIgnoreCropObject"></param>
        private void LoadAnnotation(MedicalViewerMultiCell cell, string fileName, bool AutoIgnoreCropObject)
        {
            return;
            int count = 1;
            #region 17.5
            //try
            //{
            //    if (fileName != null)
            //    {
            //        AnnCodecs _annCodecs = new AnnCodecs();
            //        _annCodecs.Load(fileName, cell.GetAnnotationContainer(0), 1);

            //        if (AutoIgnoreCropObject)
            //        {
            //            Leadtools.Annotations.AnnContainer _AnnContainer;
            //            lastRecObj = null;
            //            bool bHasRecObj = false;
            //            _AnnContainer = ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).GetAnnotationContainer(0);
            //            ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(new AnnContainer());
            //            AnnContainer _newAnn = new AnnContainer();
            //            foreach (AnnObject AnnObj in _AnnContainer.Objects)
            //                if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) || (AnnObj.GetType().Equals(new AnnTextObject().GetType()) && ((AnnTextObject)AnnObj).Text != null && (((AnnTextObject)AnnObj).Text.ToString() == "L" || ((AnnTextObject)AnnObj).Text.ToString() == "R")))
            //                {
            //                    if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) && ((AnnRectangleObject)AnnObj).Name.ToUpper() == "CẮT ẢNH")
            //                    {
            //                        lastRecObj = (AnnRectangleObject)AnnObj;
            //                    }
            //                    else
            //                        _newAnn.Objects.Add(AnnObj);
            //                }



            //            ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(_newAnn);
            //            ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).Invalidate();
            //        }

            //        //count += cell.Image.PageCount;
            //    }
            //}
            //catch (Exception ex)
            //{
            //}
            #endregion
            #region 17.0

            try
            {
                if (fileName != null)
                {
                    FileStream f = new FileStream(fileName, FileMode.OpenOrCreate);
                   
                    cell.LoadAnnotations(f);
                    f.Flush();
                    f.Close();
                    return;
                    if (AutoIgnoreCropObject)
                    {
                        Leadtools.Annotations.AnnContainer _AnnContainer;
                        lastRecObj = null;
                        bool bHasRecObj = false;
                        _AnnContainer = ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).GetAnnotationContainer(0);
                        ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(new AnnContainer());
                        AnnContainer _newAnn = new AnnContainer();
                        foreach (AnnObject AnnObj in _AnnContainer.Objects)
                            if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) || (AnnObj.GetType().Equals(new AnnTextObject().GetType()) && ((AnnTextObject)AnnObj).Text != null && (((AnnTextObject)AnnObj).Text.ToString() == "L" || ((AnnTextObject)AnnObj).Text.ToString() == "R")))
                            {
                                if (AnnObj.GetType().Equals(new AnnRectangleObject().GetType()) && ((AnnRectangleObject)AnnObj).Tag != null && ((AnnRectangleObject)AnnObj).Tag.ToString().ToUpper() == "2100")
                                {
                                    lastRecObj = (AnnRectangleObject)AnnObj;
                                }
                                else
                                    _newAnn.Objects.Add(AnnObj);
                            }
                        ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).SetAnnotationContainer(_newAnn);
                        ((MedicalViewerMultiCell)_DicomMedicalViewer._medicalViewer.Cells[_DicomMedicalViewer._medicalViewerCellIndex]).Invalidate();
                    }

                    //count += cell.Image.PageCount;
                }
            }
            catch (Exception ex)
            {
            }
            #endregion
        }
예제 #34
0
파일: DROC.cs 프로젝트: khaha2210/radio
         public void OpenDicom( ref bool IsCroping, ref int _Idx, string fileName, bool IsOnlyImg, bool CanCreatePicBox)
         {
             //Stopwatch _sw = new Stopwatch();
             try
             {
                 _DicomMedicalViewer._medicalViewer.BeginUpdate();
                 pnlScheduled.Enabled = false;
                 //_sw.Start();
                
                 #region Chế độ Demo
                 if (_AppMode == AppType.AppEnum.AppMode.Demo && !File.Exists(fileName))
                 {
                     ScheduledControl _selected = GetSelectedScheduled();
                     bool _isSelected = true;
                     string RAWFilePath = "";
                     //Tạo các thư mục theo cấp ngày\Bệnh nhân(Mã bệnh nhân _ Tên Bệnh nhân _ Tuổi)
                     if (!Directory.Exists(txtImgDir.Text + @"\" + SubDirLv1())) Directory.CreateDirectory(txtImgDir.Text + @"\" + SubDirLv1());
                     if (!Directory.Exists(txtImgDir.Text + @"\" + SubDirLv1() + @"\" + SubDirLv2_Patient())) Directory.CreateDirectory(txtImgDir.Text + @"\" + SubDirLv1() + @"\" + SubDirLv2_Patient());
                     //Kiểm tra nếu chưa chọn thủ tục nào thì cần lưu ảnh thành tên file theo định dạng
                     //YYYY_MM_DD_HH_mm_ss
                     if (_selected == null || RAWFileNameWillbeCreated == "NONE_SELECTED")
                     {
                         _isSelected = false;
                         RAWFileNameWillbeCreated = "NONE_SELECTED_" + Utility.GetYYYYMMDDHHMMSS(DateTime.Now);
                         if (!Directory.Exists(txtImgDir.Text + @"\" + SubDirLv1() + @"\" + SubDirLv2_Patient() + @"\NONE_SELECTED")) Directory.CreateDirectory(txtImgDir.Text + @"\" + SubDirLv1() + @"\" + SubDirLv2_Patient() + @"\NONE_SELECTED");
                         RAWFilePath = txtImgDir.Text + @"\" + SubDirLv1() + @"\" + SubDirLv2_Patient() + @"\NONE_SELECTED\" + RAWFileNameWillbeCreated + ".RAW";
                     }
                     else
                         RAWFilePath = txtImgDir.Text + @"\" + SubDirLv1() + @"\" + SubDirLv2_Patient() + @"\" + RAWFileNameWillbeCreated + ".RAW";//RAWFileNameWillbeCreated=REGNUM+_Detail_ID+_ACode+_Pcode tại phần click của Scheduled
                     fileName = Application.StartupPath + @"\DemoImg\" + m_strCurrACode + "-" + m_strCurrPCode + ".DCM";
                     string destFile = RAWFilePath.ToUpper().Replace(".RAW", ".DCM");
                     try2MoveFileInDemoMode(fileName, destFile);
                     fileName = destFile;
                     //Tự động cập nhật kết quả đã có hình ảnh
                     AutoUpdateResultAfterCapturingPictureFromModality();
                     AutoUpdatePatientInforInDcmFile_DemoMode(Path.GetDirectoryName(fileName), fileName, txtID2.Text, txtName2.Text, txtAge.Text, Sex,_selected.StudyInstanceUID, _selected.SeriesInstanceUID, _selected.SOPInstanceUID);
                 }
                 #endregion

                 isLoadding = true;
                 //stopToolStripMenuItem1_Click(mnuStop, new EventArgs());
                 TempCrop = IsCroping;
                 int _ww = 0;
                 int _wc = 0;
                 this.Text = MultiLanguage.GetText(globalVariables.DisplayLanguage, "VietBaIT JCS - DROC", "VietBaIT JSC-DROC");
                 if (!IsCroping) FilePath = fileName;
                 bool IsRawFile = false;
                 _images = 1;
                
                     try
                     {
                         #region Xử lý lại ảnh dcm từ ảnh gốc(Raw file)
                         try
                         {
                             if (IsGenDcmFromRaw)
                             {
                                 IsGenDcmFromRaw = false;
                                 string tempf_raw = fileName.ToUpper().Replace(".DCM", ".RAW");

                                 //Kiểm tra xem có ảnh Raw không
                                 if (File.Exists(tempf_raw))
                                 {
                                     //xóa file Dcm đang có
                                     string tempf_dcm = fileName.ToUpper().Replace(".RAW", ".DCM");
                                     try
                                     {
                                         File.Delete(tempf_dcm);
                                     }
                                     catch
                                     {
                                     }
                                     //Gán lại giá trị cho fileName để bước kế tiếp load lại raw file
                                     fileName = tempf_raw;
                                 }

                             }
                         }
                         catch(Exception ex0)
                         {
                             AppLogger.LogAction.LogActions("==>OpenDicom.if (IsGenDcmFromRaw)().Exception occurred at " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "." + ex0.ToString());
                         }
                         try
                         {
                             if (Path.GetExtension(fileName).ToUpper().Contains("RAW"))
                             {
                                 if (IsUsingDicomConverter || lblAutoDcmConverter.IsChecked)//Tự động convert thành file Dicom
                                 {
                                     ConvertRaw2DicomFileReprocess(fileName);
                                     AutoUpdateResultAfterCapturingPictureFromModality();
                                     fileName = fileName.ToLower().Replace(".raw", ".dcm");
                                     IsUsingDicomConverter = true;
                                     v_blnHasConvertRawin2DicomFile = true;
                                     //Thực hiện thuật toán xử lý ảnh ở ngay sau bước load ảnh Dicom

                                 }
                                 else
                                 {
                                     new frm_LargeMsgBoxOK(MultiLanguage.GetText(globalVariables.DisplayLanguage, "Thông báo", "Warning"), MultiLanguage.GetText(globalVariables.DisplayLanguage, "Cần vào tab Cấu hình đánh dấu vào mục tự động Convert thành file Dicom", "go to Configuration Tab and check Auto Convert to Dicom File"), MultiLanguage.GetText(globalVariables.DisplayLanguage, "Đã hiểu", "OK"), MultiLanguage.GetText(globalVariables.DisplayLanguage, "Không hiểu", "Cancel")).ShowDialog();
                                 }
                             }
                         }
                         catch (Exception ex01)
                         {
                             AppLogger.LogAction.LogActions("==>OpenDicom.ReGenDcmFromRAWFile().Exception occurred at " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "." + ex01.ToString());
                         }
                         #endregion
                         
                         if (File.Exists(fileName))
                         {
                             AppLogger.LogAction.AddLog2List(lstFPD560,DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + fileName + " exists");
                             FreeMemoryCapturedByMedicalviewerCell();
                             using (RasterCodecs _codecs = new RasterCodecs())
                             {
                                 //using (CounterDialog counter = new CounterDialog(this, _codecs))
                                 //{
                                 //    counter.Show(this);
                                 //    counter.Update();
                                 //if (chkLoadIn2Memory.IsChecked==false ) _codecs.Options.Load.DiskMemory = true;

                                 if (_codecs.Options.Load.DiskMemory) SetText(lblUsingMemo, "MEM");
                                 else SetText(lblUsingMemo, "NOTMEM");
                                 using (RasterImage _image = _codecs.Load(fileName))
                                 {

                                     cmdCreateDcmfromRaw.Enabled = true;
                                     //try2FreeImage(orginalImg);
                                    _DicomMedicalViewer.try2FreeImage(ref orginalImg);
                                     // try2FreeOriginalImage();
                                     if (_CurrCell != null)
                                     {
                                         RasterImage img = _CurrCell.Image;
                                         _DicomMedicalViewer.try2FreeImage(ref img);
                                     }
                                     orginalImg = _image.CloneAll();
                                     //Xóa các cell sau khi đã giải phóng bộ nhớ
                                     _DicomMedicalViewer._medicalViewer.Cells.Clear();
                                     //Tạo cell mới
                                     MedicalViewerMultiCell cell = new MedicalViewerMultiCell();
                                     cell.BeginUpdate();
                                     cell.FitImageToCell = true;
                                     cell.Columns = 1;
                                     cell.Rows = 1;
                                     _DicomMedicalViewer.InitializeCell(cell);
                                     _DicomMedicalViewer.CopyPropertiesFromGlobalCell(cell);
                                     _Idx = 0;
                                     if (IsOnlyImg) return;
                                     CurrCellFileName = fileName;
                                     //cell.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);
                                     cell.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);
                                     cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
                                     //cell.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);
                                     cell.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit);
                                     DicomDataSet ds = new DicomDataSet();

                                     try
                                     {
                                         ds.Load(fileName, DicomDataSetLoadFlags.LoadAndClose);
                                         CurrentDicomDS = ds;
                                     }
                                     catch (Exception ex) { ds = null; }
                                     //DicomDS.Add(fileName, ds);
                                     if (ds != null)
                                     {

                                         if (IsRawFile)
                                             AutpSetDefaultTagForImgInfor(fileName, ds);
                                         _ww = Convert.ToInt32(GetStringValue(ds, DicomTag.WindowWidth));
                                         _wc = Convert.ToInt32(GetStringValue(ds, DicomTag.WindowCenter));
                                         string ID_Name = GetStringValue(ds, Leadtools.Dicom.DicomTag.PatientID) + " " + GetStringValue(ds, Leadtools.Dicom.DicomTag.PatientName);
                                         string Birthday_Sex_Age = "";
                                         string BD = GetStringValue(ds, Leadtools.Dicom.DicomTag.PatientBirthDate).Trim();
                                         string BT = GetStringValue(ds, Leadtools.Dicom.DicomTag.PatientBirthTime).Trim();
                                         string Sex = TranslateSex(GetStringValue(ds, Leadtools.Dicom.DicomTag.PatientSex).Trim());
                                         string Age = GetStringValue(ds, Leadtools.Dicom.DicomTag.PatientAge).Trim();
                                         ID_Name_Age_Sex = ID_Name + " " + Age + " " + Sex;
                                         if (BD != "") Birthday_Sex_Age += BD;
                                         //if (BT != "") Birthday_Sex_Age += BD;
                                         if (Sex != "") Birthday_Sex_Age += " [" + Sex + "] ";
                                         if (Age != "") Birthday_Sex_Age += Age + " T";
                                         //Mã+Tên BN
                                         cell.SetTag(0, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, ID_Name);
                                         //Ngày sinh-Giới tính-Tuổi
                                         cell.SetTag(1, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, Birthday_Sex_Age);
                                         //Các thông tin khác

                                         cell.SetTag(0, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, HospitalName);
                                         cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, DepartmentName);
                                         cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
                                     }
                                     else
                                     {
                                         //Mã+Tên BN
                                         cell.SetTag(0, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "");
                                         //Ngày sinh-Giới tính-Tuổi
                                         cell.SetTag(1, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "");
                                         //Các thông tin khác

                                         cell.SetTag(0, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "");
                                         cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "");
                                         cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "");
                                     }

                                     //Load Annotation
                                     string Anfn = GetAnnPath(fileName);
                                     if (System.IO.File.Exists(Anfn))
                                     {
                                         LoadAnnotation(cell, Anfn, true);
                                     }

                                    _DicomMedicalViewer.ApplyToCell(cell);
                                     cell.ShowTags = lblDisplayTag.IsChecked;
                                     cell.DisplayRulers = (MedicalViewerRulers)cboRuler.SelectedIndex;
                                     AddNewMecicalViewerCell(cell);
                                     int CellCount = _DicomMedicalViewer._medicalViewer.Cells.Count;
                                     _Idx = CellCount - 1;
                                     //Dùng CloneAll() để giải phóng _image

                                     cell.Tag = fileName;
                                     if (GetSelectedScheduled() != null)
                                         cell.TabIndex = GetSelectedScheduled().DETAIL_ID;
                                     else
                                         cell.TabIndex = m_intCurrentDetail_ID <= 0 ? 0 : m_intCurrentDetail_ID;
                                     //v_blnHasConvertRawin2DicomFile=true xảy ra ở 2 sự kiện
                                     //1. Nhận ảnh từ FPD và có tự động chuyển thành file Dicom
                                     //2. Nhận ảnh từ FPD và để dưới dạng file RAW, sau đó tại hàm OpenDicom() nếu chưa có ảnh Dcm sẽ tự động Convert file RAW thành DCM
                                     if (v_blnHasConvertRawin2DicomFile && lblDisplayRaw.ImageIndex != 0)
                                     {
                                             using (Cursor _Cursor = Cursors.WaitCursor)
                                             {
                                                 AppLogger.LogAction.ShowEventStatus(lblFPDStatus,MultiLanguage.GetText(globalVariables.DisplayLanguage, "Đang xử lý ảnh...", "image processing..."));
                                                 AppLogger.LogAction.AddLog2List(lstFPD560,DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + MultiLanguage.GetText(globalVariables.DisplayLanguage, "Đang xử lý ảnh...", "image processing..."));
                                                 _DicomMedicalViewer.ApplyIEConfig(_currDRIEData, _image, lblGridMode.IsChecked, lblAppliedMed.IsChecked);
                                                 AutoApplyWW_WC(_image);
                                                 AppLogger.LogAction.AddLog2List(lstFPD560,DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + MultiLanguage.GetText(globalVariables.DisplayLanguage, "Đã xử lý xong...", "image processed..."));
                                                 AppLogger.LogAction.ShowEventStatus(lblFPDStatus,MultiLanguage.GetText(globalVariables.DisplayLanguage, "Đã xử lý xong...", "image processed..."));

                                                 if ( ((_FPDMode != AppType.AppEnum.FPDMode.Other && chkAutoVFlip1.IsChecked) || (_FPDMode == AppType.AppEnum.FPDMode.Other && ((FPDSeq == 1 && chkAutoVFlip1.IsChecked) || (FPDSeq == 2 && chkAutoVFlip2.IsChecked)))))
                                                 {
                                                     _DicomMedicalViewer.ApplyFilter(_image, new FlipCommand(true));
                                                 }
                                                 if (((_FPDMode != AppType.AppEnum.FPDMode.Other && chkAutoHFlip1.IsChecked) || (_FPDMode == AppType.AppEnum.FPDMode.Other && ((FPDSeq == 1 && chkAutoHFlip1.IsChecked) || (FPDSeq == 2 && chkAutoHFlip2.IsChecked)))))
                                                 {
                                                     _DicomMedicalViewer.ApplyFilter(_image, new FlipCommand(false));
                                                 }
                                                 if (AUTO_FLIPV == 1)
                                                 {
                                                     _DicomMedicalViewer.ApplyFilter(_image, new FlipCommand(true));
                                                 }
                                                 if (AUTO_FLIPH == 1)
                                                 {
                                                     _DicomMedicalViewer.ApplyFilter(_image, new FlipCommand(false));
                                                 }
                                                 AutoDetectRowsAndCols(cell, _image.PageCount);
                                                 cell.Image = _image.CloneAll();
                                                 if (!_DicomMedicalViewer.IsValidCell()) return;
                                                 _DicomMedicalViewer._medicalViewer.Cells.SelectAll(false);
                                                 _DicomMedicalViewer._medicalViewer.VisibleRow = _Idx;
                                                 cell.Selected = true;
                                                 _DicomMedicalViewer._medicalViewer.Invalidate();
                                                 if (AllowAppliedWL)
                                                 {
                                                     _DicomMedicalViewer.SetWindowLevel(cell, WW,WC);
                                                     
                                                 }
                                                 AllowAppliedWL = true;
                                             }

                                             _ww = WW;
                                             _wc = WC;
                                         //Thử tạo thông tin Annotation
                                         //CreateDefaultAnnotationOnImage(_DicomMedicalViewer._medicalViewer, Color.White, Color.Black, HospitalName, DepartmentName, ID_Name_Age_Sex, DateTime.Now.ToString("dd/MM/yyyy"));
                                         SaveImg();
                                         v_blnHasConvertRawin2DicomFile = false;
                                         //Tự động chuyển sang Tab xử lý ảnh
                                         tabCtrlAcq.SelectedTab = tabPageImgTools;
                                         //PlayBeep(5);
                                     }
                                     else
                                     {
                                         AutoDetectRowsAndCols(cell, _image.PageCount);
                                         cell.Image = _image.CloneAll();
                                         //cell.Bounds = cell.GetDisplayedClippedImageRectangle();
                                         if (!_DicomMedicalViewer.IsValidCell()) return;
                                         _DicomMedicalViewer._medicalViewer.Cells.SelectAll(false);
                                         _DicomMedicalViewer._medicalViewer.VisibleRow = _Idx;
                                         cell.Selected = true;
                                         _DicomMedicalViewer._medicalViewer.Invalidate();
                                         if (_AppMode == AppType.AppEnum.AppMode.Demo && FirstExposure)
                                         {
                                             SaveImg();
                                         }
                                     }
                                     //Áp dụng windowLeveling khi thực hiện lưu ảnh.
                                     //AutoApplyWW_WC();
                                     if (_ww != 0)
                                     {
                                         _DicomMedicalViewer.SetWindowLevel(cell,_ww,_wc);

                                         _DicomMedicalViewer._medicalViewer.Invalidate();
                                     }
                                     cell.EndUpdate();
                                     _DicomMedicalViewer._medicalViewer.Invalidate();
                                 }
                                 // }
                             }
                             _DicomMedicalViewer._medicalViewer.EndUpdate();
                             AppLogger.LogAction.ShowEventStatus(lblFPDStatus,MultiLanguage.GetText(globalVariables.DisplayLanguage, "Mời bạn tiếp tục xử lý", "Image Result"));
                         }
                         else
                         {
                             mdlStatic.isDisplayImg = false;
                             if (_AppMode == AppType.AppEnum.AppMode.License || (_AppMode == AppType.AppEnum.AppMode.Demo && _ViewState == AppType.AppEnum.ViewState.Capture))
                                 MessageBox.Show("Không tồn tại file ảnh sau:\n" + fileName);
                         }
                     }
                     catch (Exception ex)
                     {

                         AppLogger.LogAction.LogActions("==>OpenDicom.SecondsException().Exception occurred at " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "." + ex.ToString());
                         Utility.ShowMsg("2225 " + ex.ToString() + "\n" + fileName);
                         GC.Collect();
                         isLoadding = false;
                        
                         DeleteCurrentImg(_DicomMedicalViewer._medicalViewer, _DicomMedicalViewer._medicalViewerCellIndex);

                     }
                     finally
                     {
                         isLoadding = false;

                     }
                
                 isLoadding = false;
             }
             catch (Exception ex1)
             {
                 AppLogger.LogAction.LogActions("==>OpenDicom.FirstException().Exception occurred at " + DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "." + ex1.ToString());
                 AppLogger.LogAction.AddLog2List(lstFPD560,"0002: " + ex1.Message);
             }
             finally
             {
                 _DicomMedicalViewer._medicalViewer.BeginUpdate();
                 pnlScheduled.Enabled = true;
                //_sw.Stop();
                 //AppLogger.LogAction.ShowEventStatus(lblFPDStatus,((decimal)_sw.ElapsedMilliseconds / 1000).ToString());
                 IsUsingDicomConverter = false;
                 lblMemory.Text = getAvailableRAM();
                 //Kiểm tra nếu đang chế độ Crop mà lại chọn mục xem lại ảnh gốc thì cần khôi phục lại chế độ đó
                 if (_DicomMedicalViewer._IsCropping && IsLoadOriginalImage)
                 {
                     cmdAcqCrop_Click(cmdAcqCrop,new EventArgs());//Trạng thái ban đầu
                     cmdAcqCrop_Click(cmdAcqCrop, new EventArgs());//Trạng thái Crop
                 } 
             }
         }
예제 #35
0
파일: DROC.cs 프로젝트: khaha2210/radio
 void ClearSymbolAfterRealizing(MedicalViewerMultiCell _cell)
 {
     try
     {
         _cell.SubCells[0].AnnotationContainer.Objects.Clear();
         _DicomMedicalViewer._medicalViewer.Invalidate();
     }
     catch
     {
     }
     finally
     {
         
     }
 }
예제 #36
0
파일: DROC.cs 프로젝트: khaha2210/radio
        private void mnuReprint_Click(object sender, EventArgs e)
        {
            try
            {
                if (!_DicomMedicalViewer.IsValidCell()) return;
                if (blnHasjustClick) return;
                blnHasjustClick = true;
                AutoCropImageWhenPanOrZoomIn(_CurrCell);
                SaveImg();
                //Test to see
                //pnlDirectPrint.BringToFront();
                Thread.Sleep(10);
                //Chuyển vào Thread để burn chữ và in
                _DicomMedicalViewer._medicalViewerPrintDirect = new MedicalViewer(1, 1);

                _DicomMedicalViewer._medicalViewerPrintDirect.Location = new Point(0, 0);
                _DicomMedicalViewer._medicalViewerPrintDirect.Size = new Size(pnlDirectPrint.ClientRectangle.Right, pnlDirectPrint.ClientRectangle.Bottom);
                pnlDirectPrint.Controls.Add(_DicomMedicalViewer._medicalViewerPrintDirect);

                MedicalViewerMultiCell cell = new MedicalViewerMultiCell();

                cell.Columns = 1;
                cell.Rows = 1;
                AddNewMecicalViewerCell(_DicomMedicalViewer._medicalViewerPrintDirect, cell);

                cell.FitImageToCell = true;

                cell.Image = _CurrCell.Image.CloneAll();
                cell.Tag = _CurrCell.Tag;
                cell.TabIndex = GetSelectedScheduled().DETAIL_ID;

                cell.Selected = true;
                cell.Refresh();
                _DicomMedicalViewer._medicalViewerPrintDirect.Invalidate();
                rePrint = true;
                PrintImg();

            }
            catch
            {
            }
            finally
            {
                blnHasjustClick = false;
            }
        }
예제 #37
0
파일: DROC.cs 프로젝트: khaha2210/radio
 void RealizeAnnotation(RasterImage img, MedicalViewerMultiCell _cell)
 {
     string errMsg = "";
     _DicomMedicalViewer.RealizeAnnotation(img, _cell, ref errMsg);
     if (errMsg.Trim() != "")
     {
         strErrorWhenRealizing = strErrorWhenRealizing + " " + errMsg;
         NoErrorWhilePreparing4Printing = NoErrorWhilePreparing4Printing && false;
     }
     MessageBox.Show(errMsg + @"\n Please realize it again or Contact our support staff(VBITJSC)");
 }
예제 #38
0
        public Form1()
        {
            RasterSupport.SetLicense(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC", System.IO.File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.KEY"));
            InitializeComponent();
            RasterCodecs _codecs = new RasterCodecs();
            RasterImage  _image;
            string       dicomFileName = @"C:\Users\Public\Documents\LEADTOOLS Images\IMAGE3.dcm";

            // Create the medical viewer and adjust the size and the location.
            _medicalViewer          = new MedicalViewer(1, 1);
            _medicalViewer.Location = new Point(0, 0);
            _medicalViewer.Size     = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom);

            // Load an image and then add it to the control.
            _image = _codecs.Load(dicomFileName);

            DicomEngine.Startup();
            using (DicomDataSet ds = new DicomDataSet())
            {
                MedicalViewerMultiCell cell = new MedicalViewerMultiCell(_image, true, 1, 1);

                ds.Load(dicomFileName, DicomDataSetLoadFlags.None);
                string dpatientID        = GetDicomTag(ds, DicomTag.PatientID);
                string dpatientName      = GetDicomTag(ds, DicomTag.PatientName);
                string dpatientAge       = GetDicomTag(ds, DicomTag.PatientAge);
                string dpatientBirthDate = GetDicomTag(ds, DicomTag.PatientBirthDate);
                string dpatientSex       = GetDicomTag(ds, DicomTag.PatientSex);

                // add some actions that will be used to change the properties of the images inside the control.
                cell.AddAction(MedicalViewerActionType.WindowLevel);
                cell.AddAction(MedicalViewerActionType.Offset);
                cell.AddAction(MedicalViewerActionType.Stack);

                // assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated.
                cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);
                cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);
                cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);

                // assign the added actions to a keyboard keys that will work like the mouse.
                MedicalViewerKeys medicalKeys = new MedicalViewerKeys(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None);
                cell.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys);
                medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl;
                cell.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys);
                medicalKeys.MouseDown = Keys.PageDown;
                medicalKeys.MouseUp   = Keys.PageUp;
                cell.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys);
                medicalKeys.MouseDown = Keys.Subtract;
                medicalKeys.MouseUp   = Keys.Add;
                cell.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys);

                _medicalViewer.Cells.Add(cell);

                // adjust some properties of the cell and add some tags.
                cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Name: " + dpatientName);
                cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "ID: " + dpatientID);
                cell.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB: " + dpatientBirthDate);
                cell.SetTag(4, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Age: " + dpatientAge);
                cell.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Sex: " + dpatientSex);

                cell.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);
                cell.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);
                cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
                cell.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);
                cell.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit);

                cell.Rows                     = 1;
                cell.Columns                  = 1;
                cell.Frozen                   = false;
                cell.DisplayRulers            = MedicalViewerRulers.Both;
                cell.ApplyOnIndividualSubCell = false;
                cell.ApplyActionOnMove        = true;
                cell.FitImageToCell           = true;
                cell.Selected                 = true;
                cell.ShowTags                 = true;
            }

            string GetDicomTag(DicomDataSet ds, long tag)
            {
                DicomElement patientElement = ds.FindFirstElement(null,
                                                                  tag,
                                                                  true);

                if (patientElement != null)
                {
                    return(ds.GetConvertValue(patientElement));
                }

                return(null);
            }

            Controls.Add(_medicalViewer);
            _medicalViewer.Dock = DockStyle.Fill;
        }
예제 #39
0
파일: DROC.cs 프로젝트: khaha2210/radio
        public void TestOpen()
        {
            string fileName = @"C:\Images\Chest.dcm";
            if (File.Exists(fileName))
            {
                try
                {

                    using (RasterCodecs _codecs = new RasterCodecs())
                    {
                        using (RasterImage _image = _codecs.Load(fileName))
                        {
                            MedicalViewerMultiCell cell = new MedicalViewerMultiCell();
                            cell.FitImageToCell = true;
                            cell.Columns = 1;
                            cell.Rows = 1;
                            DicomDataSet ds = new DicomDataSet();
                            try
                            {

                                ds.Load(fileName, DicomDataSetLoadFlags.LoadAndClose);
                            }
                            catch (Exception ex) { ds = null; }
                            if (ds != null)
                            {
                                // dosomething here
                            }
                            _DicomMedicalViewer._medicalViewer.Cells.Add(cell);
                            cell.Image = _image.CloneAll();
                            cell.Selected = true;
                            _DicomMedicalViewer._medicalViewer.Invalidate();
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }