SpyGlass Property

Summary
Gets the class that contains the properties that control the spy glass style and shape.
Syntax
C#
VB
C++
publicMedicalViewerSpyGlassSpyGlass {get; }
PublicReadOnlyPropertySpyGlassAsMedicalViewerSpyGlass
public:propertyMedicalViewerSpyGlass^SpyGlass {MedicalViewerSpyGlass^get();}

Property Value

MedicalViewerSpyGlassclass that contains the properties that control the spy glass style and shape.

Remarks
  • To use the spy glass tool, use theAddActionmethod to add theMedicalViewerActionType.SpyGlassaction to the Medical Viewer Cell. Then use theSetActionmethod to associate the action with a mouse button.
  • The user must register theMedicalViewerBaseCell.SpyGlassStartedevent to use the spy glass.
  • The spy glass is similar to the Magnify glass feature, the main difference here is that the spy glass works by sending a copy of the image through the eventMedicalViewerBaseCell.SpyGlassStarted, the user can apply any effect on that copy, the spy glass then will display the copy as the user hovers the mouse over the original image.
Example
C#
VB
usingLeadtools;usingLeadtools.Dicom;usingLeadtools.Medical3D;usingLeadtools.Codecs;usingLeadtools.MedicalViewer;usingLeadtools.ImageProcessing;usingLeadtools.ImageProcessing.Core;usingLeadtools.ImageProcessing.Color;usingLeadtools.Annotations.Engine;usingLeadtools.Annotations.Designers;classMedicalViewerSpyGlassForm : Form{privateMedicalViewer_medicalViewer;voidMedicalViewerLocalizer_SizeChanged(objectsender, EventArgs e){_medicalViewer.Size =newSize(this.ClientRectangle.Right,this.ClientRectangle.Bottom);}publicMedicalViewerSpyGlassForm(){DicomEngine.Startup();RasterCodecs _codecs =newRasterCodecs();this.SizeChanged +=newEventHandler(MedicalViewerLocalizer_SizeChanged);// Create the medical viewer and adjust the size and the location._medicalViewer =newMedicalViewer(1, 2);_medicalViewer.Location =newPoint(0, 0);_medicalViewer.Size =newSize(this.ClientRectangle.Right,this.ClientRectangle.Bottom);// Load an image and then add it to the control.RasterImage _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"xa.dcm"));MedicalViewerMultiCell cell =newMedicalViewerMultiCell(_image,true, 1, 1);cell.FitImageToCell =false;// add some actions that will be used to change the properties of the images inside the control.cell.AddAction(MedicalViewerActionType.Scale);cell.AddAction(MedicalViewerActionType.Offset);cell.AddAction(MedicalViewerActionType.SpyGlass);// 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.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active);cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active);cell.SetAction(MedicalViewerActionType.SpyGlass, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active);cell.SpyGlassStarted +=newEventHandler(cell_SpyGlassStarted);// adjust some spy glass properties.cell.SpyGlass.PositionText = MedicalViewerSpyGlassTextType.Actual;cell.SpyGlass.ZoomText = MedicalViewerSpyGlassTextType.Percentage;cell.SpyGlass.ZoomOnScroll =true;_medicalViewer.Cells.Add(cell);// adjust some properties of the cell and add some tags._medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData,"EX. ID 230-36-5448");_medicalViewer.Cells[0].SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame);_medicalViewer.Cells[0].SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale);_medicalViewer.Cells[0].SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData);_medicalViewer.Cells[0].SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView);cell.ScaleType = MedicalViewerScaleType.Dynamic;Controls.Add(_medicalViewer);_medicalViewer.Dock = DockStyle.Fill;DicomEngine.Shutdown();}voidcell_SpyGlassStarted(objectsender, MedicalViewerSpyGlassStartedEventArgs e){if(e.Image !=null){Leadtools.ImageProcessing.Color.InvertCommand invert =newLeadtools.ImageProcessing.Color.InvertCommand();invert.Run(e.Image);}}voidMedicalViewerLocalizer_FormClosing(objectsender, FormClosingEventArgs e){}publicMedicalViewerViewer{get{return_medicalViewer; }}}MedicalViewerSpyGlassForm GetMedicalViewerSpyGlassForm(){MessageBox.Show("Hold down Left click to show the spy glass, \n move the mouse while you hold the mouse button down to move the spy glass. \n scroll while holding the mouse down to zoom in or out");returnnewMedicalViewerSpyGlassForm();}// This example changes the default window level value by decrease the width by 100. Then resets the images based on the new value.publicvoidMedicalViewerSpyGlassExample(){MedicalViewerSpyGlassForm myForm = GetMedicalViewerSpyGlassForm();MedicalViewermedicalViewer = myForm.Viewer;myForm.ShowDialog();}staticclassLEAD_VARS{publicconststringImagesDir =@"C:\LEADTOOLS21\Resources\Images";}
ImportsLeadtoolsImportsLeadtools.DicomImportsLeadtools.Medical3DImportsLeadtools.CodecsImportsLeadtools.MedicalViewerImportsLeadtools.Annotations.EngineImportsLeadtools.Annotations.DesignersImportsLeadtools.ImageProcessing.CorePrivateClassMedicalViewerSpyGlassForm :InheritsFormPrivate_medicalViewerAsMedicalViewerPrivateSubMedicalViewer_SizeChanged(ByValsenderAsObject,ByValeAsEventArgs)_medicalViewer.Size =NewSize(Me.ClientRectangle.Right,Me.ClientRectangle.Bottom)EndSubPublicSubNew()DicomEngine.Startup()Dim_codecsAsRasterCodecs =NewRasterCodecs()AddHandlerSizeChanged,AddressOfMedicalViewer_SizeChanged' Create the medical viewer and adjust the size and the location._medicalViewer =NewMedicalViewer(1, 2)_medicalViewer.Location =NewPoint(0, 0)_medicalViewer.Size =NewSize(Me.ClientRectangle.Right,Me.ClientRectangle.Bottom)' Load an image and then add it to the control.Dim_imageAsRasterImage = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir,"xa.dcm"))DimcellAsMedicalViewerMultiCell =NewMedicalViewerMultiCell(_image,True, 1, 1)cell.FitImageToCell =False“添加一些将被用来改变的行动properties of the images inside the control.cell.AddAction(MedicalViewerActionType.Scale)cell.AddAction(MedicalViewerActionType.Offset)cell.AddAction(MedicalViewerActionType.SpyGlass)' 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.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active)cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active)cell.SetAction(MedicalViewerActionType.SpyGlass, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active)AddHandlercell.SpyGlassStarted,AddressOfcell_SpyGlassStarted' adjust some spy glass properties.cell.SpyGlass.PositionText = MedicalViewerSpyGlassTextType.Actualcell.SpyGlass.ZoomText = MedicalViewerSpyGlassTextType.Percentagecell.SpyGlass.ZoomOnScroll =True_medicalViewer.Cells.Add(cell)' adjust some properties of the cell and add some tags._medicalViewer.Cells(0)。SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData,"EX. ID 230-36-5448")_medicalViewer.Cells(0)。MedicalViewerTag SetTag (4Alignment.TopLeft, MedicalViewerTagType.Frame)_medicalViewer.Cells(0)。SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)_medicalViewer.Cells(0)。SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)_medicalViewer.Cells(0)。SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)cell.ScaleType = MedicalViewerScaleType.DynamicControls.Add(_medicalViewer)_medicalViewer.Dock = DockStyle.FillDicomEngine.Shutdown()EndSubPrivateSubcell_SpyGlassStarted(ByValsenderAsObject,ByValeAsMedicalViewerSpyGlassStartedEventArgs)IfNote.ImageIsNothingThenDiminvertAsLeadtools.ImageProcessing.Color.InvertCommand =NewLeadtools.ImageProcessing.Color.InvertCommand()invert.Run(e.Image)EndIfEndSubPrivateSubMedicalViewerLocalizer_FormClosing(ByValsenderAsObject,ByValeAsFormClosingEventArgs)EndSubPublicReadOnlyPropertyViewer()AsMedicalViewerGetReturn_medicalViewerEndGetEndPropertyEndClassPrivateFunctionGetMedicalViewerSpyGlassForm()AsMedicalViewerSpyGlassFormMessageBox.Show("Hold down Left click to show the spy glass, "& Constants.vbLf &" move the mouse while you hold the mouse button down to move the spy glass. "& Constants.vbLf &" scroll while holding the mouse down to zoom in or out")ReturnNewMedicalViewerSpyGlassForm()EndFunction' This example changes the default window level value by decrease the width by 100. Then resets the images based on the new value. _PublicSubMedicalViewerSpyGlassExample()DimmyFormAsMedicalViewerSpyGlassForm = GetMedicalViewerSpyGlassForm()DimmedicalViewerAsMedicalViewer= myForm.ViewermyForm.ShowDialog()EndSubPublicNotInheritableClassLEAD_VARSPublicConstImagesDirAsString="C:\LEADTOOLS21\Resources\Images"EndClass
Requirements

Target Platforms

Leadtools.MedicalViewer Assembly
188金宝搏的网址客服|Support|Contact Us|Intellectual Property Notices
© 1991-2021LEAD Technologies, Inc.All Rights Reserved.