Class ShortStackWrapper

java.lang.Object
inra.ijpb.data.image.ShortStackWrapper
All Implemented Interfaces:
Image3D

public class ShortStackWrapper
extends java.lang.Object
implements Image3D
Access the data of a 3D image containing gray16 values stored as short.

Example of use:


	ImageStack stack = IJ.getImage().getStack();
	Image3D image = new ShortStackWrapper(stack);
	int val = image.get(0, 0, 0);
Author:
David Legland
See Also:
ByteStackWrapper, FloatStackWrapper
  • Constructor Summary

    Constructors
    Constructor Description
    ShortStackWrapper​(ij.ImageStack stack)
    Creates a new wrapper to the ImageStack.
  • Method Summary

    Modifier and Type Method Description
    int get​(int x, int y, int z)
    Returns the value at the specified coordinates as an integer.
    int getSize​(int dim)
    Returns the number of voxels along the specified dimension.
    double getValue​(int x, int y, int z)
    Returns the value at the specified coordinates as a double.
    double getValue​(Cursor3D pos)
    Returns the value at the specified coordinates as a double.
    void set​(int x, int y, int z, int value)
    Changes the value at the specified coordinates, using an integer to specify the new value.
    void setValue​(int x, int y, int z, double value)
    Changes the value at the specified coordinates, using a double to specify the new value.
    void setValue​(Cursor3D pos, double value)
    Changes the value at the specified coordinates, using a double to specify the new value.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ShortStackWrapper

      public ShortStackWrapper​(ij.ImageStack stack)
      Creates a new wrapper to the ImageStack.
      Parameters:
      stack - the stack to wrap (bit depth must equal 16)
  • Method Details

    • getSize

      public int getSize​(int dim)
      Description copied from interface: Image3D
      Returns the number of voxels along the specified dimension.
      Specified by:
      getSize in interface Image3D
      Parameters:
      dim - the dimension, between 0 and 2
      Returns:
      the size along the given dimension, as a number of voxels
    • get

      public int get​(int x, int y, int z)
      Description copied from interface: Image3D
      Returns the value at the specified coordinates as an integer.
      Specified by:
      get in interface Image3D
      Parameters:
      x - the x-coordinate of the voxel (0-indexed)
      y - the y-coordinate of the voxel (0-indexed)
      z - the z-coordinate of the voxel (0-indexed)
      Returns:
      the value at the specified position
    • set

      public void set​(int x, int y, int z, int value)
      Description copied from interface: Image3D
      Changes the value at the specified coordinates, using an integer to specify the new value.
      Specified by:
      set in interface Image3D
      Parameters:
      x - the x-coordinate of the voxel (0-indexed)
      y - the y-coordinate of the voxel (0-indexed)
      z - the z-coordinate of the voxel (0-indexed)
      value - the new value at the specified position
    • getValue

      public double getValue​(int x, int y, int z)
      Description copied from interface: Image3D
      Returns the value at the specified coordinates as a double.
      Specified by:
      getValue in interface Image3D
      Parameters:
      x - the x-coordinate of the voxel (0-indexed)
      y - the y-coordinate of the voxel (0-indexed)
      z - the z-coordinate of the voxel (0-indexed)
      Returns:
      the value at the specified position
    • getValue

      public double getValue​(Cursor3D pos)
      Description copied from interface: Image3D
      Returns the value at the specified coordinates as a double.
      Specified by:
      getValue in interface Image3D
      Parameters:
      pos - the position as a Cursor3D
      Returns:
      the value at the specified position
    • setValue

      public void setValue​(int x, int y, int z, double value)
      Description copied from interface: Image3D
      Changes the value at the specified coordinates, using a double to specify the new value.
      Specified by:
      setValue in interface Image3D
      Parameters:
      x - the x-coordinate of the voxel (0-indexed)
      y - the y-coordinate of the voxel (0-indexed)
      z - the z-coordinate of the voxel (0-indexed)
      value - the new value at the specified position
    • setValue

      public void setValue​(Cursor3D pos, double value)
      Description copied from interface: Image3D
      Changes the value at the specified coordinates, using a double to specify the new value.
      Specified by:
      setValue in interface Image3D
      Parameters:
      pos - the position of the voxel
      value - the new value at the specified position