コード例 #1
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);
        }
コード例 #2
0
ファイル: ViewDatasetDialog.cs プロジェクト: sakpung/webstudy
        private void SetCellInfo(RasterImage image, string patientId, string patientName, string windowWidth, string windowCenter, bool isStructuredDisplay)
        {
            if (InvokeRequired)
            {
                Invoke(new SetCellInfoDelegate(SetCellInfo), image, patientId, patientName, windowWidth, windowCenter, isStructuredDisplay);
            }
            else
            {
                if (image == null)
                {
                    Cell.Image = null;
                    tabControlDicom.TabPages.Remove(tabPageImages);
                    return;
                }

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

                // The following are examples of how to add overlays
                // * Cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);
                //   Shows WindowLevelData at the BottomLeft
                // * Cell.SetTag(0, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.Frame);
                //   Shows the Frame (i.e. horizontal and vertical ruler bars that change when zooming
                // * Cell.SetTag(5, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, patientName);
                //   Shows PatientName at the TopLeft
                // * Cell.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, patientName);
                //   Shows PatientName at the TopRight
                // * Cell.DeleteTag(2, MedicalViewerTagAlignment.BottomLeft);
                //   Deletes all the overlays for item (2)
                // * Cell.DeleteTag(0, MedicalViewerTagAlignment.TopRight);
                //   Deletes all the overlays for item (0)

                if (image.PageCount > 1)
                {
                    tabPageImages.Text = "Images";
                }
                if (!string.IsNullOrEmpty(windowWidth) && !string.IsNullOrEmpty(windowCenter))
                {
                    int ww = -1, wc = -1;

                    MedicalViewerWindowLevel wl = Cell.GetActionProperties(MedicalViewerActionType.WindowLevel) as MedicalViewerWindowLevel;
                    if (wl != null)
                    {
                        if (int.TryParse(windowWidth, out ww))
                        {
                            wl.Width = ww;
                        }

                        if (int.TryParse(windowCenter, out wc))
                        {
                            wl.Center = wc;
                        }

                        Cell.SetActionProperties(MedicalViewerActionType.WindowLevel, wl);
                    }
                }
            }
        }