protected override IEnumerable <MprViewerTool> CreateTools() { int index = 0; if (this.ImageViewer == null) { yield break; } // create one instance of the slave tool for each mutable slice set foreach (IMprVolume volume in this.ImageViewer.Volumes) { foreach (IMprSliceSet sliceSet in volume.SliceSets) { IMprStandardSliceSet standardSliceSet = sliceSet as IMprStandardSliceSet; if (standardSliceSet != null && !standardSliceSet.IsReadOnly) { ResliceTool tool = new ResliceTool(this); tool.SliceSet = standardSliceSet; tool.HotColor = _colors[index, 0]; tool.NormalColor = _colors[index, 1]; index = (index + 1) % _colors.Length; // advance to next color yield return(tool); } } } }
protected override void Dispose(bool disposing) { _owner = null; _lineGraphic = null; _sliceControlGraphic = null; _stateControlGraphic = null; base.Dispose(disposing); }
protected override void OnToolSelected(MprViewerTool tool) { base.OnToolSelected(tool); _lastSelectedTool = (ResliceTool)tool; if (_lastSelectedTool == null) { base.TooltipPrefix = SR.ToolbarReslice; } else { base.TooltipPrefix = _lastSelectedTool.Label; } }
public ResliceToolGraphic(ResliceTool owner) { LineGraphic lineGraphic = new LineGraphic(); MprMoveControlGraphic moveControlGraphic = new MprMoveControlGraphic(lineGraphic); moveControlGraphic.UndoableOperationStart += OnControlGraphicUndoableOperationStart; moveControlGraphic.UndoableOperationStop += OnControlGraphicUndoableOperationStop; moveControlGraphic.UndoableOperationCancel += OnControlGraphicUndoableOperationCancel; MprLineStretchControlGraphic lineControlGraphic = new MprLineStretchControlGraphic(moveControlGraphic); lineControlGraphic.UndoableOperationStart += OnControlGraphicUndoableOperationStart; lineControlGraphic.UndoableOperationStop += OnControlGraphicUndoableOperationStop; lineControlGraphic.UndoableOperationCancel += OnControlGraphicUndoableOperationCancel; SliceControlGraphic sliceControlGraphic = new SliceControlGraphic(lineControlGraphic, this); StandardStatefulGraphic statefulGraphic = new StandardStatefulGraphic(sliceControlGraphic); statefulGraphic.State = statefulGraphic.CreateInactiveState(); base.Graphics.Add(statefulGraphic); _stateControlGraphic = statefulGraphic; _sliceControlGraphic = sliceControlGraphic; _lineGraphic = lineGraphic; _owner = owner; }