3D image viewer and slicer

Version 1.4.0.0 (77.7 KB) by Jun Tan
A fast 3D image viewer and slicer that provides measurement, statistics, and visualization tools.
2.9K Downloads
Updated 16 Jun 2015

View License

--------------------------------------------------------------------------------
A 3D image viewer, slicer and measurement tool set.
--------------------------------------------------------------------------------
Syntax:
(1) vi
(2) vi(imageData)
(3) vi(imageData, argName1, argValue1, …)
--------------------------------------------------------------------------------
Arguments:
(1) ‘window’, [windowWidth windowLevel]. Default [valueSpan midValue]
(2) ‘range’, [lowerLimit upperLimit]. Default [minPixelValue maxPixelValue]
(3) ‘aspect’, [xAspectRatio yAspectRatio zAspectRatio]. Default [1 1 1]
--------------------------------------------------------------------------------
Examples:
(1) vi; % If no arguments, displays a 2D Modified Shepp-Logan phantom.
(2) vi(img); % View img, using default window and aspect ratio.
(3) vi(img, ‘window’, [-1000 1000], ‘aspect’, [1 1 2]); % View image, using window [-1000 1000] and data aspect ratio [1 1 2].
--------------------------------------------------------------------------------
Functions:
(1) Data Range: Maximum and minimum of the image voxel/pixel value.
(2) Window: Display window settings. Can manually enter new values or select preset windows by pressing button “More…”, or hold left mouse button down and move on image to change window.
(3) View: Transverse is available for 2D images. Transverse, sagittal, coronal, and 3D slicer views are available for 3D images.
(4) Aspect Ratio: Data aspect ratio.
Color Map: Can select image pixel values and all MATLAB’s built-in colormaps. Colorbar is always on.
(5) 2D view tools:
(a) Slice # and the scrollbar: Current slice number for the current view of 3D images. Can also scroll mouse wheel to change it when mouse is on image. 2D images always have slice #1.
(b) Pixel: The pixel position and value pointed by the mouse cursor.
(c) Slice Stats: Open or hide a GUI that shows the statistics of current slice of transverse, sagittal, or coronal view.
(d) Region: Open or hide a GUI that shows the measurement of a region. Region can be a rectangle, a disk, or a user-drawn shape. Hold the mouse left button down and move to draw a region. Right click on button to bring up region shape menu.
(e) Line: Open or hide a GUI that shows the profile and measurement of a user-drawn line.Hold the mouse left button down and move to draw a line.
(f) Isoline: Open or hide a GUI that can add (enter a value in an empty isovalue table cell), edit (change the value in a cell), delete (delete the value in a cell), and show/hide (check/uncheck the show box for the selected isovalue, or click Show All/Hide All button.) isolines in the main GUI.
(6) 3D slicer tools:
(a) Light: Turn a light on and off for different visualization effects.
(b) Rotate: Enable or disable 3D rotation.
(c) X, Y, Z: Change the slice position for different axes.
--------------------------------------------------------------------------------
Files:
(1) vi.m and vi.fig: main GUI program and figure files.
(2) image_stats.m and image_stats.fig: Slice Stats program and figure files.
(3) region_measurement.m and region_measurement.fig: Region program and figure files.
(4) line_measurement.m and line_measurement.fig: Line program and figure files.
(5) vi_isoline.m and vi_isoline.fig: Isoline program and figure files.
--------------------------------------------------------------------------------
Notes:
(1) region_measurement can be used independently by passing a 2D image that will be consider as the input region. The default shape is rectangle. Shape can also be selected by passing a 2nd argument either ‘Rectangle’ or ‘Disc’. If shape is Disc, it is actually the largest ellipse that fits in the image bounding box.
(2) line_measurement can be used independently by passing a M*N matrix. M is the number of rows. 1st row is always the pixel values. N can be 1, 2, or 3. If N is 1, pixels are considered evenly distributed along a straight line and position is the row number. If N is 2, pixel position is the value in the 2nd column. If N is 3, pixel position is a (x, y) position on a 2D plane, where x is the 2nd column and y is the 3rd column. For N=3, the profile can be displayed in 3D line plot or stretched on a 2D plot.
(3) Isoline computation can be very slow for some non-smooth images because of excessive small contours. For example, isolines for noisy medical images, such as CT, CBCT, MR, can be very slow. However, for smooth images such as PET, radiation dose images, it is fast. Isoline computation is a MATLAB function. I don't have control.
--------------------------------------------------------------------------------

Cite As

Jun Tan (2024). 3D image viewer and slicer (https://www.mathworks.com/matlabcentral/fileexchange/47594-3d-image-viewer-and-slicer), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.4.0.0

Fixed a bug that causes assertion failure in Matlab 2015a.

1.3.0.0

Added user-drawn arbitrary region shape.

1.2.0.0

Fixed a bug when maximizing the GUI.

1.1.0.0

Updated Isoline control GUI and screenshots.

1.0.0.0