Programming with the DICOM Edit Control Property Grid (original) (raw)
The LEADTOOLS DICOM Edit Control Property Grid is a sophisticated control. It can be used to build an elegant DICOM editor with tooltips, selection list, and data validation capabilities as well as to simply display detailed information stored in a DICOM file in an organized layout.
The following namespaces provide support for the DicomPropertyGrid:
- Leadtools.Dicom.Common.Editing
- Leadtools.Dicom.Common.Editing.Controls (Contains the DicomPropertyGrid class)
- Leadtools.Dicom.Common.Editing.Converters (Provides default type converters for the DicomPropertyGrid)
For information about pulling data from one data set and inserting it into another, refer to tutorials.
To add a DICOM Edit Control to your project, perform the following steps:
- Add the Leadtools.Dicom.Common assembly to your project.
- Add the DicomPropertyGrid to your form.
To add a DICOM data set to the property grid, assign a newly initialized or loaded DicomDataSet object to the DataSet property of the DicomPropertyGrid.
To switch between the module view and the list view, use the Switch property.
The end-user can use the clickable commands in the DicomPropetyGrid's Command pane to display or hide tag information. This can also be set programmatically using the ShowTagInfo property.
The user can reduce clutter by hiding some tags from being displayed(UID as an example). To hide tags, add an event handler for the BeforeAddElement event and set the BeforeAddElementEventArgs Cancel property to true.
To add a visual clue about the value requirement of a tag (i.e. DICOM Type 1, Type 2, Type 1C etc.) or to add tips or a description about a tag perform the following steps:
- Provide an event handler for the PropertyInfo event.
- Create a new PropertyImageInfo Item. Assign an 8x8 image to the Image Property. Assign a string to Tooltip property to display a tooltip when the mouse is over the image.
- Add the new item to the PropertyImageInfo property.
To limit the user's selection options for a tag value to a specific list (i.e. enumerated or defined terms in DICOM or an implementation-specific list) perform the following steps:
- Provide an event handler for the BeforeAddElement event.
- Update the Choices string list property of the Element item. Items in this list will be presented as a combo box of choices in the DicomPropertyGrid.
To add or remove some tags from the data set perform the following steps:
- To add tags to the DicomPropertyGrid, call the AddTags method.
- To remove tags from the DicomPropertyGrid, call the DeleteTag method.
- To use the provided tag selection dialog, call the ShowTagSelectionDialog method.
- To add tags from the property grid, click the Add Tag link. To add a sequence item click the Add Item link. To delete a tag click the Delete Tag link. The DicomPropertyGrid will disable and enable these links when appropriate.
- To determine whether a tag can be added, read the CanAddTag property.
- To determine whether you can add a sequence item to the currently selected tag, check the CanAddSequenceItem property.
The patient name value representation (VR) is handled automatically by the DicomPropertyGrid. The Leadtools.Dicom.Common assembly includes a PersonNameConverter, and a PersonNameListConverter to convert PersonNameConverter, and PersonName to and from string representation.
In addition, the following user interface (UI) methods are provided to simplify DICOM editing tasks:
- The DicomPropertyGrid includes some UITypeEditors to make editing DICOM images easier. The following editors are available:
- Sequence Editor - Edit DICOM sequence item.
- RasterImageEditor - Edit the Pixel Data item.
- Commands are provided that allow for common actions to be performed. The following actions are available:
- Show Tag Info - Show the tag information.
- Hide Tag Info - Hide the tag information.
- Add Tag - Add a tag to the data set.
- Delete Tag - Delete a tag from the data set.
- Add Item - Add an item to a sequence.
- To add images to the data set perform the following steps:
- Click the “…” button next to the Pixel Data element. This will display an image editor dialog that allows you to update the Pixel Data Element.
- Clear the User Existing image check box to add an image to the data set.
- To select the image encoding option perform the following steps:
- Click the “…” button next to the Pixel Data element. This will display an image editor dialog that allows you to update the Pixel Data Element.
- Choose the appropriate options on the dialog.
Changes made in the DicomPropertyGrid automatically updates the attached DicomDataSet, which can be used to save the updated data set to disk. Refer to the Print To PACS or the DICOM High-level MWL SCU demo source project for sample implementation of the DicomPropertyGrid.