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); }
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); }
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); }
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); }
public AlphaPropertiesDialog(MainForm owner, MedicalViewerCell selectedCell) { InitializeComponent(); _Viewer = owner.Viewer; if (selectedCell == null) { if (_Viewer.Cells.Count != 0) { selectedCell = (MedicalViewerCell)_Viewer.Cells[0]; } } _SelectedCell = selectedCell; _txtCellIndex.Value = _Viewer.Cells.IndexOf(_SelectedCell); _txtSubCellIndex.Value = 0; if (_SelectedCell != null) { _alpha = (MedicalViewerAlpha)(_SelectedCell.GetActionProperties(MedicalViewerActionType.Alpha)); _keys = _SelectedCell.GetActionKeys(MedicalViewerActionType.Alpha); } else { _alpha = (MedicalViewerAlpha)(MainForm.DefaultCell.GetActionProperties(MedicalViewerActionType.Alpha)); _keys = MainForm.DefaultCell.GetActionKeys(MedicalViewerActionType.Alpha); } _btnCursor.ButtonCursor = _alpha.ActionCursor; _txtFactor.Value = _alpha.Alpha; _txtSensitivity.Value = _alpha.Sensitivity; _chkCircular.Checked = _alpha.CircularMouseMove; _cmbApplyToCell.SelectedIndex = 0; _cmbApplyToSubCell.SelectedIndex = 0; owner.AddKeysToCombo(_cmbLeftKey, _keys.MouseLeft); owner.AddKeysToCombo(_cmbRightKey, _keys.MouseRight); owner.AddModifiersToCombo(_cmbModifiers, _keys.Modifiers); _cmbApplyToCell.Enabled = (owner.Viewer.Cells.Count != 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; }