Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ij
Class ImageStack

    java.lang.Object
      ij.ImageStack

Direct Known Subclasses:
  VirtualStack

public class ImageStack
extends java.lang.Object

This class represents an expandable array of images.

See Also:
  `ImagePlus`

Constructor Summary
`ImageStack(int width, int height)` Creates a new, empty image stack.
`ImageStack(int width, int height, java.awt.image.ColorModel cm)` Creates a new, empty image stack.

Method Summary
`void` | `addSlice(java.lang.String sliceLabel, ImageProcessor ip)` Adds the image in 'ip' to the end of the stack.
`void` | `addSlice(java.lang.String sliceLabel, ImageProcessor ip, int n)` Adds the image in 'ip' to the stack following slice 'n'.
`void` | `addSlice(java.lang.String sliceLabel, java.lang.Object pixels)` Adds an image in the forma of a pixel array to the end of the stack.
`void` | `addUnsignedShortSlice(java.lang.String sliceLabel, java.lang.Object pixels)` Obsolete.
`void` | `deleteLastSlice()` Deletes the last slice in the stack.
`void` | `deleteSlice(int n)` Deletes the specified slice, were 1<=n<=nslices.
`java.awt.image.ColorModel` | `getColorModel()` Returns this stack's color model.
`int` | `getHeight()`
`java.lang.Object[]` | `getImageArray()` Returns the stack as an array of 1D pixel arrays.
`java.lang.Object` | `getPixels(int n)` Returns the pixel array for the specified slice, were 1<=n<=nslices.
`ImageProcessor` | `getProcessor(int n)` Returns an ImageProcessor for the specified slice, were 1<=n<=nslices.
`java.awt.Rectangle` | `getRoi()`
`java.lang.String` | `getShortSliceLabel(int n)` Returns a shortened version (up to the first 60 characters or first newline and suffix removed) of the label of the specified slice.
`int` | `getSize()` Returns the number of slices in this stack.
`java.lang.String` | `getSliceLabel(int n)` Returns the label of the specified slice, were 1<=n<=nslices.
`java.lang.String[]` | `getSliceLabels()` Returns the slice labels as an array of Strings.
`int` | `getWidth()`
`boolean` | `isHSB()` Returns true if this is a 3-slice HSB stack.
`boolean` | `isRGB()` Returns true if this is a 3-slice RGB stack.
`boolean` | `isVirtual()` Returns true if this is a virtual (disk resident) stack.
`void` | `setColorModel(java.awt.image.ColorModel cm)` Assigns a new color model to this stack.
`void` | `setPixels(java.lang.Object pixels, int n)` Assigns a pixel array to the specified slice, were 1<=n<=nslices.
`void` | `setRoi(java.awt.Rectangle roi)`
`void` | `setSliceLabel(java.lang.String label, int n)` Sets the label of the specified slice, were 1<=n<=nslices.
`java.lang.String` | `toString()`
`void` | `trim()` Frees memory by deleting a few slices from the end of the stack.
`void` | `update(ImageProcessor ip)` Updates this stack so its attributes, such as min, max, calibration table and color model, are the same as 'ip'.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ImageStack

    public ImageStack(int width,
                      int height)

  Creates a new, empty image stack.

### ImageStack

    public ImageStack(int width,
                      int height,
                      java.awt.image.ColorModel cm)

  Creates a new, empty image stack.

Method Detail

### addSlice

    public void addSlice(java.lang.String sliceLabel,
                         java.lang.Object pixels)

  Adds an image in the forma of a pixel array to the end of the stack.

### addUnsignedShortSlice

    public void addUnsignedShortSlice(java.lang.String sliceLabel,
                                      java.lang.Object pixels)

  Obsolete. Short images are always unsigned.

### addSlice

    public void addSlice(java.lang.String sliceLabel,
                         ImageProcessor ip)

  Adds the image in 'ip' to the end of the stack.

### addSlice

    public void addSlice(java.lang.String sliceLabel,
                         ImageProcessor ip,
                         int n)

  Adds the image in 'ip' to the stack following slice 'n'. Adds the slice to the beginning of the stack if 'n' is zero.

### deleteSlice

    public void deleteSlice(int n)

  Deletes the specified slice, were 1<=n<=nslices.

### deleteLastSlice

    public void deleteLastSlice()

  Deletes the last slice in the stack.

### getWidth

    public int getWidth()

### getHeight

    public int getHeight()

### setRoi

    public void setRoi(java.awt.Rectangle roi)

### getRoi

    public java.awt.Rectangle getRoi()

### update

    public void update(ImageProcessor ip)

  Updates this stack so its attributes, such as min, max, calibration table and color model, are the same as 'ip'.

### getPixels

    public java.lang.Object getPixels(int n)

  Returns the pixel array for the specified slice, were 1<=n<=nslices.

### setPixels

    public void setPixels(java.lang.Object pixels,
                          int n)

  Assigns a pixel array to the specified slice, were 1<=n<=nslices.

### getImageArray

    public java.lang.Object[] getImageArray()

  Returns the stack as an array of 1D pixel arrays. Note that the size of the returned array may be greater than the number of slices currently in the stack, with unused elements set to null.

### getSize

    public int getSize()

  Returns the number of slices in this stack.

### getSliceLabels

    public java.lang.String[] getSliceLabels()

  Returns the slice labels as an array of Strings. Note that the size of the returned array may be greater than the number of slices currently in the stack. Returns null if the stack is empty or the label of the first slice is null.

### getSliceLabel

    public java.lang.String getSliceLabel(int n)

  Returns the label of the specified slice, were 1<=n<=nslices. Returns null if the slice does not have a label. For DICOM and FITS stacks, labels may contain header information.

### getShortSliceLabel

    public java.lang.String getShortSliceLabel(int n)

  Returns a shortened version (up to the first 60 characters or first newline and suffix removed) of the label of the specified slice. Returns null if the slice does not have a label.

### setSliceLabel

    public void setSliceLabel(java.lang.String label,
                              int n)

  Sets the label of the specified slice, were 1<=n<=nslices.

### getProcessor

    public ImageProcessor getProcessor(int n)

  Returns an ImageProcessor for the specified slice, were 1<=n<=nslices. Returns null if the stack is empty.

### setColorModel

    public void setColorModel(java.awt.image.ColorModel cm)

  Assigns a new color model to this stack.

### getColorModel

    public java.awt.image.ColorModel getColorModel()

  Returns this stack's color model. May return null.

### isRGB

    public boolean isRGB()

  Returns true if this is a 3-slice RGB stack.

### isHSB

    public boolean isHSB()

  Returns true if this is a 3-slice HSB stack.

### isVirtual

    public boolean isVirtual()

  Returns true if this is a virtual (disk resident) stack. This method is overridden by the VirtualStack subclass.

### trim

    public void trim()

  Frees memory by deleting a few slices from the end of the stack.

### toString

    public java.lang.String toString()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD