Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.21
Image Viewer Cells
General

The medical viewer can contain a number of child windows called cells. These cells can contain images, tags or rulers. Cells are resized to fit within the "blocks" that make up the rows and columns in the viewer. The number of rows and columns can be altered programmatically by changing the MedicalViewer.Rows and MedicalViewer.Columns properties. The number of rows and columns can be altered dynamically by the user by positioning "splitters" within the viewer.

When a viewer is created, it is empty. To add a cell to the viewer, call the MedicalViewer.Cells.Add method. This method automatically creates a window for the cell when it inserts the cell into the medical viewer. To get the current number of cells in the viewer, call the MedicalViewer.Cells.Count property.

Cells are positioned within the viewer from left to right and top to bottom. When a cell is inserted in the viewer, any cells to the right of the inserted cell will be moved to the right one block, wrapping to the next row as each row is filled. The row and column positions of each cell are stored in the MedicalViewerCellPosition class. A cell can be repositioned, based on the index, by calling .MedicalViewer.Cells.Reposition method.

Each cell in the viewer has boundaries, which are dictated by the splitters separating the rows and the columns. These boundaries cannot actually be reset programmatically, although you could change the number of rows and columns in the viewer. The boundaries can be obtained however, through the MedicalViewerCell.Location and the MedicalViewerCell.Size properties.

Actions may be applied to the images attached to the cells in the viewer. For more information about the available actions and the functions associated with them, refer to Applying Actions. As the Applying Actions to the viewer topic describes, actions can be assigned to mouse buttons and keystroke combinations. These actions are then applied to one or more cells when the mouse button is pressed/dragged or the keystroke combination is pressed. To prevent the mouse or keyboard from being used to apply an action to a cell, that cell can be frozen. this is done throught the property MedicalViewerCell.Frozen property. A frozen cell cannot be handled using the mouse or the keyboard, but it can be changed programmtically by changing some of its properties.

Cells within the viewer may be selected or deselected. In fact, when applying actions to cells the user has the option to apply the action on one cell, all cells, or only selected cells. The selection status of the cell can be altered using the MedicalViewerCell.Selected property. When selecting cells dynamically, selecting one cell by clicking on it will deselect all other cells. To select more than one cell, click and hold the CTRL key while clicking on the cells.

What a Cell Contains

A cell can have one or more images attached to it. If the image has a multiple images, scroll bars will appear to allow scrolling through the images. You can get or set the image using the MedicalViewerCell.Image property. To repaint the cell call the MedicalViewerCell.Invalidate method.

Cells may also contain rulers. Horizontal and vertical rulers are used to measure the actual size of the image in the specified unit. These rulers are updated automatically if the image is resized. They can be displayed or hidden by using the MedicalViewerCell.DisplayRulers property. The style and colors used to draw the rulers are set for the viewer using the MedicalViewer.RulerInColor, the MedicalViewer.RulerOutColor, and the MedicalViewer.RulerStyle properties. The measurement unit for the ruler can be set or retrieved with the MedicalViewer.MeasurementUnit property.

In addition to images and rulers, cells may also contain tags. Tags are text that is spread along the sides of the cell, and provide information about the image. A cell may have no tags, one tag, or more than one tag. Each tag is added by calling the MedicalViewerCell.SetTag method.

There are three types of tags:

  • Built-in tags (hot tags): internally written tags that contain information about the image, such as the scale. These tags change immediately, if the image properties associated with the tag change. Therefore, if the image is scaled to 300, the scale tag changes to 300.
  • User tags: tags that contain text entered by the user.
  • Owner tags: tags that are handled through the MedicalViewer.UserTag event. Each time a cell is drawn that contains an owner tag, this event will be raised.
Sub-Cells

Cells can sometimes act like a mini medical viewer. They can be divided into equivalent blocks based on the number of rows and columns set through the MedicalViewerCell.Rows property and the MedicalViewerCell.Columns properties. Splitters are not used to separate rows and columns in cells. Each block within the cell contains one page of the image list attached to the cell. Scrolling is also supported within the cell, although it is a little different from the viewer scrolling. In cell scrolling, the pages shift up by one page. Therefore, if the cell has pages 0, 1, 2, and 3, and the pages are scrolled down by one page 0 will disappear and page 1 will take its place.

There is very little independence for sub-cells. For most actions, such as scaling, if one sub-cell is scaled, all sub cells are scaled. However, the window-leveling and alpha actions can be applied to individual sub-cells, without being applied to all sub-cells.

While sub-cells can be selected, only one-sub cell per cell can be selected at a time.

Dynamically, left double-clicking on a sub-cell causes the cell to enter an "exploded" mode in which the sub-cell expands to cover the entire cell. Left double-clicking the cell a second time returns the sub-cell to its regular state.

Sub-Cells may contain title bars. Title bars are docked at the top of every cell or sub-cell inside the image viewer. This title bar contains small icons that the user can select / unselect either manually or programmatically. The title bar is not visible by default. The user can show or hide the title bar through the MedicalViewer.Titlebar class.

The icons within the title bar can be selected / unselected programmatically by calling the method MedicalViewerCell.SetTitlebarIconState property. You can also retrieve the current state of a specific title bar icon (whether it is selected or unselected) by calling the MedicalViewerCell.GetTitlebarIconState method.

Painting a Cell

Call the MedicalViewerCell.Invalidate method after an image been updated in order to repaint the cell.

During cell painting, the MedicalViewer.CustomPaint event is raised.

Removing a Cell

When a cell is no longer needed in a viewer, remove it by calling the MedicalViewer.Cells.Remove method. Cells to the right of the removed cell will be shifted left. Cells will wrap to the preceding row as needed. All cells in the viewer can be removed by calling the MedicalViewer.Cells.Clear method.