Interactive 3D Surface Plot

Author: Kai Uwe Barthel (k.barthel at
Internationale Medieninformatik
Berlin, Germany
Source: In Interactive_3D_Surface_Plot.jar
Installation: Download Interactive_3D_Surface_Plot.jar to the plugins folder, or subfolder, restart ImageJ, and there will be a new "Interactive 3D Surface Plot" command in the Plugins menu, or submenu.
Description: This plugin creates interactive surface plots from all image types. Selections, which can be non-rectangular, are supported.

The luminance of an image is interpreted as height for the plot. Internally the image is scaled to a square image using nearest neighbor sampling. For selections the bounding box of the selection is used for the surface plot.

The viewing position of the plot can be adjusted with the mouse. Double click on the plot to show it from the top, triple click on it to show it from the front.

The plugin has several modes for displaying surface plots:

  • Drawing Mode:
    • Dots: All pixels are drawn as small dots.
    • Lines: All pixels are connected in the x-direction.
    • Mesh: All pixels are connected in the x- and y-direction.
    • Filled: All pixels are connected without leaving holes
  • Display Colors can be chosen from the original color, grayscale, different LUTs and orange.
  • Axes: If checked, axes and text are shown.
  • Invert: If checked, inverts the luminance of the plot data (the Lum height).
The size of the data grid can be adjusted with the "Grid Size" slider (32x32, 64x64 upto 512x512 samples). Best plotting results will be achieved if the image has the same size as the plot grid.

Using the "Load Texture button opens another image that will be used as texture map. This feature can be used to warp images.

The "Perspective" and "Scale" sliders allow the 3D-projection and the size of the surface plot to be changed. The plot height may be scaled with the ZRatio slider. The "Min and "Max sliders will limit the height range of the plot data.

Noisy images can be smoothed with the "Smoothing" slider. The "Lighting" slider gives the impression that the plot was illuminated and so improves the visibility of small differences. The "Save Plot" button generates a new image containing a screenshot of the surface plot.

This plugin can be called from a macro. Here is an example that plots an image from 10 different angles:

  //run with "help" to list options
  //run("Interactive 3D Surface Plot","help"); 
  run("Blobs (25K)");
  img1 = getImageID;
  stack = 0;
  n = 10;
  for (i=0; i<n; i++) {
    showProgress(i, n);
    angleZ = -i * 4 + 60;
    run("Interactive 3D Surface Plot",
      "plotType=3 smooth=11 colorType=3 snapshot=1 rotationZ="+angleZ);
    w = getWidth; h = getHeight;
    if (stack==0) {
     newImage("Plots", "RGB", w, h, 1);
     stack = getImageID;
    } else {
     run("Add Slice");
  run("Select None");
The following macro plots, using the current settings, all the images in a stack and saves the plots in another stack. Press the Esc key to abort the macro.
  n = nSlices;
  if (n==1) exit("Stack required");
  stack1 = getImageID;
  stack2 = 0;
  for (i=1; i<=n; i++) {
    showProgress(i, n);
    run("Duplicate...", "title=temp");
    temp = getImageID;
    run("Interactive 3D Surface Plot", "snapshot=1");
    w = getWidth; h = getHeight;
    if (stack2==0) {
     newImage("Plots", "RGB", w, h, 1);
     stack2 = getImageID;
    } else {
     run("Add Slice");
  run("Select None");
See Also: 3D Color Inspector plugin
Volume Viewer
History: 2004/11/19 (V1.0): First version
2004/11/20 (V1.1): 8-Bit Color fixed, Mesh Mode, Fill Mode fixed, better scaling Automatic rotation if the mouse is moved after releasing it
2004/11/21 (V1.2): Only the bounding box of the selection is taken for surface plot
2004/11/26 (V1.3): Smoothing and lighting of the plot, better "filled" mode
2004/12/02 (V1.4): The surface plot can be converted to an ImageJ image, better interpolation for lut-colors, faster filled mode
2007/01/10 (V2.0): Renamed "Interactive 3D Surface Plot", packaged as JAR file, scalable plot window size, adjustable grid sizes, texture mapping and several different scaling modes
2007/01/15 (V2.1): Adds isolines and gradient coloring visualization modes
2007/08/09 (V2.11): Fixes problem with 16 and 32 bit LUT images
2007/11/02 (V2.22): Fixes bugs and optionally displays grids and labeled axes
2008/05/12 (V2.3): Option to show legend, remembers parameters, can be called from macros
2008/08/17 (V2.31): Adds "snapshot" macro parameter
2008/10/24 (V2.32): Does not show images when run in batch mode
2011/04/21 (V2.33): Fixes bug that could cause an exception
2015/10/19 (V2.4):
- Background, line colors may be set
- Legend now works for external LUTs
- Size of the plot can be set by a macro
- Fixed a bug that caused the wrong setting of minvalue of 32 bit images with a LUT to 0

[Screen Shot]

|Plugins | Home |