DICOM: Annotate DICOM images in WinForms
In This Topic
The annotations may be displayed over the DICOM image in WinForms image viewer.
For each annotation is implemented a class, which defines the way the annotation appearance is displayed and how the user can interact with the annotation:
The
DicomAnnotationTool class allows to display and edit the annotations of DICOM image in WinForms image viewer.
Here is C#/VB.NET code that demonstrates how to display annotations of DICOM file in WinForms image viewer:
// create a DICOM visual tool
Vintasoft.Imaging.Annotation.Dicom.UI.VisualTools.DicomAnnotationTool annotationTool =
new Vintasoft.Imaging.Annotation.Dicom.UI.VisualTools.DicomAnnotationTool();
// set the DICOM visual tool as active visual tool in image viewer
viewer.VisualTool = annotationTool;
// load a presentation state file
Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile presentationStateFile =
new Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(presentationStateFilePath);
// add DICOM annotations from the presentation state file to the DICOM visual tool
annotationTool.AnnotationDataController.AddAnnotationDataSet(presentationStateFile.Annotations);
// load a DICOM file in the image viewer
viewer.Images.Add(dicomFilePath);
' create a DICOM visual tool
Dim annotationTool As New Vintasoft.Imaging.Annotation.Dicom.UI.VisualTools.DicomAnnotationTool()
' set the DICOM visual tool as active visual tool in image viewer
viewer.VisualTool = annotationTool
' load a presentation state file
Dim presentationStateFile As New Vintasoft.Imaging.Codecs.ImageFiles.Dicom.DicomFile(presentationStateFilePath)
' add DICOM annotations from the presentation state file to the DICOM visual tool
annotationTool.AnnotationDataController.AddAnnotationDataSet(presentationStateFile.Annotations)
' load a DICOM file in the image viewer
viewer.Images.Add(dicomFilePath)