Ejemplo n.º 1
0
        void cell_ProbeToolTextChanged(object sender, MedicalViewerProbeToolTextChangedEventArgs e)
        {
            int    bitmapX = (int)(e.X);
            int    bitmapY = (int)(e.Y);
            string output;

            MedicalViewerCell cell  = sender as MedicalViewerCell;
            RasterImage       image = GetCellImage(cell, e.SubCellIndex);

            if (null != image)
            {
                string value = GetRealPixelValue(image, bitmapX, bitmapY);

                if (value != "")
                {
                    output = String.Format("X = {0}, Y = {1} \nValue = {2} \nFrame {3}", (int)e.X, (int)e.Y, value, e.SubCellIndex + 1);
                }
                else
                {
                    output = String.Format("X = N/A, Y = N/A \nValue = N/A \nFrame N/A");
                }

                e.Text = output;
            }
        }
Ejemplo n.º 2
0
        private void _chkToEnd_CheckedChanged(object sender, EventArgs e)
        {
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[0];

            _txtTo.Enabled            = !_chkToEnd.Checked;
            cell.Animation.FrameCount = _chkToEnd.Checked ? -1 : _txtTo.Value;
        }
Ejemplo n.º 3
0
        private void InitializeMedicalViewer()
        {
            try
            {
                MedicalViewerCell cell = new MedicalViewerCell();

                cell.AddAction(MedicalViewerActionType.Stack);
                cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);
                cell.AddAction(MedicalViewerActionType.WindowLevel);
                cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);
                cell.AddAction(MedicalViewerActionType.Scale);
                cell.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);

                _MedicalViewer               = new MedicalViewer.MedicalViewer(1, 1);
                _MedicalViewer.Dock          = DockStyle.Fill;
                _MedicalViewer.SplitterStyle = MedicalViewerSplitterStyle.None;
                _MedicalViewer.Cells.Add(cell);
                _MedicalViewer.Dock = DockStyle.Fill;
                tabPageImages.Controls.Add(_MedicalViewer);
            }
            catch (Exception e)
            {
                Messager.ShowError(this, e);
                Close();
            }
        }
Ejemplo n.º 4
0
        private void UpdatePalettePreview(ComboBox cmbPalette, PictureBox palettePreview)
        {
            byte[] palette = MedicalViewerCell.GetPalette((MedicalViewerPaletteType)cmbPalette.SelectedIndex);
            if (palette != null)
            {
                Color[] colorArray = new Color[palette.Length / 3];
                for (int i = 0; i < palette.Length; i += 3)
                {
                    colorArray[i / 3] = Color.FromArgb(palette[i], palette[i + 1], palette[i + 2]);
                }
                if (palettePreview.Image != null)
                {
                    palettePreview.Image.Dispose();
                    palettePreview.Image = null;
                }
                Image paletteImage = new Bitmap(palettePreview.Width, palettePreview.Height);
                FillImage(paletteImage, colorArray);

                palettePreview.Image = paletteImage;
            }
            else
            {
                palettePreview.Image = null;
            }
        }
Ejemplo n.º 5
0
        public MagnifyGlassProperties(MainForm owner, MedicalViewerCell selectedCell)
        {
            InitializeComponent();

            _Viewer       = owner.Viewer;
            _SelectedCell = selectedCell;

            if (_SelectedCell != null)
            {
                _magnifyGlass = (MedicalViewerMagnifyGlass)(_SelectedCell.GetActionProperties(MedicalViewerActionType.MagnifyGlass));
            }
            else
            {
                _magnifyGlass = (MedicalViewerMagnifyGlass)(MainForm.DefaultCell.GetActionProperties(MedicalViewerActionType.MagnifyGlass));
            }

            _chk3D.Checked              = _magnifyGlass.Border3D;
            _chk3D.Enabled              = !_chkElliptical.Checked;
            _chkElliptical.Checked      = _magnifyGlass.Elliptical;
            _txtWidth.Value             = _magnifyGlass.Width;
            _txtHeight.Value            = _magnifyGlass.Height;
            _txtZoom.Value              = _magnifyGlass.Zoom;
            _txtBorder.Value            = _magnifyGlass.BorderSize;
            _cmbCrosshair.SelectedIndex = (int)_magnifyGlass.Crosshair;
            _lblPenColor.BackColor      = Color.FromArgb(0xff, _magnifyGlass.PenColor.R, _magnifyGlass.PenColor.G, _magnifyGlass.PenColor.B);
        }
Ejemplo n.º 6
0
        private void _radShuffle_CheckedChanged(object sender, EventArgs e)
        {
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[0];

            cell.Animation.Flags &= ~(MedicalViewerAnimationFlags.Loop | MedicalViewerAnimationFlags.Sequence);
            cell.Animation.Flags |= (_radShuffle.Checked ? MedicalViewerAnimationFlags.Loop : MedicalViewerAnimationFlags.Sequence);
        }
Ejemplo n.º 7
0
        private void _cmbFrames_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_viewer != null)
            {
                MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[_cellIndex];
                switch (_cmbFrames.SelectedIndex)
                {
                case 0:
                    cell.Animation.Frames = -1;
                    _txtFrames.Enabled    = false;
                    break;

                case 1:
                    cell.Animation.Frames = 0;
                    _txtFrames.Enabled    = false;
                    break;

                case 2:
                    cell.Animation.Frames = 1;
                    _txtFrames.Enabled    = false;
                    break;

                case 3:
                    cell.Animation.Frames = _txtFrames.Value;
                    _txtFrames.Enabled    = true;
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        public AnimationDialog(MainForm owner, int cellIndex)
        {
            InitializeComponent();
            _viewer    = owner.Viewer;
            _cellIndex = cellIndex;
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[_cellIndex];

            this.Size = new Size(this.Size.Width, 213);
            _grpExtendedParameters.Visible = false;
            _txtFrom.Value = (cell.Animation.StartFrame + 1);
            bool toEnd = cell.Animation.FrameCount == -1;

            _txtTo.Value                    = (cell.Animation.FrameCount == -1) ? cell.Image.PageCount : cell.Animation.FrameCount + 1;
            _chkToEnd.Checked               = toEnd;
            _tbSpeed.Value                  = (301 - cell.Animation.Interval);
            _chkShowAnnotation.Checked      = (cell.Animation.Flags & MedicalViewerAnimationFlags.ShowAnnotations) == MedicalViewerAnimationFlags.ShowAnnotations;
            _chkShowRegion.Checked          = (cell.Animation.Flags & MedicalViewerAnimationFlags.ShowRegions) == MedicalViewerAnimationFlags.ShowRegions;
            _cmbInterpolation.SelectedIndex = (int)(cell.Animation.Flags & (MedicalViewerAnimationFlags.PaintNormal | MedicalViewerAnimationFlags.PaintResample | MedicalViewerAnimationFlags.PaintBicubic));
            _radLoop.Checked                = (cell.Animation.Flags & (MedicalViewerAnimationFlags.Sequence | MedicalViewerAnimationFlags.Loop)) == MedicalViewerAnimationFlags.Sequence;
            _radShuffle.Checked             = !_radLoop.Checked;
            _chkAnimateAllSubCells.Checked  = cell.Animation.AnimateAllSubCells;
            if ((cell.Animation.Flags & MedicalViewerAnimationFlags.PlayOnSelection) == MedicalViewerAnimationFlags.PlayOnSelection)
            {
                cell.Animation.Flags ^= MedicalViewerAnimationFlags.PlayOnSelection;
            }



            if (cell.Animation.Animated)
            {
                if ((int)(cell.Animation.Flags & MedicalViewerAnimationFlags.PlayBackward) != 0)
                {
                    _chkBackward.Checked = true;
                }
                else
                {
                    _chkForward.Checked = true;
                }
            }
            else
            {
                _chkStop.Checked = true;
            }



            switch (cell.Animation.Frames)
            {
            case -1:
            case 0:
            case 1:
                _cmbFrames.SelectedIndex = cell.Animation.Frames + 1;
                break;

            default:
                _cmbFrames.SelectedIndex = 3;
                _txtFrames.Value         = cell.Animation.Frames;
                break;
            }
        }
Ejemplo n.º 9
0
 private void _tbSpeed_Scroll(object sender, EventArgs e)
 {
     if (_viewer != null)
     {
         MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[_cellIndex];
         cell.Animation.Interval = (301 - _tbSpeed.Value);
     }
 }
Ejemplo n.º 10
0
 private void _txtTo_TextChanged(object sender, EventArgs e)
 {
     if (_viewer != null)
     {
         MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[_cellIndex];
         cell.Animation.FrameCount = _txtTo.Value - 1;
     }
 }
Ejemplo n.º 11
0
 private void _chkAnimateAllSubCells_CheckedChanged(object sender, EventArgs e)
 {
     if (_viewer != null)
     {
         MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[_cellIndex];
         cell.Animation.AnimateAllSubCells = _chkAnimateAllSubCells.Checked;
     }
 }
Ejemplo n.º 12
0
        private MedicalViewerCell createNewCell()
        {
            MedicalViewerCell cell = new MedicalViewerCell();

            cell.AddAction(MedicalViewerActionType.Stack);
            cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);

            return(cell);
        }
Ejemplo n.º 13
0
        public WindowLevelPropertiesDialog(MainForm owner, MedicalViewerCell selectedCell)
        {
            InitializeComponent();

            _Viewer = owner.Viewer;
            if (selectedCell == null)
            {
                if (_Viewer.Cells.Count != 0)
                {
                    selectedCell = (MedicalViewerCell)_Viewer.Cells[0];
                }
            }
            _SelectedCell = selectedCell;

            if (selectedCell != null)
            {
                _txtCellIndex.Value = _Viewer.Cells.IndexOf(selectedCell);
            }

            if (selectedCell == null)
            {
                _windowLevel = MainForm.GlobalCell.GetActionProperties(MedicalViewerActionType.WindowLevel, 0) as MedicalViewerWindowLevel;
                _keys        = MainForm.GlobalCell.GetActionKeys(MedicalViewerActionType.WindowLevel);
            }
            else
            {
                _windowLevel = selectedCell.GetActionProperties(MedicalViewerActionType.WindowLevel, 0) as MedicalViewerWindowLevel;
                _keys        = selectedCell.GetActionKeys(MedicalViewerActionType.WindowLevel);
            }

            _cmbFillType.Items.Add(MedicalViewerLookupTableType.Linear);
            _cmbFillType.Items.Add(MedicalViewerLookupTableType.Logarithmic);
            _cmbFillType.Items.Add(MedicalViewerLookupTableType.Exponential);
            _cmbFillType.Items.Add(MedicalViewerLookupTableType.Sigmoid);
            _btnCursor.ButtonCursor = _windowLevel.ActionCursor;

            _lblStart.BoxColor = _windowLevel.StartColor;
            _lblEnd.BoxColor   = _windowLevel.EndColor;
            _txtWidth.Value    = (_windowLevel.Width == 0) ? 1 : _windowLevel.Width;
            _txtCenter.Value   = _windowLevel.Center;
            int index = _cmbFillType.Items.IndexOf(_windowLevel.LookupTableType);

            _cmbFillType.SelectedIndex       = index == -1 ? 0 : index;
            _txtSensitivity.Text             = _windowLevel.Sensitivity.ToString();
            _chkCircular.Checked             = _windowLevel.CircularMouseMove;
            _cmbApplyToCell.SelectedIndex    = 0;
            _cmbApplyToSubCell.SelectedIndex = 0;

            owner.AddKeysToCombo(_cmbLeftKey, _keys.MouseLeft);
            owner.AddKeysToCombo(_cmbRightKey, _keys.MouseRight);
            owner.AddKeysToCombo(_cmbBottomKey, _keys.MouseDown);
            owner.AddKeysToCombo(_cmbTopKey, _keys.MouseUp);
            owner.AddModifiersToCombo(_cmbModifiers, _keys.Modifiers);

            _cmbApplyToCell.Enabled = (owner.Viewer.Cells.Count != 0);
        }
Ejemplo n.º 14
0
        private void InitializeMedicalViewer()
        {
            MedicalViewerCell cell = createNewCell();

            _MedicalViewer               = new MedicalViewer(1, 1);
            _MedicalViewer.Dock          = DockStyle.Fill;
            _MedicalViewer.SplitterStyle = MedicalViewerSplitterStyle.None;
            _MedicalViewer.Cells.Add(cell);
            splitContainer.Panel2.Controls.Add(_MedicalViewer);
        }
Ejemplo n.º 15
0
        private void _chkShowAnnotation_CheckedChanged(object sender, EventArgs e)
        {
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[0];

            cell.Animation.Flags &= ~(MedicalViewerAnimationFlags.ShowAnnotations);
            if (_chkShowAnnotation.Checked)
            {
                cell.Animation.Flags |= MedicalViewerAnimationFlags.ShowAnnotations;
            }
        }
Ejemplo n.º 16
0
        public ArrowAnnotationDialog(MainForm owner)
        {
            InitializeComponent();

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

            _arrowAnnotation          = (MedicalViewerAnnotationArrow)(cell.GetActionProperties(MedicalViewerActionType.AnnotationArrow));
            _lblColor.BackColor       = Color.FromArgb(0xff, _arrowAnnotation.AnnotationColor);
            _cmbApplyTo.SelectedIndex = (int)_arrowAnnotation.Flags;
        }
Ejemplo n.º 17
0
        void _chkStop_Click(object sender, System.EventArgs e)
        {
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[0];

            if (_chkForward.Checked | _chkBackward.Checked)
            {
                _chkForward.Checked  = false;
                _chkBackward.Checked = false;

                cell.Animation.Animated = false;
            }
        }
Ejemplo n.º 18
0
        public RectangleAnnotationDialog(MainForm owner)
        {
            InitializeComponent();

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

            _cmbApplyTo.SelectedIndex = 0;
            _rectangleAnnotation      = (MedicalViewerAnnotationRectangle)(cell.GetActionProperties(MedicalViewerActionType.AnnotationRectangle));
            _lblColor.BackColor       = Color.FromArgb(0xff, _rectangleAnnotation.AnnotationColor);
            _radCenter.Checked        = _rectangleAnnotation.CreateFromCenter;
        }
Ejemplo n.º 19
0
        private void _txtFrames_TextChanged(object sender, EventArgs e)
        {
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[0];

            if (_txtFrames.Value == 1)
            {
                cell.Animation.Frames = -1;
            }
            else
            {
                cell.Animation.Frames = _txtFrames.Value;
            }
        }
Ejemplo n.º 20
0
        private void InitializeMedicalViewer()
        {
            MedicalViewerCell cell = new MedicalViewerCell();

            cell.AddAction(MedicalViewerActionType.Stack);
            cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active);

            _MedicalViewer               = new MedicalViewer(1, 1);
            _MedicalViewer.Dock          = DockStyle.Fill;
            _MedicalViewer.SplitterStyle = MedicalViewerSplitterStyle.None;
            _MedicalViewer.Cells.Add(cell);
            tabPageViewer.Controls.Add(_MedicalViewer);
        }
Ejemplo n.º 21
0
        public SetActionDialog(MainForm owner, MedicalViewer viewer, MedicalViewerCell selectedCell, MedicalViewerActionType actionType)
        {
            InitializeComponent();
            _viewer       = viewer;
            _actionType   = actionType;
            _SelectedCell = selectedCell;
            this.Text     = "Set " + GetSeparatedText(actionType.ToString()) + " Action";

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

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

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

            MedicalViewerActionFlags actionFlags = selectedCell.GetActionFlags(actionType);

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

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

            _cmbMouseButton.SelectedIndex = (int)selectedCell.GetActionButton(actionType);
        }
Ejemplo n.º 22
0
        private void _chkBackward_Click(object sender, System.EventArgs e)
        {
            MedicalViewerCell cell = (MedicalViewerCell)_viewer.Cells[0];

            if (!_chkBackward.Checked)
            {
                _chkStop.Checked     = false;
                _chkForward.Checked  = false;
                _chkBackward.Checked = true;

                cell.Animation.Flags   &= ~(MedicalViewerAnimationFlags.PlayForward | MedicalViewerAnimationFlags.PlayBackward);
                cell.Animation.Flags   |= MedicalViewerAnimationFlags.PlayBackward;
                cell.Animation.Animated = _chkBackward.Checked;
            }
        }
Ejemplo n.º 23
0
        private void _btnApply_Click(object sender, EventArgs e)
        {
            _arrowAnnotation.Flags           = ((MedicalViewerAnnotationFlags)_cmbApplyTo.SelectedIndex);
            _arrowAnnotation.AnnotationColor = _lblColor.BackColor;

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

            cell.SetActionProperties(MedicalViewerActionType.AnnotationArrow, _arrowAnnotation);

            foreach (MedicalViewerMultiCell viewerCell in viewer.Cells)
            {
                viewerCell.SetActionProperties(MedicalViewerActionType.AnnotationArrow, _arrowAnnotation);
            }
        }
Ejemplo n.º 24
0
        private void LoadImage(RasterImage image)
        {
            int count = 0;

            Clear();
            if (image == null)
            {
                count = _DataSet.GetImageCount(null);
                if (count > 0)
                {
#if !LEADTOOLS_V20_OR_LATER
                    DicomGetImageFlags getImageFlags =
                        DicomGetImageFlags.AutoApplyModalityLut |
                        DicomGetImageFlags.AutoApplyVoiLut |
                        DicomGetImageFlags.AutoScaleModalityLut |
                        DicomGetImageFlags.AutoScaleVoiLut |
                        DicomGetImageFlags.AutoDectectInvalidRleCompression;
#else
                    DicomGetImageFlags getImageFlags =
                        DicomGetImageFlags.AutoApplyModalityLut |
                        DicomGetImageFlags.AutoApplyVoiLut |
                        DicomGetImageFlags.AutoScaleModalityLut |
                        DicomGetImageFlags.AutoScaleVoiLut |
                        DicomGetImageFlags.AutoDetectInvalidRleCompression;
#endif // #if !LEADTOOLS_V20_OR_LATER

                    image = _DataSet.GetImages(null, 0, count, 0, RasterByteOrder.Rgb | RasterByteOrder.Gray,
                                               getImageFlags);
                }

                animationToolStripMenuItem.Enabled = count > 1;
            }

            if (image != null)
            {
                MedicalViewerCell cell = _MedicalViewer.Cells[0] as MedicalViewerCell;

                cell.Image          = image;
                cell.FitImageToCell = true;
                if (image.GrayscaleMode != RasterGrayscaleMode.None)
                {
                    cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
                    cell.SetTag(0, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.Frame);
                }

                animationToolStripMenuItem.Enabled = image.PageCount > 1;
            }
        }
Ejemplo n.º 25
0
        private RasterImage GetCellImage(MedicalViewerCell cell, int subCellIndex)
        {
            if (cell.VirtualImage == null)
            {
                return(cell.Image);
            }
            else
            {
                if (cell.VirtualImage[subCellIndex].ImageExist)
                {
                    return(cell.VirtualImage[subCellIndex].Image);
                }
            }

            return(null);
        }
Ejemplo n.º 26
0
        public OffsetPropertiesDialog(MainForm owner, MedicalViewerCell selectedCell)
        {
            InitializeComponent();
            _Viewer = owner.Viewer;
            if (selectedCell == null)
            {
                if (_Viewer.Cells.Count != 0)
                {
                    selectedCell = (MedicalViewerCell)_Viewer.Cells[0];
                }
            }
            _SelectedCell = selectedCell;

            if (selectedCell != null)
            {
                _txtCellIndex.Value = _Viewer.Cells.IndexOf(selectedCell);
            }

            if (_SelectedCell != null)
            {
                _offset = (MedicalViewerOffset)(_SelectedCell.GetActionProperties(MedicalViewerActionType.Offset, _txtCellIndex.Value));
                _keys   = _SelectedCell.GetActionKeys(MedicalViewerActionType.Offset);
            }
            else
            {
                _offset = (MedicalViewerOffset)(MainForm.DefaultCell.GetActionProperties(MedicalViewerActionType.Offset, _txtCellIndex.Value));
                _keys   = MainForm.DefaultCell.GetActionKeys(MedicalViewerActionType.Offset);
            }

            _btnActionCursor.ButtonCursor = _offset.ActionCursor;

            _cmbApplyToCell.SelectedIndex = 0;
            _txtX.Value = _offset.X;
            _txtY.Value = _offset.Y;

            _txtSensitivity.Value = _offset.Sensitivity;
            _chkCircular.Checked  = _offset.CircularMouseMove;

            owner.AddKeysToCombo(_cmbLeftKey, _keys.MouseLeft);
            owner.AddKeysToCombo(_cmbRightKey, _keys.MouseRight);
            owner.AddKeysToCombo(_cmbBottomKey, _keys.MouseDown);
            owner.AddKeysToCombo(_cmbTopKey, _keys.MouseUp);
            owner.AddModifiersToCombo(_cmbModifiers, _keys.Modifiers);

            _cmbApplyToCell.Enabled = (owner.Viewer.Cells.Count != 0);
        }
Ejemplo n.º 27
0
        public PrintCellDialog(MainForm owner, MedicalViewerCell selectedCell)
        {
            InitializeComponent();
            _SelectedCell = selectedCell;

            image        = null;
            subCellIndex = 0;
            exploded     = false;
            SuspendLayout();
            _chkPrintAll.Checked     = true;
            _chkAll.Checked          = true;
            _txtIndex.MaximumAllowed = _SelectedCell.Image.PageCount;
            EnableOptionsCheckBoxs(false);
            EnableAdditionalOptionsCheckBoxs(false);
            ResumeLayout(false);

            UpdateCellImage(owner);
        }
Ejemplo n.º 28
0
        public StackPropertiesDialog(MainForm owner, MedicalViewerCell selectedCell)
        {
            InitializeComponent();
            _Viewer = owner.Viewer;
            if (selectedCell == null)
            {
                if (_Viewer.Cells.Count != 0)
                {
                    selectedCell = (MedicalViewerCell)_Viewer.Cells[0];
                }
            }
            _SelectedCell = selectedCell;

            if (selectedCell != null)
            {
                _txtCellIndex.Value = _Viewer.Cells.IndexOf(selectedCell);
            }

            if (selectedCell != null)
            {
                _stack = (MedicalViewerStack)(_SelectedCell.GetActionProperties(MedicalViewerActionType.Stack));
                _keys  = _SelectedCell.GetActionKeys(MedicalViewerActionType.Stack);
            }
            else
            {
                _stack = (MedicalViewerStack)(MainForm.GlobalCell.GetActionProperties(MedicalViewerActionType.Stack, _txtCellIndex.Value));
                _keys  = MainForm.GlobalCell.GetActionKeys(MedicalViewerActionType.Stack);
            }

            _btnActionCursor.ButtonCursor = _stack.ActionCursor;

            _txtSensitivity.Value   = _stack.Sensitivity;
            _chkCircular.Checked    = _stack.CircularMouseMove;
            _txtStack.Value         = _stack.ScrollValue;
            _txtActiveSubCell.Value = _stack.ActiveSubCell;

            _cmbApplyToCells.SelectedIndex = 0;

            owner.AddKeysToCombo(_cmbTopKey, _keys.MouseUp);
            owner.AddKeysToCombo(_cmbBottomKey, _keys.MouseDown);
            owner.AddModifiersToCombo(_cmbModifiers, _keys.Modifiers);

            _cmbApplyToCells.Enabled = (owner.Viewer.Cells.Count != 0);
        }
Ejemplo n.º 29
0
        public ScalePropertiesDialog(MainForm owner, MedicalViewerCell selectedCell)
        {
            InitializeComponent();
            _Viewer = owner.Viewer;
            if (selectedCell == null)
            {
                if (_Viewer.Cells.Count != 0)
                {
                    selectedCell = (MedicalViewerCell)_Viewer.Cells[0];
                }
            }
            _SelectedCell = selectedCell;

            if (selectedCell != null)
            {
                _txtCellIndex.Value = _Viewer.Cells.IndexOf(selectedCell);
            }

            if (_SelectedCell != null)
            {
                _scale = (MedicalViewerScale)(_SelectedCell.GetActionProperties(MedicalViewerActionType.Scale));
                _keys  = _SelectedCell.GetActionKeys(MedicalViewerActionType.Scale);

                _chkBoxDynamic.Checked = _SelectedCell.ScaleType == MedicalViewerScaleType.Dynamic;
            }
            else
            {
                _scale = (MedicalViewerScale)(MainForm.DefaultCell.GetActionProperties(MedicalViewerActionType.Scale));
                _keys  = MainForm.DefaultCell.GetActionKeys(MedicalViewerActionType.Scale);

                MainForm.DefaultCell.ScaleType = _chkBoxDynamic.Checked ? MedicalViewerScaleType.Dynamic : MedicalViewerScaleType.Normal;
            }

            _btnCursor.ButtonCursor        = _scale.ActionCursor;
            _cmbApplyToCells.SelectedIndex = 0;
            _txtSensitivity.Value          = _scale.Sensitivity;
            _chkCircular.Checked           = _scale.CircularMouseMove;
            _txtScale.Value = _scale.Scale;
            owner.AddKeysToCombo(_cmbTopKey, _keys.MouseUp);
            owner.AddKeysToCombo(_cmbBottomKey, _keys.MouseDown);
            owner.AddModifiersToCombo(_cmbModifiers, _keys.Modifiers);

            _cmbApplyToCells.Enabled = (owner.Viewer.Cells.Count != 0);
        }
Ejemplo n.º 30
0
        public MultiscaleEnhancementDialog(MainForm mainForm, MedicalViewerCell cell)
        {
            _mainForm = mainForm;
            InitializeComponent();

            int orignalPage = cell.Image.Page;

            cell.Image.Page = cell.ActiveSubCell + 1;

            int uMaxLevels = Math.Max(cell.Image.Width, cell.Image.Height);

            int nRangeMax = (int)Math.Ceiling(Math.Log(uMaxLevels) / Math.Log(2.0));

            _numEdgeLevel.Maximum = new decimal(nRangeMax);
            _numLatLevel.Maximum  = new decimal(nRangeMax);

            _cbFilter.SelectedIndex = 3;
            _firstTime = true;
        }
Ejemplo n.º 31
0
        private void SaveImg(MedicalViewerCell _cell, string newFile, DicomDataSet CurrentDicomDS)
        {
            try
            {
                DataRow dr = MakeDcmConverterInfor(_cell, CurrentDicomDS);
                _DicomMedicalViewer.SaveUsingCC(_cell, newFile, dr, CurrentDicomDS);

            }
            catch
            {
            }
        }
Ejemplo n.º 32
0
 void RealizeAnnotation(MedicalViewerCell _cell)
 {
     _DicomMedicalViewer.RealizeAnnotation(_cell);
 }
Ejemplo n.º 33
0
 void SaveThumbnail(MedicalViewerCell _cell)
 {
     try
     {
         string _dcmFile = "";
         if (_cell.Tag != null) _dcmFile = _cell.Tag.ToString();
         int Detail_ID = _cell.TabIndex;
         if (_dcmFile.Trim() != "")
         {
             using (RasterCodecs _Codecs = new RasterCodecs())
             {
                 using (RasterImage _temp = _Codecs.Load(_dcmFile))
                 {
                     _Codecs.Save(_temp.CreateThumbnail(83, 100, _temp.BitsPerPixel, _temp.ViewPerspective, RasterSizeFlags.Bicubic), thumbnailFileName, RasterImageFormat.Png, 8);
                     UpdateThumbnailImgOnScheduled(thumbnailFileName,Detail_ID, 1);
                 }
             }
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 34
0
 private bool BurnText16(MedicalViewerCell _cell)
 {
     string errMsg = "";
     bool reval = _DicomMedicalViewer.BurnText16(_cell, ref errMsg);
     if (errMsg.Trim() != "")
     {
         strErrorWhenRealizing = "BurnText16:" + strErrorWhenRealizing + " " + errMsg;
         NoErrorWhilePreparing4Printing = NoErrorWhilePreparing4Printing && reval;
     }
     return reval;
 }
Ejemplo n.º 35
0
 void AutoCropImageWhenPanOrZoomIn(MedicalViewerCell cell)
 {
     _DicomMedicalViewer.AutoCropImageWhenPanOrZoomIn(_CurrCell);
 }
Ejemplo n.º 36
0
        private void AutoApplyWW_WC(MedicalViewerCell cell, int _WW, int _WC)
        {

            try
            {
                if (cell.Image.Order == RasterByteOrder.Gray && cell.Image.BitsPerPixel > 8)
                {
                    // update lookup table

                    try
                    {

                        ApplyLinearVoiLookupTableCommand command = new ApplyLinearVoiLookupTableCommand();
                        MinMaxBitsCommand minMaxBits = new MinMaxBitsCommand();
                        MinMaxValuesCommand minMaxValues = new MinMaxValuesCommand();
                        //if (ADJUST_WOB)
                        //command.Flags = VoiLookupTableCommandFlags.ReverseOrder;
                        // else
                        command.Flags = VoiLookupTableCommandFlags.None;

                        minMaxBits.Run(cell.Image);
                        cell.Image.LowBit = minMaxBits.MinimumBit;
                        cell.Image.HighBit = minMaxBits.MaximumBit;
                        minMaxValues.Run(cell.Image);
                        command.Width = _WW;
                        command.Center = _WC;
                        command.Run(cell.Image);
                        cell.Invalidate();
                        WindowLevelCommand _WindowLevelCommand = new WindowLevelCommand();
                        _WindowLevelCommand.HighBit = cell.Image.HighBit;
                        _WindowLevelCommand.LowBit = cell.Image.LowBit;
                        _WindowLevelCommand.LookupTable = cell.Image.GetLookupTable();
                        //_WindowLevelCommand.Order = RasterByteOrder.Rgb;
                        _WindowLevelCommand.Run(cell.Image);
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
            finally
            {

            }
        }
Ejemplo n.º 37
0
        DataRow MakeDcmConverterInfor(MedicalViewerCell _cell, DicomDataSet ds)
        {

            try
            {
                DataRow dr = m_dtDicomconverterInfo.NewRow();
                dr[colPid] = "PATIENT_ID";
                dr[colPatientName] = "PATIENT_NAME";
                dr[colPatientSex] = "M";
                dr[colPatientAge] = "0";
                dr[colPatientBirthdate] = ToDicomString(DateTime.Now);
                dr[colRegDate] = ToDicomString(DateTime.Now);
                dr[colRegNum] = "REG_NUMBER";
                dr[colKVP] = "96";
                dr[colMAS] = "7";

                dr[colImgHeight] = _cell.Image.Height;
                dr[colImgWidth] = _cell.Image.Width;

                dr[colModalityCode] = GetStringValue(ds, DicomTag.Modality);
                dr[colAtonomyCode] = "A_CODE";
                dr[colProjectionCode] = "P_CODE";
                dr[colHostpitalName] = Bodau(HospitalName);
                dr[colDepartmentName] = Bodau(DepartmentName);
                dr[colAcqDate] = Utility.GetYYYYMMDD(DateTime.Now);
                dr[colAppName] = "DROC";
                dr[_colStudyInstanceUID] = ClearCanvas.Dicom.DicomUid.GenerateUid().UID.ToString();
                dr[colSOPInstanceUID] = ClearCanvas.Dicom.DicomUid.GenerateUid().UID.ToString();
                dr[colSeriesInstanceUID] = ClearCanvas.Dicom.DicomUid.GenerateUid().UID.ToString();
                dr[colBitsStored] = GetStringValue(ds, DicomTag.BitsStored);
                dr[colHightBit] = GetStringValue(ds, DicomTag.HighBit);
                dr[colBitsAllocated] = GetStringValue(ds, DicomTag.BitsAllocated);
                return dr;
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi khi tạo thông tin BN để dùng cho hàm DicomConverter\n" + ex.Message);
                return null;
            }
        }
Ejemplo n.º 38
0
        bool hasAnnObjects(MedicalViewerCell _cell)
        {
            return _DicomMedicalViewer.hasAnnTextObjects(_cell);

        }
Ejemplo n.º 39
0
        void ClearSymbolAfterRealizing(MedicalViewerCell _cell)
        {
            try
            {
                _cell.SubCells[0].AnnotationContainer.Objects.Clear();
                _DicomMedicalViewer._medicalViewer.Invalidate();

            }
            catch
            {
            }
            finally
            {
                //SaveAnnotation(CurrCellFileName);
            }
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Hiển thị thông tin ảnh
        /// </summary>
        /// <param name="cell">Cell chứa ảnh cần hiển thị thông tin</param>
        /// <param name="AutoHide">true=Người dùng nhấn chuột lên ảnh. False=Người dùng chọn Hiển thị thông tin ảnh</param>
        void Try2LoadImgProperties(MedicalViewerCell cell, bool AutoHide)
        {

        }