Main Content

Visualize 3-D Medical Image Data Using Medical Image Labeler

This example shows how to interactively visualize and explore 3-D medical image data using the Medical Image Labeler app.

Download Data

This example labels chest CT data from a subset of the Medical Segmentation Decathlon data set [1]. Download the MedicalVolumNIfTIData.zip file from the MathWorks® website, then unzip the file. The size of the subset of data is approximately 76 MB.

zipFile = matlab.internal.examples.downloadSupportFile("medical","MedicalVolumeNIfTIData.zip");
filepath = fileparts(zipFile);
unzip(zipFile,filepath)
dataFolder = fullfile(filepath,"MedicalVolumeNIfTIData");

Open Medical Image Labeler

Open the Medical Image Labeler app from the Apps tab on the MATLAB® toolstrip, under Image Processing and Computer Vision. You can also open the app by using the medicalImageLabeler command.

label-3-d-medical-image-using-medical-image-labeler-open-app.png

Create New Volume Labeling Session

To start a new 3-D session, on the app toolstrip, click New Session and select New Volume session (3-D). In the Create a new session folder dialog box, specify a location in which to save the new session folder by entering a path or selecting Browse and navigating to your desired location. In the New Session Folder box, specify a name for the folder for this app session. Select Create Session.

Load Image Data into Medical Image Labeler

To load an image into the Medical Image Labeler app, on the app toolstrip, click Import. Then, under Data, select From File. Browse to the location containing the downloaded data, specified by the dataFolder workspace variable, and select the file lung_027.nii.gz. For a Volume Session, the imported data file can be a single DICOM or NIfTI file containing a 3-D image volume, or a directory containing multiple DICOM files corresponding to a single image volume.

2022-08-08_22-41-13.png

View Data as Anatomical Slice Planes

The app displays the data as anatomical slice planes in the Transverse, Sagittal, and Coronal panes.

By default, the app displays the center slice in each slice plane. You can change the displayed slice by using the scroll bar at the bottom of a slice pane, or you can click the pane and then press the left and right arrow keys. The app displays the current slice number out of the total number of slices, such as 132/264, for each slice pane. The app also displays anatomical display markers indicating the anterior (A), posterior (P), left (L), right (R), superior (S), and inferior (I) directions. To toggle the visibility of the display markers, on the app toolstrip, click Display Markers and, under 2-D Slices, select or clear 2D Orientation Markers. You can zoom in on the current slice pane using the mouse scroll wheel or the zoom controls that appear when you pause on the slice pane.

By default, the app displays the scan using the Radiological display convention, with the left side of the patient on the right side of the image. To display the left side of the patient on the left side of the image, on the app toolstrip, click Display Convention and select Neurological.

You can adjust the brightness and contrast used to display grayscale image data by using the Window Level tool on the Home tab of the app toolstrip. First, on the app toolstrip, select . Then, click and hold in any of the slice panes, and drag up and down to increase and decrease the brightness, respectively, or left and right to increase and decrease the contrast. The updated window bounds are displayed in the app toolstrip under Window Bounds. Clear to deactivate the tool. Changing the display window does not modify the image data. To reset the brightness and contrast, click Window Level and select Reset.

View Data as 3-D Volume

The app displays the data as a 3-D volume in the 3-D Volume pane. You can toggle the visibility of the volume display using the Show Volume button on the Home tab of the app toolstrip.

In the 3-D Volume pane, click and drag to rotate the volume or use the scroll wheel to zoom. You can adjust the volume display using the tools in the Volume Rendering tab of the app toolstrip. To change the background color, click Background Color. Toggle the use of a background gradient by clicking Use Gradient. To change the gradient color, with Use Gradient selected, click Gradient Color. To restore the default background settings, click Restore Background. You can also view orientation axes and scale bar display markers in the 3-D Volume pane. To toggle the visibility of each display marker, on the Home tab of the app toolstrip, click Display Markers, and under 3-D Volume, select or clear 3D Orientation Axes and Scale Bars.

You can change how the app displays voxel intensity data by selecting one of several built-in rendering styles. On the Volume Rendering tab, select CT - Bone from the Rendering Presets gallery to use an alphamap and colormap recommended for highlighting bone tissue in computed tomography (CT) scans. To refine the built-in displays for your data set, adjust the display parameters by using the Rendering Editor. To open the editor, on the Volume Rendering tab of the app toolstrip, click Rendering Editor.

Using the Rendering Editor, you can manually adjust the rendering technique, the transparency alphamap, and the colormap of the 3-D voume rendering. The app supports these rendering techniques:

  • Volume Rendering — View the volume based on the specified color and transparency for each voxel.

  • Maximum Intensity Projection — View the voxel with the highest intensity value for each ray projected through the data.

  • Gradient Opacity — View the volume based on the specified color and transparency, with an additional transparency applied if the voxel is similar in intensity to the previous voxel along the viewing ray.

When you render a volume with uniform intensity using Gradient Opacity, the internal portion of the volume appears more transparent than in the Volume Rendering rendering style, enabling better visualization of label data, if present, and intensity gradients in the volume. For this example, select Gradient Opacity.

You can refine the alphamap and colormap by manipulating the plots and colorbar in the Rendering Editor directly. To save your customized settings, in the Volume Rendering tab of the app toolstrip, click Save Rendering. The app adds an icon for your custom settings to the gallery in the app toolstrip, under User-Defined. If you have multiple files loaded in the app session, you can apply the same built-in or custom rendering settings to all volumes by clicking Apply To All Volumes in the app toolstrip.

Export Snapshot Image from App

You can export images from the Medical Image Labeler app to use for figures. In the Home tab of the app toolstrip, click Save Snapshot. In the Save Snapshot dialog box, select the views you want to export and click Save. By default, the app saves a snapshot for the transverse, coronal, and sagittal slice planes, as well as the 3-D volume window. In the second dialog box, specify the location where you want to save the images, and click Save again. Each snapshot is saved as a separate PNG file. The 2-D snapshots match the current brightness and contrast settings of the app, but show the full slice without any zooming or anatomical display markers. The 3-D snapshot matches the current rotation and zoom values in the 3-D Volume pane, and contains any enabled display markers.

References

[1] Medical Segmentation Decathlon. "Lung." Tasks. Accessed May 10, 2018. http://medicaldecathlon.com/. The Medical Segmentation Decathlon data set is provided under the CC-BY-SA 4.0 license. All warranties and representations are disclaimed. See the license for details.

See Also

Related Topics