VintaSoft Imaging .NET SDK v8.7
In This Topic
    View DICOM multiplanar reconstruction in WinForms
    In This Topic

    1. Parameters of DICOM MPR slice visualization

    MprSliceVisualizer class allows to define parameters of visualization for DICOM MPR slice in image viewer. The class allows to define colors and marker point of slice.



    2. Visualization and transformation of DICOM MPR slice in WinForms image viewer

    The SDK provides 2 visual tools for visualization and transformation of DICOM MPR slice in WinForms image viewer.

    2.1. MprImageTool visual tool

    The visual tool MprImageTool is intended for visualization and transformation of DICOM MPR slice in WinForms image viewer. The following operations are supported:

    By default, this visual tool uses the left mouse button for browsing through DICOM MPR slices (moving a DICOM MPR slice along the perpendicular axis) and uses the right mouse button for panning a DICOM MPR slice (moving a DICOM MPR slice along the horizontal and vertical axis).
    MprImageTool.GetInteractionMode method allows to determine, which operation is assigned to the specified mouse button. MprImageTool.SetInteractionMode method allows to assign an operation to a mouse button.

    The visual tool properties allow to define the quality of MPR slice rendering, get a focused MPR slice, etc.

    Also the MprImageTool visual tool allows to build a new DICOM MPR slice in image viewer. The building of DICOM MPR slice can be started by calling of MprImageTool.AddAndBuildSlice method.

    Here is an example that demonstrates how to display an axial DICOM MPR slice in image viewer.
    ''' <summary>
    ''' Displays the axial slice in viewer.
    ''' </summary>
    ''' <param name="viewer">The image viewer.</param>
    ''' <param name="mprImage">The MPR image.</param>
    Public Shared Sub DisplayAxialSliceInViewer(viewer As ImageViewer, mprImage As MprImage)
            ' create the MPR visualization controller
            Dim controller As New MprVisualizationController(mprImage, viewer)
    
            ' create the axial slice
            Dim axialSlice As MprPlanarSlice = mprImage.CreateAxialSlice(mprImage.YLength / 2.0)
    
            ' add slice to the MPR visualization controller
            controller.AddSliceVisualization(axialSlice, Color.Yellow)
    
            ' specify that the slice must be shown in viewer
            controller.ShowSliceInViewer(viewer, axialSlice)
    End Sub
                  
    
    /// <summary>
    /// Displays the axial slice in viewer.
    /// </summary>
    /// <param name="viewer">The image viewer.</param>
    /// <param name="mprImage">The MPR image.</param>
    public static void DisplayAxialSliceInViewer(ImageViewer viewer, MprImage mprImage)
    {
        // create the MPR visualization controller
        MprVisualizationController controller = new MprVisualizationController(
            mprImage, viewer);
    
        // create the axial slice
        MprPlanarSlice axialSlice = mprImage.CreateAxialSlice(mprImage.YLength / 2.0);
    
        // add slice to the MPR visualization controller
        controller.AddSliceVisualization(axialSlice, Color.Yellow);
    
        // specify that the slice must be shown in viewer
        controller.ShowSliceInViewer(viewer, axialSlice);
    }
                    
    


    Here is screenshot of image viewer, which displays a coronal DICOM MPR slice:
    Screenshot of image viewer, which displays a coronal DICOM MPR slice


    2.2. DicomMprTool visual tool

    DicomMprTool is a composite visual tool that combines the functionality of the following visual tools:
    1. MprImageTool ? used for visualization and transformation of DICOM MPR slices in WinForms image viewer.
    2. DicomViewerTool ? used for scaling of DICOM MPR slices in WinForms image viewer and for applying of VOI LUT to the DICOM MPR slice.
    3. ImageMeasureTool ? used for measuring of objects on DICOM MPR slice in image viewer.
    4. TextOverlayTool ? used for displaying of text (metadata) on DICOM MPR slice in image viewer.

    Here is an example that demonstrates how to display a coronal DICOM MPR slice with metadata in image viewer.
    ''' <summary>
    ''' Displays the coronal slice with metadata in viewer.
    ''' </summary>
    ''' <param name="viewer">The image viewer.</param>
    ''' <param name="mprImage">The MPR image.</param>
    Public Shared Sub DisplayCoronalSliceWithMetadataInViewer(viewer As ImageViewer, mprImage As MprImage)
            ' create the MPR visualization controller
            Dim controller As New MprVisualizationController(mprImage, viewer)
    
            ' create the coronal slice
            Dim coronalSlice As MprPlanarSlice = mprImage.CreateCoronalSlice(mprImage.YLength / 2.0)
    
            ' add slice to the MPR visualization controller
            controller.AddSliceVisualization(coronalSlice, Color.Yellow)
    
            ' specify that the slice must be shown in viewer
            controller.ShowSliceInViewer(viewer, coronalSlice)
    End Sub
                  
    
    /// <summary>
    /// Displays the coronal slice with metadata in viewer.
    /// </summary>
    /// <param name="viewer">The image viewer.</param>
    /// <param name="mprImage">The MPR image.</param>
    public static void DisplayCoronalSliceWithMetadataInViewer(ImageViewer viewer, MprImage mprImage)
    {
        // create the MPR visualization controller
        MprVisualizationController controller = new MprVisualizationController(
            mprImage, viewer);
    
        // create the coronal slice
        MprPlanarSlice coronalSlice = mprImage.CreateCoronalSlice(mprImage.YLength / 2.0);
    
        // add slice to the MPR visualization controller
        controller.AddSliceVisualization(coronalSlice, Color.Yellow);
    
        // specify that the slice must be shown in viewer
        controller.ShowSliceInViewer(viewer, coronalSlice);
    }
                    
    


    Here is screenshot of image viewer, which displays a coronal DICOM MPR slice with metadata:
    Screenshot of image viewer, which displays a coronal DICOM MPR slice with metadata


    3. Visualization and transformation of several DICOM MPR slices in several WinForms image viewers

    MprVisualizationController class allows to control the visualization of several DICOM MPR slices in several WinForms image viewers. For example, it is possible to use 3 image viewers for simultaneous visualization of sagittal, coronal and axial slices of examined object. Or for example, it is possible to use 2 image viewers for simultaneous visualization of sagittal slice and curvilinear slice, which was build on base of the sagittal slice.

    For displaying N slices in N image viewers is necessary to do the following steps:

    Here is an example that demonstrates how to display coronal, sagittal and axial DICOM MPR planar slices in 3 image viewers.
    ''' <summary>
    ''' Displays the coronal, sagittal and axial DICOM MPR slices in 3 image viewers.
    ''' </summary>
    ''' <param name="sagittalViewer">The sagittal viewer.</param>
    ''' <param name="coronalViewer">The coronal viewer.</param>
    ''' <param name="axialViewer">The axial viewer.</param>
    ''' <param name="mprImage">The MPR image.</param>
    Public Shared Sub DisplayThreePlanarSlicesInThreeViewers(sagittalViewer As ImageViewer, coronalViewer As ImageViewer, axialViewer As ImageViewer, mprImage As MprImage)
            ' create the MPR visualization controller
            Dim controller As New MprVisualizationController(mprImage, sagittalViewer, coronalViewer, axialViewer)
    
            ' add slices to the MPR visualization controller
            Dim slices As MprSlice() = controller.AddThreeSlicesVisualization(mprImage.XLength / 2.0, Color.LightBlue, mprImage.YLength / 2.0, Color.Coral, mprImage.ZLength / 2.0, Color.Yellow)
    
            ' specify that the first slice must be shown in sagittalViewer
            controller.ShowSliceInViewer(sagittalViewer, slices(0))
            ' specify that the second slice must be shown in coronalViewer
            controller.ShowSliceInViewer(coronalViewer, slices(1))
            ' specify that the third slice must be shown in axialViewer
            controller.ShowSliceInViewer(axialViewer, slices(2))
    End Sub
                  
    
    /// <summary>
    /// Displays the coronal, sagittal and axial DICOM MPR slices in 3 image viewers.
    /// </summary>
    /// <param name="sagittalViewer">The sagittal viewer.</param>
    /// <param name="coronalViewer">The coronal viewer.</param>
    /// <param name="axialViewer">The axial viewer.</param>
    /// <param name="mprImage">The MPR image.</param>
    public static void DisplayThreePlanarSlicesInThreeViewers(
        ImageViewer sagittalViewer,
        ImageViewer coronalViewer,
        ImageViewer axialViewer,
        MprImage mprImage)
    {
        // create the MPR visualization controller
        MprVisualizationController controller = new MprVisualizationController(
            mprImage, sagittalViewer, coronalViewer, axialViewer);
    
        // add slices to the MPR visualization controller
        MprSlice[] slices = controller.AddThreeSlicesVisualization(
            mprImage.XLength / 2.0, Color.LightBlue,
            mprImage.YLength / 2.0, Color.Coral,
            mprImage.ZLength / 2.0, Color.Yellow);
    
        // specify that the first slice must be shown in sagittalViewer
        controller.ShowSliceInViewer(sagittalViewer, slices[0]);
        // specify that the second slice must be shown in coronalViewer
        controller.ShowSliceInViewer(coronalViewer, slices[1]);
        // specify that the third slice must be shown in axialViewer
        controller.ShowSliceInViewer(axialViewer, slices[2]);
    }
                    
    


    Here is screenshot of 3 image viewers, which display coronal, sagittal and axial DICOM MPR planar slices:
    Screenshot of 3 image viewers, which display coronal, sagittal and axial DICOM MPR planar slices


    Here is an example that demonstrates how to display an axial DICOM MPR slice in the first image viewer and build and display the curvlinear DICOM MPR slice, which is based on axial slice, in the second image viewer.
    ''' <summary>
    ''' Displays an axial DICOM MPR slice in the first image viewer and
    ''' builds and displays the curvlinear DICOM MPR slice, which is based on axial slice, in the second image viewer.
    ''' </summary>
    ''' <param name="axialViewer">The viewer with axial slice.</param>
    ''' <param name="curvlinearViewer">The viewer with curvlinear slice.</param>
    ''' <param name="mprImage">The MPR image.</param>
    Public Shared Sub DisplayAxialAndCurvilinearSlicesInTwoViewers(axialViewer As ImageViewer, curvlinearViewer As ImageViewer, mprImage As MprImage)
            ' create the MPR visualization controller
            Dim controller As New MprVisualizationController(mprImage, axialViewer, curvlinearViewer)
    
    
            ' create the axial slice
            Dim axialSlice As MprPlanarSlice = mprImage.CreateAxialSlice(mprImage.ZLength / 2.0)
            ' add axial slice to the MPR visualization controller
            controller.AddSliceVisualization(axialSlice, Color.Yellow)
    
            ' show the axial slice in axialViewer
            controller.ShowSliceInViewer(axialViewer, axialSlice)
    
    
            ' create the curvlinear slice
            Dim curvlinearSlice As MprCurvilinearSlice = mprImage.CreateCurvilinearSlice(axialSlice, Nothing)
            ' set parameters of curvilinear slice
            curvlinearSlice.RenderingMode = MprSliceRenderingMode.Avg
            curvlinearSlice.Thickness = 10
            Dim curvlinearSliceVisualizer As New MprSliceVisualizer(curvlinearSlice, Color.Blue)
    
            ' get the DICOM MPR tool, which will be used for building the curvilinear slice
            Dim dicomMprTool As DicomMprTool = controller.GetDicomMprToolAssociatedWithImageViewer(axialViewer)
            ' add the curvilinear slice to the visual tool and start building of slice
            dicomMprTool.MprImageTool.AddAndBuildSlice(curvlinearSliceVisualizer)
    
            ' show the curvlinear slice in curvlinearViewer
            controller.ShowSliceInViewer(curvlinearViewer, curvlinearSlice)
    End Sub
                  
    
    /// <summary>
    /// Displays an axial DICOM MPR slice in the first image viewer and
    /// builds and displays the curvlinear DICOM MPR slice, which is based on axial slice, in the second image viewer.
    /// </summary>
    /// <param name="axialViewer">The viewer with axial slice.</param>
    /// <param name="curvlinearViewer">The viewer with curvlinear slice.</param>
    /// <param name="mprImage">The MPR image.</param>
    public static void DisplayAxialAndCurvilinearSlicesInTwoViewers(
        ImageViewer axialViewer,
        ImageViewer curvlinearViewer,
        MprImage mprImage)
    {
        // create the MPR visualization controller
        MprVisualizationController controller = new MprVisualizationController(
            mprImage, axialViewer, curvlinearViewer);
    
    
        // create the axial slice
        MprPlanarSlice axialSlice = mprImage.CreateAxialSlice(mprImage.ZLength / 2.0);
        // add axial slice to the MPR visualization controller
        controller.AddSliceVisualization(axialSlice, Color.Yellow);
    
        // show the axial slice in axialViewer
        controller.ShowSliceInViewer(axialViewer, axialSlice);
    
    
        // create the curvlinear slice
        MprCurvilinearSlice curvlinearSlice = mprImage.CreateCurvilinearSlice(
            axialSlice, null);
        // set parameters of curvilinear slice
        curvlinearSlice.RenderingMode = MprSliceRenderingMode.Avg;
        curvlinearSlice.Thickness = 10;
        MprSliceVisualizer curvlinearSliceVisualizer =
            new MprSliceVisualizer(curvlinearSlice, Color.Blue);
    
        // get the DICOM MPR tool, which will be used for building the curvilinear slice
        DicomMprTool dicomMprTool = controller.GetDicomMprToolAssociatedWithImageViewer(axialViewer);
        // add the curvilinear slice to the visual tool and start building of slice
        dicomMprTool.MprImageTool.AddAndBuildSlice(curvlinearSliceVisualizer);
    
        // show the curvlinear slice in curvlinearViewer
        controller.ShowSliceInViewer(curvlinearViewer, curvlinearSlice);
    }
                    
    


    Here is screenshot of 2 image viewers, which display an axial DICOM MPR slice with curvilinear DICOM MPR slice:
    Screenshot of 2 image viewers, which display an axial DICOM MPR slice with curvilinear DICOM MPR slice