This example show how to look at and explore 3-D volumetric data using the Volume Viewer app. Volume rendering is highly dependent on defining an appropriate alphamap so that structures in your data that you want to see are opaque and structures that you do not want to see are transparent. To illustrate, the example loads an MRI study of the human head into the Volume Viewer and explores the data using the visualization capabilities of the Volume Viewer.
Load the MRI data of a human head from a MAT-file into the workspace. This operation
creates a variable named
D in your workspace that contains the
volumetric data. Use the
squeeze command to remove the singleton
dimension from the data.
load mri D = squeeze(D); whos
Name Size Bytes Class Attributes D 128x128x27 442368 uint8 map 89x3 2136 double siz 1x3 24 double
Open the Volume Viewer app. From the MATLAB® Tool strip, open the Apps tab and under Image Processing and Computer
Vision, click . You can also open the app using the
Load volumetric data into Volume Viewer app. Click Load Volume. You can load an image by specifying its file name or load a variable from the workspace. If you have volumetric data in a DICOM format that uses multiple files to represent a volume, you can specify the DICOM folder name. Choose the Import From Workspace option because the data is in the workspace.
Select the workspace variable in the Import from Workspace dialog box and click OK.
View the volume in the Volume Viewer app. By default, the Volume Viewer displays the data as a volume but you can also view it as slice planes. The MRI data displayed as a volume is recognizable as a human head. To explore the volume, zoom in and out on the image using the mouse wheel or a right-click. You can also rotate the volume by pressing and holding the mouse in the image window. You are always zooming or rotating around the center of the volume. The axes in the Orientation Axes window moves to reflect the spatial orientation of the image as you rotate it.
To change the background color used in the display window, click Background Color and select a color.
View the MRI data as a set of slice planes. Click Slice Planes. You can also zoom in and rotate this view of the data. Use the scroll bars in the three slice windows to view individual slices in any of the planes.
Click Volume to return to viewing your data as a volume and use the capabilities of the Volume Viewer to get the best visualization of your data. For example, the Volume Viewer provides several spatial referencing options that let you modify the view to get a more realistic view of the head volume (it appears flattened in the default view). If you select the Upsample To Cube option, the Volume Viewer calculates a scale factor that makes the number of samples in each dimension the same as the largest dimension in the volume. This setting can make non-isotropically sampled data appear scaled more correctly. If the data file includes metadata, for example with resolution data, the Volume Viewer uses the metadata and displays the volume true to scale. In this case, the Volume Viewer selects the Use File Metadata option, by default.
Use the Volume Viewer rendering options and Rendering Editor to refine the display of your volume. Volume rendering is highly dependent on defining an appropriate alphamap so that structures you want to see are opaque and structure you don’t want to see are transparent. how you define the opacity and transparency of voxel values throughout the volume, and choose the color mapping of these intensity values. The Volume Viewer offers a set of rendering presets that automatically set the alphamap and colormap to achieve certain well-defined effects. For example, to set a view that works well with CT bone data, click the CT Bone rendering preset. The Maximum Intensity Projection (MIP) presets look for the voxel with the highest intensity value for each ray projected through the data. MIP can be useful for revealing the highest intensity structure within a volume. When you select a rendering preset, the Rendering Editor presents the alphamap and colormap with that preset. By default, the Volume Viewer uses a simple linear relationship, but each preset changes the curve of the plot to give certain data value more or less opacity.
Edit the volume rendering in the Rendering Editor. The Rendering Editor controls the relationship between voxel intensity, opacity, and color. For example, if you want to lighten up the rendering of the head MRI using Linear Grayscale, click in the colormap editor to create a new marker near the white end of the scale and then you can move the marker towards the dark end of the scale. In this way, you expand the number of pixel values that map to white. You can also manipulate the alphamap to change the opacity mapping. If you click on the line, the Volume Viewer adds a marker
Continue used Volume Viewer capabilities until you achieve the best view of your data that.