Class IsoSurface

java.lang.Object
com.eco.bio7.spatial.IsoSurface

public class IsoSurface extends Object
Creates and renders an iso surface of an ImageJ stack. The surface is extracted with the Surface Nets algorithm (smoother and more regular than marching cubes) from the (Gaussian smoothed) stack, the vertices are shared by the faces and the mesh is smoothed with the Taubin method (without shrinking). The surface is rendered with vertex buffers, smooth normals and a head light and can be exported as a Wavefront *.obj file.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The depth (z position) of the surface (LUT).
    static final int
    The displayed colors of the image inside of the surface (RGB, composite or LUT colors).
    static final int
    The intensity of the stack (or of a color channel) inside of the surface (LUT).
    static final int
    One color (the selected color or the LUT color at the iso value).
    static final String[]
    The supported export formats (file extensions).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if an undone removal can be redone.
    boolean
    Returns true if a removal can be undone (redone).
    void
    Removes the iso surface.
    void
    Removes the color array (see setColorData).
    void
    Computes the iso surface in the calling thread (e.g., in a time step of a model, so that the surface fits to the data of the step).
    void
    Must be called if the OpenGL context has been created again.
    void
    export(File file)
    Exports the iso surface.
    void
    Exports the iso surface as a binary glTF 2.0 file (*.glb) with normals and a material (e.g., for Blender or web viewers).
    static void
    exportMesh(File file, float[] positions, int[] indices, float[] vertexColors, float[] texCoords, BufferedImage texture, String kind, String title, String unit)
    Exports a triangle mesh with a texture: OBJ (with a *.png file of the texture, see the *.mtl file) and glTF binary (the texture embedded, without the vertex colors which would be multiplied with the texture).
    static void
    exportMesh(File file, float[] positions, int[] indices, float[] vertexColors, String kind, String title, String unit)
    Exports a triangle mesh (e.g., of a height map) like the iso surface (see export).
    void
    Exports the iso surface as a Wavefront *.obj file (with a *.mtl file for the color).
    void
    Exports the iso surface as a binary PLY file with normals and vertex colors (e.g., for MeshLab, CloudCompare or ParaView).
    void
    Exports the iso surface as a binary STL file (e.g., for 3D printing).
    void
    Exports the iso surface as a binary legacy VTK file (polygonal data with normals, e.g., for ParaView).
    Returns the selection of the loaded stack (e.g., the range of the threshold of the image) or ValueSelection.ALL.
    float[]
     
    int
     
    double
    The data value of the last color (the position 1 of the transfer function).
    double
    The data value of the first color (the position 0 of the transfer function).
    int
     
    Returns the LUT of the loaded stack (for the colors of a transfer function) or null.
    int[]
    Returns the size of the (reduced) data (width, height, depth) or null.
    float
    Returns the depth (the slices multiplied with the calibrated voxel depth and the z scale).
    double
     
    double
     
    float
     
    int[]
    Returns the histogram (256 bins) of the color values in the color range (for the transfer function editor) or null.
    ij.ImagePlus
    Returns the loaded ImageJ image (null for the data of a model).
    Returns a description of the stack and the iso surface.
    double
    Returns the position (0 - 1) of the iso value in the color range (the color values of the same channel at the surface are close to it) or NaN.
    double
     
    int
     
    int
    Returns the resolution of the measured surface (see setMeasureResolution).
    int
     
    float
     
    Returns a description of the reduction ("512 x 512 x 320 -> 256 x 256 x 160") or null.
    int
    Returns the number of the hidden (removed) triangles of the displayed surface.
    Returns the selection of the values (see setSelection).
    float
     
    int[]
    Returns the histogram (256 bins) of the color values of the surface vertices (the values which are mapped with the transfer function) or, if no vertex colors are available, of all color values.
    com.eco.bio7.spatial.TransferFunction
     
    float
     
    float
     
    boolean
    Returns true if parts of the surface are removed (cut open).
    boolean
    Returns true while the surface is computed in the background (see update).
    boolean
    Returns true if an iso surface is loaded and displayed.
    boolean
     
    boolean
     
    boolean
    Returns true if an imported mesh is displayed (see setMesh).
    boolean
     
    boolean
    Returns true if the displayed surface of the loaded stack has been reduced (see setReduceDisplay and setMaxSize).
    boolean
    Returns true if the display is reduced to the maximum size (see setMaxSize).
    boolean
     
    boolean
    Returns true if the drawing of the surface is hidden (see setSurfaceHidden).
    boolean
    Returns true if the triangles of the surface are drawn as lines over the surface.
    boolean
    load(ij.ImagePlus imp)
    Loads a stack (the current channel and frame of a hyperstack) and computes the iso surface in the background.
    boolean
    Redoes the last undone removal.
    boolean
    Loads the last loaded stack again (e.g., after a change of the maximum size).
    void
    render(com.jogamp.opengl.GL2 gl, boolean cartesian)
     
    void
    Uses the minimum and the maximum of the color values as the color range again.
    void
    Resets the color settings to the defaults: no color array (see setColorData), the value range of the data, the default color map (the LUT of the image or Viridis), no transfer function and the sample depth 1.
    void
    Restores the whole surface (all removed parts; an operation of undo, too).
    void
    Sets the clipping for the cut of the mesh (see Clipping.setCutMesh and the mask).
    void
    setColor(float r, float g, float b)
     
    void
    setColorChannel(int channel)
    The channel of a multichannel stack for the intensity colors (0 = the channel of the surface).
    void
    setColorData(double[][][] values)
    Sets an array for the colors of the surface (values[x][y][z], see setColorData(float[])).
    void
    setColorData(float[] values)
    Sets an array for the colors of the surface (e.g., a heat map of another variable of a model).
    void
    setColorData(float[][][] values)
    Sets an array for the colors of the surface (values[x][y][z], see setColorData(float[])).
    void
    Sets the color map of the colors (e.g., an ImageJ LUT).
    boolean
    Sets the color map of the colors by the name of an ImageJ LUT (e.g., "Fire", "Spectrum", "Ice", "16 colors", any entry of the Lookup Tables menu) or "Viridis".
    void
    setColorMode(int mode)
    Selects the colors of the surface: COLOR_SINGLE (the selected color or the LUT color at the iso value), COLOR_INTENSITY (the intensity of the stack or of the color channel one voxel inside of the surface, with the LUT) or COLOR_DEPTH (the z position, with the LUT or Viridis for a gray LUT) or COLOR_IMAGE (the displayed colors of the image, e.g., of an RGB stack).
    void
    setColorRange(double min, double max)
    Sets the value range of the colors (the first and the last color of the color map).
    void
    setColorSampleDepth(float voxels)
    The distance (voxels) inside of the surface where the color values are sampled (default 1, 0 = at the surface).
    void
    setData(double[][][] values)
    Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background.
    void
    setData(float[][][] values)
    Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background.
    void
    setData(float[] values, int w, int h, int d)
    Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background.
    void
    setData(float[] values, int w, int h, int d, double voxelDepth)
    Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background.
    void
    setHeadLight(boolean headLight)
    A light from the viewer (else the lights of the scene).
    void
    setIsoValue(double isoValue)
    Sets the iso value (in the units of the image) and computes the surface again.
    void
    setLutColor(boolean lutColor)
    Use the color of the LUT at the iso value (else the selected color).
    void
    setMaxSize(int maxSize)
    The maximum number of voxels of a dimension (applied when a stack is loaded).
    void
    setMeasureResolution(int resolution)
    Sets the resolution of the measured surface: 1 measures the iso surface of the voxels of the stack (the default), 2 - 4 the iso surface of the stack upsampled with cubic interpolation (Catmull-Rom) by this factor in x, y and z (more accurate for small objects of a few voxels, the display is not changed).
    void
    setMesh(com.eco.bio7.loader3d.MeshData mesh, double scale, String unit)
    Displays an imported mesh (e.g., of the Model tab, see MeshModel) instead of the iso surface of a stack.
    void
    setMeshSmoothing(int iterations)
    The number of Taubin smoothing iterations of the mesh (0 = off).
    void
    setOpacity(float opacity)
     
    void
    setOpacityMapping(boolean mapping)
    Uses the opacities of the transfer function for the vertices (like the opacity mapping of ParaView).
    void
    setReduceDisplay(boolean reduce)
    Reduces the displayed surface of large stacks to the maximum size (faster, see setMaxSize).
    void
    Sets the values of the stack for the iso surface (used by the next load, a loaded stack is loaded again): ValueSelection.ALL (the iso surface of the iso value, the default), ValueSelection.IMAGE_THRESHOLD (the values in the threshold of the image in ImageJ, e.g., only the particles), a range of values (ValueSelection.range) or the labels of a segmentation (ValueSelection.labels).
    void
    setShow(boolean show)
     
    void
    setSmoothing(float smoothing)
    The sigma (voxels of the stack) of the Gaussian smoothing of the stack (0 = off, the default).
    void
    setSurfaceHidden(boolean hidden)
    Hides only the drawing of the surface (the data, the measurements and their display stay), e.g., to show only the measured volumes.
    void
    setTransferFunction(com.eco.bio7.spatial.TransferFunction tf)
    Sets a transfer function for the colors (and with the opacity mapping for the opacities) of the surface.
    void
    A listener which is called (in a background thread) when the surface has been computed.
    void
    setWireframe(boolean wireframe)
    Shows the triangles of the surface as lines over the surface (e.g., to see the resolution of the mesh).
    void
    setWireframeColor(float[] rgb)
    Sets the color of the wireframe (r, g, b from 0 to 1).
    void
    setZScale(float zScale)
     
    boolean
    Undoes the last removal of a part of the surface (see the Surface Eraser and "Remove Surface of the Area" of the Measure tab).
    void
    Computes the iso surface again in the background (e.g., after a change of the iso value or the smoothing).
    boolean
    waitForSurface(long timeoutMillis)
    Waits until the surface has been computed in the background, e.g., in a script after load or setIsoValue.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • COLOR_SINGLE

      public static final int COLOR_SINGLE
      One color (the selected color or the LUT color at the iso value).
      See Also:
    • COLOR_INTENSITY

      public static final int COLOR_INTENSITY
      The intensity of the stack (or of a color channel) inside of the surface (LUT).
      See Also:
    • COLOR_DEPTH

      public static final int COLOR_DEPTH
      The depth (z position) of the surface (LUT).
      See Also:
    • COLOR_IMAGE

      public static final int COLOR_IMAGE
      The displayed colors of the image inside of the surface (RGB, composite or LUT colors).
      See Also:
    • EXPORT_FORMATS

      public static final String[] EXPORT_FORMATS
      The supported export formats (file extensions).
  • Constructor Details

    • IsoSurface

      public IsoSurface()
  • Method Details

    • load

      public boolean load(ij.ImagePlus imp)
      Loads a stack (the current channel and frame of a hyperstack) and computes the iso surface in the background. The default iso value is the threshold of the image (if set) or the center of the display range.
      Parameters:
      imp - the ImageJ image
      Returns:
      true if the stack has been loaded
    • setData

      public void setData(float[] values, int w, int h, int d)
      Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background. The values are copied.
      Parameters:
      values - the values (index = (z * height + y) * width + x)
      w - the width (x)
      h - the height (y)
      d - the depth (z)
    • setData

      public void setData(float[] values, int w, int h, int d, double voxelDepth)
      Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background. The values are copied. The iso value is kept if it has been set (see setIsoValue), else the center of the value range is used.
      Parameters:
      values - the values (index = (z * height + y) * width + x)
      w - the width (x)
      h - the height (y)
      d - the depth (z)
      voxelDepth - the depth of a voxel relative to its width
    • setColorData

      public void setColorData(float[] values)
      Sets an array for the colors of the surface (e.g., a heat map of another variable of a model). The array has the size and the layout of the data (see setData) and is kept for the following setData calls. The color mode is set to COLOR_INTENSITY (always, also after COLOR_DEPTH). The values are mapped to the colors of the color map (see setColorMap) with the color range (see setColorRange, default: the minimum and maximum of the array).
      Parameters:
      values - the values (index = (z * height + y) * width + x)
    • setColorData

      public void setColorData(double[][][] values)
      Sets an array for the colors of the surface (values[x][y][z], see setColorData(float[])).
    • setColorData

      public void setColorData(float[][][] values)
      Sets an array for the colors of the surface (values[x][y][z], see setColorData(float[])).
    • resetColors

      public void resetColors()
      Resets the color settings to the defaults: no color array (see setColorData), the value range of the data, the default color map (the LUT of the image or Viridis), no transfer function and the sample depth 1. The color mode is not changed. Useful at the start of a model, because the iso surface keeps the settings of a former model.
    • clearColorData

      public void clearColorData()
      Removes the color array (see setColorData). The colors are computed from the data again.
    • setColorRange

      public void setColorRange(double min, double max)
      Sets the value range of the colors (the first and the last color of the color map).
      Parameters:
      min - the value of the first color
      max - the value of the last color
    • resetColorRange

      public void resetColorRange()
      Uses the minimum and the maximum of the color values as the color range again.
    • setColorMap

      public boolean setColorMap(String name)
      Sets the color map of the colors by the name of an ImageJ LUT (e.g., "Fire", "Spectrum", "Ice", "16 colors", any entry of the Lookup Tables menu) or "Viridis". null uses the default (the LUT of the image or Viridis).
      Parameters:
      name - the name of the LUT
      Returns:
      true if the LUT has been found
    • setColorMap

      public void setColorMap(ColorModel cm)
      Sets the color map of the colors (e.g., an ImageJ LUT). null uses the default (the LUT of the image or Viridis).
      Parameters:
      cm - the color model (256 colors)
    • setColorSampleDepth

      public void setColorSampleDepth(float voxels)
      The distance (voxels) inside of the surface where the color values are sampled (default 1, 0 = at the surface).
      Parameters:
      voxels - the distance in voxels
    • setData

      public void setData(double[][][] values)
      Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background.
      Parameters:
      values - the values (values[x][y][z])
    • setData

      public void setData(float[][][] values)
      Sets the data of the iso surface (e.g., of a dynamic model) and computes the surface in the background.
      Parameters:
      values - the values (values[x][y][z])
    • computeNow

      public void computeNow()
      Computes the iso surface in the calling thread (e.g., in a time step of a model, so that the surface fits to the data of the step). The surface is displayed with the next frame.
    • reload

      public boolean reload()
      Loads the last loaded stack again (e.g., after a change of the maximum size).
    • setMeasureResolution

      public void setMeasureResolution(int resolution)
      Sets the resolution of the measured surface: 1 measures the iso surface of the voxels of the stack (the default), 2 - 4 the iso surface of the stack upsampled with cubic interpolation (Catmull-Rom) by this factor in x, y and z (more accurate for small objects of a few voxels, the display is not changed). The factor is reduced if the upsampled stack would be too large.
      Parameters:
      resolution - the factor (1 - 4)
    • getMeasureResolution

      public int getMeasureResolution()
      Returns the resolution of the measured surface (see setMeasureResolution).
    • isReduceDisplay

      public boolean isReduceDisplay()
      Returns true if the display is reduced to the maximum size (see setMaxSize).
    • setReduceDisplay

      public void setReduceDisplay(boolean reduce)
      Reduces the displayed surface of large stacks to the maximum size (faster, see setMaxSize). The measurements always use the full resolution. Applied when the stack is loaded (default: false, the full resolution).
    • isReduced

      public boolean isReduced()
      Returns true if the displayed surface of the loaded stack has been reduced (see setReduceDisplay and setMaxSize). The measurements use the full resolution.
    • getReduction

      public String getReduction()
      Returns a description of the reduction ("512 x 512 x 320 -> 256 x 256 x 160") or null.
    • clear

      public void clear()
      Removes the iso surface.
    • update

      public void update()
      Computes the iso surface again in the background (e.g., after a change of the iso value or the smoothing).
    • isComputing

      public boolean isComputing()
      Returns true while the surface is computed in the background (see update).
    • waitForSurface

      public boolean waitForSurface(long timeoutMillis) throws InterruptedException
      Waits until the surface has been computed in the background, e.g., in a script after load or setIsoValue.
      Parameters:
      timeoutMillis - the maximum time to wait
      Returns:
      true if the surface is computed, false after the timeout
      Throws:
      InterruptedException - if the thread is interrupted
    • setClipping

      public void setClipping(Clipping clipping)
      Sets the clipping for the cut of the mesh (see Clipping.setCutMesh and the mask). The surface is computed again after a change of the cut.
      Parameters:
      clipping - the clipping or null
    • setTransferFunction

      public void setTransferFunction(com.eco.bio7.spatial.TransferFunction tf)
      Sets a transfer function for the colors (and with the opacity mapping for the opacities) of the surface. The color values (see the color mode and setColorData) are mapped with the color range (see setColorRange) to the positions 0 - 1 of the function. The color mode COLOR_SINGLE is changed to COLOR_INTENSITY. null removes the transfer function.
      Parameters:
      tf - the transfer function (copied) or null
    • getTransferFunction

      public com.eco.bio7.spatial.TransferFunction getTransferFunction()
    • setOpacityMapping

      public void setOpacityMapping(boolean mapping)
      Uses the opacities of the transfer function for the vertices (like the opacity mapping of ParaView). The surface becomes transparent where the opacity of the function is low.
    • getColorMin

      public double getColorMin()
      The data value of the first color (the position 0 of the transfer function).
    • getColorMax

      public double getColorMax()
      The data value of the last color (the position 1 of the transfer function).
    • isOpacityMapping

      public boolean isOpacityMapping()
    • getSurfaceHistogram

      public int[] getSurfaceHistogram()
      Returns the histogram (256 bins) of the color values of the surface vertices (the values which are mapped with the transfer function) or, if no vertex colors are available, of all color values.
    • getIsoPosition

      public double getIsoPosition()
      Returns the position (0 - 1) of the iso value in the color range (the color values of the same channel at the surface are close to it) or NaN.
    • getHistogram

      public int[] getHistogram()
      Returns the histogram (256 bins) of the color values in the color range (for the transfer function editor) or null.
    • getColorModel

      public ColorModel getColorModel()
      Returns the LUT of the loaded stack (for the colors of a transfer function) or null.
    • contextLost

      public void contextLost()
      Must be called if the OpenGL context has been created again.
    • isDisplayed

      public boolean isDisplayed()
      Returns true if an iso surface is loaded and displayed.
    • setSurfaceHidden

      public void setSurfaceHidden(boolean hidden)
      Hides only the drawing of the surface (the data, the measurements and their display stay), e.g., to show only the measured volumes.
    • isSurfaceHidden

      public boolean isSurfaceHidden()
      Returns true if the drawing of the surface is hidden (see setSurfaceHidden).
    • render

      public void render(com.jogamp.opengl.GL2 gl, boolean cartesian)
    • undoRemoval

      public boolean undoRemoval()
      Undoes the last removal of a part of the surface (see the Surface Eraser and "Remove Surface of the Area" of the Measure tab).
      Returns:
      true if a removal has been undone
    • redoRemoval

      public boolean redoRemoval()
      Redoes the last undone removal.
      Returns:
      true if a removal has been redone
    • restoreSurface

      public void restoreSurface()
      Restores the whole surface (all removed parts; an operation of undo, too).
    • canUndoRemoval

      public boolean canUndoRemoval()
      Returns true if a removal can be undone (redone).
    • canRedoRemoval

      public boolean canRedoRemoval()
      Returns true if an undone removal can be redone.
    • hasRemovedSurface

      public boolean hasRemovedSurface()
      Returns true if parts of the surface are removed (cut open).
    • getRemovedTriangles

      public int getRemovedTriangles()
      Returns the number of the hidden (removed) triangles of the displayed surface.
    • exportMesh

      public static void exportMesh(File file, float[] positions, int[] indices, float[] vertexColors, String kind, String title, String unit) throws IOException
      Exports a triangle mesh (e.g., of a height map) like the iso surface (see export). The format is selected by the file extension (see EXPORT_FORMATS).
      Parameters:
      file - the file
      positions - x, y, z per vertex
      indices - three vertex indices per triangle
      vertexColors - r, g, b (0 - 1) per vertex or null
      kind - the kind of the mesh (for the comments of the files)
      title - the title (e.g., of the image)
      unit - the unit of the coordinates
      Throws:
      IOException - if the file can't be written or the format is unknown
    • exportMesh

      public static void exportMesh(File file, float[] positions, int[] indices, float[] vertexColors, float[] texCoords, BufferedImage texture, String kind, String title, String unit) throws IOException
      Exports a triangle mesh with a texture: OBJ (with a *.png file of the texture, see the *.mtl file) and glTF binary (the texture embedded, without the vertex colors which would be multiplied with the texture). The other formats use the vertex colors.
      Parameters:
      texCoords - u, v (0 - 1, v from the top of the image) per vertex or null
      texture - the texture image or null
      Throws:
      IOException
      See Also:
    • export

      public void export(File file) throws IOException
      Exports the iso surface. The format is selected by the file extension (obj, stl, ply, glb or vtk, see EXPORT_FORMATS). The coordinates are calibrated (the unit of the image).
      Parameters:
      file - the file
      Throws:
      IOException - if the file can't be written or the format is unknown
    • exportObj

      public void exportObj(File file) throws IOException
      Exports the iso surface as a Wavefront *.obj file (with a *.mtl file for the color). The coordinates are calibrated (the unit of the image).
      Parameters:
      file - the *.obj file
      Throws:
      IOException - if the file can't be written
    • exportStl

      public void exportStl(File file) throws IOException
      Exports the iso surface as a binary STL file (e.g., for 3D printing).
      Parameters:
      file - the *.stl file
      Throws:
      IOException - if the file can't be written
    • exportPly

      public void exportPly(File file) throws IOException
      Exports the iso surface as a binary PLY file with normals and vertex colors (e.g., for MeshLab, CloudCompare or ParaView).
      Parameters:
      file - the *.ply file
      Throws:
      IOException - if the file can't be written
    • exportGlb

      public void exportGlb(File file) throws IOException
      Exports the iso surface as a binary glTF 2.0 file (*.glb) with normals and a material (e.g., for Blender or web viewers).
      Parameters:
      file - the *.glb file
      Throws:
      IOException - if the file can't be written
    • exportVtk

      public void exportVtk(File file) throws IOException
      Exports the iso surface as a binary legacy VTK file (polygonal data with normals, e.g., for ParaView).
      Parameters:
      file - the *.vtk file
      Throws:
      IOException - if the file can't be written
    • getInfo

      public String getInfo()
      Returns a description of the stack and the iso surface.
    • getDataSize

      public int[] getDataSize()
      Returns the size of the (reduced) data (width, height, depth) or null.
    • setMesh

      public void setMesh(com.eco.bio7.loader3d.MeshData mesh, double scale, String unit)
      Displays an imported mesh (e.g., of the Model tab, see MeshModel) instead of the iso surface of a stack. The mesh can be measured (see Measurement3d), clipped, colored and exported like an iso surface (without the functions of the voxels, e.g., the region statistics).
      Parameters:
      mesh - the mesh (duplicate vertices merged, see MeshData.weld)
      scale - the size of a unit of the file in the unit (e.g., 0.001 for a file in mm and the unit m)
      unit - the unit of the measurements
    • isMesh

      public boolean isMesh()
      Returns true if an imported mesh is displayed (see setMesh).
    • getImage

      public ij.ImagePlus getImage()
      Returns the loaded ImageJ image (null for the data of a model).
    • getWidth

      public float getWidth()
    • getHeight

      public float getHeight()
    • getDepth

      public float getDepth()
      Returns the depth (the slices multiplied with the calibrated voxel depth and the z scale).
    • getDisplayMin

      public double getDisplayMin()
    • getDisplayMax

      public double getDisplayMax()
    • setSelection

      public void setSelection(ValueSelection selection)
      Sets the values of the stack for the iso surface (used by the next load, a loaded stack is loaded again): ValueSelection.ALL (the iso surface of the iso value, the default), ValueSelection.IMAGE_THRESHOLD (the values in the threshold of the image in ImageJ, e.g., only the particles), a range of values (ValueSelection.range) or the labels of a segmentation (ValueSelection.labels). With a selection the iso value is not used.
      Parameters:
      selection - the selection (null = all values)
    • getSelection

      public ValueSelection getSelection()
      Returns the selection of the values (see setSelection).
    • getActiveSelection

      public ValueSelection getActiveSelection()
      Returns the selection of the loaded stack (e.g., the range of the threshold of the image) or ValueSelection.ALL.
    • getIsoValue

      public double getIsoValue()
    • setIsoValue

      public void setIsoValue(double isoValue)
      Sets the iso value (in the units of the image) and computes the surface again.
    • getSmoothing

      public float getSmoothing()
    • setSmoothing

      public void setSmoothing(float smoothing)
      The sigma (voxels of the stack) of the Gaussian smoothing of the stack (0 = off, the default). The measurements use the same smoothing.
    • getMeshSmoothing

      public int getMeshSmoothing()
    • setMeshSmoothing

      public void setMeshSmoothing(int iterations)
      The number of Taubin smoothing iterations of the mesh (0 = off).
    • getMaxSize

      public int getMaxSize()
    • setMaxSize

      public void setMaxSize(int maxSize)
      The maximum number of voxels of a dimension (applied when a stack is loaded).
    • getZScale

      public float getZScale()
    • setZScale

      public void setZScale(float zScale)
    • getOpacity

      public float getOpacity()
    • setOpacity

      public void setOpacity(float opacity)
    • isShow

      public boolean isShow()
    • setShow

      public void setShow(boolean show)
    • isHeadLight

      public boolean isHeadLight()
    • setHeadLight

      public void setHeadLight(boolean headLight)
      A light from the viewer (else the lights of the scene).
    • isWireframe

      public boolean isWireframe()
      Returns true if the triangles of the surface are drawn as lines over the surface.
      Returns:
      true if the wireframe is shown
    • setWireframe

      public void setWireframe(boolean wireframe)
      Shows the triangles of the surface as lines over the surface (e.g., to see the resolution of the mesh).
      Parameters:
      wireframe - true to show the wireframe
    • setWireframeColor

      public void setWireframeColor(float[] rgb)
      Sets the color of the wireframe (r, g, b from 0 to 1).
      Parameters:
      rgb - the color
    • isLutColor

      public boolean isLutColor()
    • setLutColor

      public void setLutColor(boolean lutColor)
      Use the color of the LUT at the iso value (else the selected color).
    • getColorMode

      public int getColorMode()
    • setColorMode

      public void setColorMode(int mode)
      Selects the colors of the surface: COLOR_SINGLE (the selected color or the LUT color at the iso value), COLOR_INTENSITY (the intensity of the stack or of the color channel one voxel inside of the surface, with the LUT) or COLOR_DEPTH (the z position, with the LUT or Viridis for a gray LUT) or COLOR_IMAGE (the displayed colors of the image, e.g., of an RGB stack).
    • getColorChannel

      public int getColorChannel()
    • setColorChannel

      public void setColorChannel(int channel)
      The channel of a multichannel stack for the intensity colors (0 = the channel of the surface). The stack is loaded again!
    • setColor

      public void setColor(float r, float g, float b)
    • getColor

      public float[] getColor()
    • setUpdateListener

      public void setUpdateListener(Runnable listener)
      A listener which is called (in a background thread) when the surface has been computed.