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 the 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 can 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 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, the cell can be frozen. This is done using the MedicalViewerCell.Frozen property. A frozen cell cannot be handled using the mouse or the keyboard, but it can be changed programmatically by changing some of its properties. All cells can be frozen by calling the MedicalViewerCellCollection.FreezeAll method. Freeze or un-freeze the selected cells by calling the MedicalViewerCellCollection.FreezeSelected method.
Cells within the viewer can 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 MedicalViewerBaseCell.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.
Freeze a sub-cell by calling the MedicalViewerMultiCell.FreezeSubCell method. This method freezes only a sub-cell. To freeze or unfreeze the entire cell, use the MedicalViewerCell.Frozen property. Determine whether a sub-cell is frozen by calling the MedicalViewerMultiCell.SubCellFrozen method.
It is possible to invert the images in a specified cell or sub-cell by calling MedicalViewerCell.InvertImage method. To determine whether an image has been inverted, call the MedicalViewerMultiCell.IsImageInverted method.
Call the MedicalViewerCell.GetRotateImagePerspectiveAngle method to get the perspective rotation angle of the specified cell or sub-cell and set it by using the MedicalViewerCell.RotateImagePerspective method.
Use the MedicalViewer.MedicalViewerImageInformation class to get or set image information like its height or width, or its X or Y resolution.
What a Cell Contains A cell can have one or more images attached to it. If the image has 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 MedicalViewerMultiCell.Invalidate method.
Cells can 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 MedicalViewerBaseCell.RulerInColor, the MedicalViewerBaseCell.RulerOutColor, and the MedicalViewerBaseCell.RulerStyle properties.
The measurement unit for the ruler can be set or retrieved with the MedicalViewerBaseCell.MeasurementUnit property.
In addition to images and rulers, cells can also contain tags. Tags are text that is spread along the sides of the cell, and provide information about the image. A cell can have no tags, one tag, or more than one tag. Each tag is added by calling the MedicalViewerMultiCell.SetTag method.
There are three types of tags:
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 MedicalViewerMultiCell.Rows and MedicalViewerMultiCell.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 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. Use the MedicalViewerMultiCell.ActiveSubCell method to retrieve the index of a sub-cell.
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. Programmatically, use the MedicalViewerMultiCell.Exploded property to enter or exit the exploded mode. Prevent the user from entering the exploded mode when double-clicking on a cell by using the MedicalViewerMultiCell.EnableExplodeMode property.
Sub-Cells can contain title bars. Title bars are docked at the top of every cell or sub-cell inside the image viewer. Title bars contain 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 MedicalViewerCell.Titlebar.
The icons within the title bar can be selected / unselected programmatically by calling the 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 MedicalViewerMultiCell.Invalidate method after an image has been updated in order to repaint the cell. Any object can be painted by getting the graphics object by calling the MedicalViewerCell.CreateGraphics method.
Removing a Cell
When a cell is no longer needed in a viewer, remove it by calling the MedicalViewerCellCollection.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 MedicalViewerCellCollection.Clear method.
Ruler Annotation Calibration
Call one of the MedicalViewerCell.Calibrate methods to calibrate a cell or sub-cell without having to use the annotation ruler. To calibrate a cell or sub-cell using the annotation ruler call one of the MedicalViewerCell.CalibrateRuler methods.
Use the MedicalViewer.MedicalViewerTagInformation class to manage different types of medical viewer overlay tags like Frame, Scale or Ruler unit. Tags can be removed from a cell or sub-cell by calling one of the MedicalViewerBaseCell.DeleteTag methods.
To get the tag use one of the MedicalViewerBaseCell.GetTag methods, to edit or delete a cell or sub-cell tag use one of the MedicalViewerCell.EditTag methods. A sub-cell tag is a tag that appears on a single frame with the specified sub-cell index. Sub-cell tags are used just like the other tags--just send the sub-cell index to the overloaded methods.
Fitting an Image to a Cell
Currently, there are two ways to fit an image to a cell. One is by setting the MedicalViewerCell.FitImageToCell property to true. The other way is by using the MedicalViewerCell.SetScale and MedicalViewerMultiCell.GetScale methods. In order to be able to use them make sure that MedicalViewerCell.FitImageToCell is set to false.
To get the scale mode of a cell / sub-cell use the MedicalViewerCell.GetScaleMode method.
Painting a Cell
Use the MedicalViewerCell.UpdateView method to recalculate the cell's internal values in order to update the view according to the changes made to the image. This is useful when the image dimensions change. The method also repaints the cell.
To stop the viewer from being refreshed if any change is applied, call the MedicalViewer.BeginUpdate method. After all the changes are applied, call the MedicalViewer.EndUpdate method to repaint the viewer to show all of the changes that have been made. In addition, the MedicalViewer.PrePaint event and the MedicalViewer.PostPaint event are provided to use for additional processing.
Low Memory Usage
Normally, images are loaded directly by assigning an image to a cell using the MedicalViewerCell.Image property. Call the MedicalViewerCell.EnableLowMemoryUsage method to set the control to use the low memory usage feature. The low memory usage feature works by keeping the control from loading all the frames at runtime: the control will load only the frames that are currently visible on the cell (plus the specified number of hidden frames). Each time the user scrolls down or up, or changes the number of visible frames, etc. the control requests the new frames that are needed. For example, suppose the cell layout is a 2X2 (see MedicalViewer.Rows and MedicalViewer.Columns, and the user needs to load more than 100,000 frames. When low memory usage is enabled, the control will not load them all. Instead, this method will send a MedicalViewer.FramesRequested event when the cell is loaded, requesting 4 frames (1, 2, 3 and 4) (because the cell is 2X2). Once the user scrolls down the cell to view frame number 5, frame number 1 will be disposed of because it is no longer visible. Then the event will be fired to request frame number 5. When frames are requested, the user is supposed to send them to the control using the MedicalViewerCell.SetRequestedImage method. When low memory usage is enabled, the MedicalViewer.MedicalViewerVirtualImage class can be used to determine whether an image exists or has a region, or to obtain the loaded image.
The following special effects are available for a cell / sub-cell image:
Printing a Cell
Obtain an image of a cell's content by calling the MedicalViewerCell.GetCellImage method. This overloaded method has a version for obtaining an image of a specific sub-cell.
Cells and Sub-cell Boundaries
The boundaries of cell or sub-cells can be obtained by using the following methods:
Obtain the image coordinates corresponding to the mouse coordinates specified by the user by calling the MedicalViewerCell.PointToImage method.
Use reference lines to improve diagnostics. A reference line works by making the cell draw its position as a line to the other connected cells (the cells are connected through the FrameOfReferenceUID). For instance, if you have a cell connected to three other cells, the cell will have a reference line on the three other cells.
To create a reference line, fill the following values:
After this information is provided, the Medical Viewer will search for the connection between the cells based on the FrameOfReferenceUID and draw the reference line.
Change the color of the reference line using the MedicalViewerCell.MedicalViewerReferenceLineProperties.Color property.
Enable or disable the reference line using the MedicalViewerCell.MedicalViewerReferenceLineProperties.Enabled property.
Enable or disable the first and last reference line using the Leadtools.MedicalViewer.MedicalViewerReferenceLineProperties.ShowFirstAndLast property.
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms