ImagePlus
ij

Class ImagePlus

    • Constructor Summary

      Constructors 
      Constructor and Description
      ImagePlus()
      Constructs an uninitialized ImagePlus.
      ImagePlus(String pathOrURL)
      Constructs an ImagePlus from a TIFF, BMP, DICOM, FITS, PGM, GIF or JPRG specified by a path or from a TIFF, DICOM, GIF or JPEG specified by a URL.
      ImagePlus(String title, Image img)
      Constructs an ImagePlus from an Image or BufferedImage.
      ImagePlus(String title, ImageProcessor ip)
      Constructs an ImagePlus from an ImageProcessor.
      ImagePlus(String title, ImageStack stack)
      Constructs an ImagePlus from a stack.
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      static voidaddImageListener(ImageListener listener) 
      Objectclone()
      Returns a shallow copy of this ImagePlus.
      voidclose()
      Closes this image and sets the ImageProcessor to null.
      int[]convertIndexToPosition(int n)
      Converts the stack index 'n' (one-based) into a hyperstack position (channel, slice, frame).
      voidcopy(boolean cut)
      Copies the contents of the current selection to the internal clipboard.
      voidcopyScale(ImagePlus imp)
      Copies the calibration of the specified image to this image.
      ImageStackcreateEmptyStack()
      Returns an empty image stack that has the same width, height and color table as this image.
      ImagePluscreateHyperStack(String title, int channels, int slices, int frames, int bitDepth)
      Returns a new hyperstack with this image's attributes (e.g., width, height, spatial scale), but no image data.
      ImagePluscreateImagePlus()
      Returns a new ImagePlus with this image's attributes (e.g.
      LookUpTablecreateLut()
      Creates a LookUpTable object that corresponds to this image.
      voidcreateNewRoi(int sx, int sy)
      Starts the process of creating a new selection, where sx and sy are the starting screen coordinates.
      voiddraw()
      Draws the image.
      voiddraw(int x, int y, int width, int height)
      Draws image and roi outline using a clip rect.
      ImagePlusduplicate()
      Returns a copy (clone) of this ImagePlus.
      ImagePlusflatten()
      Returns a "flattened" version of this image, in RGB format.
      voidflush()
      Sets the ImageProcessor, Roi, AWT Image and stack image arrays to null.
      intgetBitDepth()
      Returns the bit depth, 8, 16, 24 (RGB) or 32.
      BufferedImagegetBufferedImage()
      Returns this image as a BufferedImage.
      intgetBytesPerPixel()
      Returns the number of bytes per pixel.
      CalibrationgetCalibration()
      Returns this image's calibration.
      ij.gui.ImageCanvasgetCanvas()
      Returns the ImageCanvas being used to display this image, or null.
      intgetChannel() 
      ImageProcessorgetChannelProcessor()
      Returns a reference to the current ImageProcessor.
      static ImagePlusgetClipboard()
      Returns the internal clipboard or null if the internal clipboard is empty.
      intgetCurrentSlice()
      Returns the current stack slice number or 1 if this is a single image.
      static intgetDefault16bitRange()
      Returns the default 16-bit display range, 0 (auto-scaling), 8, 10, 12, 15 or 16.
      int[]getDimensions()
      Returns the dimensions of this image (width, height, nChannels, nSlices, nFrames) as a 5 element int array.
      doublegetDisplayRangeMax() 
      doublegetDisplayRangeMin() 
      FileInfogetFileInfo()
      Returns a FileInfo object containing information, including the pixel array, needed to save this image.
      intgetFrame() 
      CalibrationgetGlobalCalibration()
      Returns the system-wide calibration, or null.
      intgetHeight() 
      booleangetHideOverlay() 
      intgetID()
      Returns this image's unique numeric ID.
      ImagegetImage()
      Returns this image as a AWT image.
      ImageStackgetImageStack()
      Returns the base image stack.
      intgetImageStackSize()
      If this is a stack, returns the actual number of images in the stack, else returns 1.
      CalibrationgetLocalCalibration()
      Returns this image's local calibration, ignoring the "Global" calibration flag.
      StringgetLocationAsString(int x, int y)
      Converts the current cursor location to a string.
      LUT[]getLuts() 
      ImageProcessorgetMask()
      For images with irregular ROIs, returns a byte mask, otherwise, returns null.
      intgetNChannels()
      Returns the number of channels.
      intgetNDimensions()
      Returns the number of dimensions (2, 3, 4 or 5).
      intgetNFrames()
      Returns the number of frames (time-points).
      intgetNSlices()
      Returns the image depth (number of z-slices).
      booleangetOpenAsHyperStack() 
      FileInfogetOriginalFileInfo()
      Returns the FileInfo object that was used to open this image.
      ij.gui.OverlaygetOverlay()
      Returns the current overly, or null if this image does not have an overlay.
      int[]getPixel(int x, int y)
      Returns the pixel value at (x,y) as a 4 element array.
      ImageProcessorgetProcessor()
      Returns a reference to the current ImageProcessor.
      PropertiesgetProperties()
      Returns this image's Properties.
      ObjectgetProperty(String key)
      Returns the property associated with 'key'.
      ij.gui.RoigetRoi()
      Returns the current selection, or null if there is no selection.
      StringgetShortTitle()
      Returns a shortened version of image name that does not include spaces or a file name extension.
      intgetSlice() 
      ImageStackgetStack()
      Returns the image stack.
      intgetStackIndex(int channel, int slice, int frame)
      Returns that stack index (one-based) corresponding to the specified position.
      intgetStackSize()
      If this is a stack, returns the number of slices, else returns 1.
      longgetStartTime()
      Returns the time in milliseconds when startTiming() was last called.
      ImageStatisticsgetStatistics()
      Returns an ImageStatistics object generated using the standard measurement options (area, mean, mode, min and max).
      ImageStatisticsgetStatistics(int mOptions)
      Returns an ImageStatistics object generated using the specified measurement options.
      ImageStatisticsgetStatistics(int mOptions, int nBins)
      Returns an ImageStatistics object generated using the specified measurement options and histogram bin count.
      ImageStatisticsgetStatistics(int mOptions, int nBins, double histMin, double histMax)
      Returns an ImageStatistics object generated using the specified measurement options, histogram bin count and histogram range.
      StringgetTitle()
      Returns the image name.
      intgetType()
      Returns the current image type (ImagePlus.GRAY8, ImagePlus.GRAY16, ImagePlus.GRAY32, ImagePlus.COLOR_256 or ImagePlus.COLOR_RGB).
      intgetWidth() 
      ij.gui.ImageWindowgetWindow()
      Returns the ImageWindow that is being used to display this image.
      voidhide()
      Closes the window, if any, that is displaying this image.
      booleanimageUpdate(Image img, int flags, int x, int y, int w, int h)
      Used by ImagePlus to monitor loading of images.
      booleanisComposite()
      Returns true if this is a CompositeImage.
      booleanisDisplayedHyperStack()
      Returns 'true' if this is a hyperstack currently being displayed in a StackWindow.
      booleanisHyperStack()
      Returns 'true' if this image is a hyperstack.
      booleanisInvertedLut()
      Returns true is this image uses an inverting LUT that displays zero as white and 255 as black.
      booleanisLocked()
      Returns 'true' if the image is locked.
      booleanisProcessor() 
      booleanisVisible()
      Returns true if this image is currently being displayed in a window.
      voidkillRoi()
      Deletes the current region of interest.
      voidkillStack() 
      booleanlock()
      Locks the image so other threads can test to see if it is in use.
      booleanlockSilently()
      Similar to lock, but doesn't beep and display an error message if the attempt to lock the image fails.
      voidmouseMoved(int x, int y)
      Displays the cursor coordinates and pixel value in the status bar.
      voidpaste()
      Inserts the contents of the internal clipboard into the active image.
      static voidremoveImageListener(ImageListener listener) 
      voidrepaintWindow()
      Calls draw to draw the image and also repaints the image window to force the information displayed above the image (dimension, type, size) to be updated.
      static voidresetClipboard()
      Clears the internal clipboard.
      voidresetDisplayRange() 
      voidresetStack() 
      voidrestoreRoi() 
      voidrevert()
      Implements the File/Revert command.
      voidsaveRoi() 
      voidsetActivated()
      Called by ImageWindow.windowActivated().
      voidsetCalibration(Calibration cal)
      Sets this image's calibration.
      voidsetColor(Color c)
      Sets current foreground color.
      static voidsetDefault16bitRange(int bitDepth)
      Set the default 16-bit display range, where 'bitDepth' must be 0 (auto-scaling), 8 (0-255), 10 (0-1023), 12 (0-4095, 15 (0-32767) or 16 (0-65535).
      voidsetDimensions(int nChannels, int nSlices, int nFrames)
      Sets the 3rd, 4th and 5th dimensions, where nChannels*nSlices*nFrames must be equal to the stack size.
      voidsetDisplayRange(double min, double max)
      Sets the display range of the current channel.
      voidsetDisplayRange(double min, double max, int channels)
      Sets the display range of specified channels in an RGB image, where 4=red, 2=green, 1=blue, 6=red+green, etc.
      voidsetFileInfo(FileInfo fi)
      Saves this image's FileInfo so it can be later retieved using getOriginalFileInfo().
      voidsetGlobalCalibration(Calibration global)
      Sets the system-wide calibration.
      voidsetHideOverlay(boolean hide) 
      voidsetIgnoreFlush(boolean ignoreFlush) 
      voidsetImage(Image img)
      Replaces the image, if any, with the one specified.
      voidsetImage(ImagePlus imp)
      Replaces this image with the specified ImagePlus.
      voidsetOpenAsHyperStack(boolean openAsHyperStack) 
      voidsetOverlay(ij.gui.Overlay overlay)
      Installs a list of ROIs that will be drawn on this image as a non-destructive overlay.
      voidsetOverlay(ij.gui.Roi roi, Color strokeColor, int strokeWidth, Color fillColor)
      Creates an Overlay from the specified ROI, and assigns it to this image.
      voidsetOverlay(Shape shape, Color color, BasicStroke stroke)
      Creates an Overlay from the specified Shape, Color and BasicStroke, and assigns it to this image.
      voidsetPosition(int n)
      Set the current hyperstack position based on the stack index 'n' (one-based).
      voidsetPosition(int channel, int slice, int frame)
      Sets the current hyperstack position and updates the display, where 'channel', 'slice' and 'frame' are one-based indexes.
      voidsetPositionWithoutUpdate(int channel, int slice, int frame)
      Sets the current hyperstack position without updating the display, where 'channel', 'slice' and 'frame' are one-based indexes.
      voidsetProcessor(ImageProcessor ip)
      Replaces the ImageProcessor with the one specified and updates the display.
      voidsetProcessor(String title, ImageProcessor ip)
      Replaces the ImageProcessor with the one specified and updates the display.
      voidsetProperty(String key, Object value)
      Adds a key-value pair to this image's properties.
      voidsetRoi(int x, int y, int width, int height)
      Creates a rectangular selection.
      voidsetRoi(Rectangle r)
      Creates a rectangular selection.
      voidsetRoi(ij.gui.Roi newRoi)
      Assigns the specified ROI to this image and displays it.
      voidsetRoi(ij.gui.Roi newRoi, boolean updateDisplay)
      Assigns 'newRoi' to this image and displays it if 'updateDisplay' is true.
      voidsetSlice(int n)
      Displays the specified stack image, where 1<=n<=stackSize.
      voidsetSliceWithoutUpdate(int n)
      Displays the specified stack image (1<=n<=stackSize) without updating the display.
      voidsetStack(ImageStack stack)
      Replaces the image with the specified stack and updates the display.
      voidsetStack(ImageStack stack, int nChannels, int nSlices, int nFrames) 
      voidsetStack(String title, ImageStack newStack)
      Replaces the image with the specified stack and updates the display.
      voidsetTitle(String title)
      Sets the image name.
      voidsetWindow(ij.gui.ImageWindow win)
      This method should only be called from an ImageWindow.
      voidshow()
      Opens a window to display this image and clears the status bar.
      voidshow(String statusMessage)
      Opens a window to display this image and displays 'statusMessage' in the status bar.
      voidstartTiming()
      Calls System.currentTimeMillis() to save the current time so it can be retrieved later using getStartTime() to calculate the elapsed time of an operation.
      StringtoString() 
      voidtrimProcessor()
      Frees RAM by setting the snapshot (undo) buffer in the current ImageProcessor to null.
      voidunlock()
      Unlocks the image.
      voidupdateAndDraw()
      Updates this image from the pixel data in its associated ImageProcessor, then displays it.
      voidupdateAndRepaintWindow()
      Calls updateAndDraw to update from the pixel data and draw the image, and also repaints the image window to force the information displayed above the image (dimension, type, size) to be updated.
      voidupdateChannelAndDraw()
      Updates this image from the pixel data in its associated ImageProcessor, then displays it.
      voidupdateImage()
      ImageCanvas.paint() calls this method when the ImageProcessor has generated new image.
      voidupdatePosition(int c, int z, int t) 
      voidupdateStatusbarValue()
      Redisplays the (x,y) coordinates and pixel value (which may have changed) in the status bar.
    • Field Detail

      • changes

        public boolean changes
        True if any changes have been made to this image.
    • Constructor Detail

      • ImagePlus

        public ImagePlus()
        Constructs an uninitialized ImagePlus.
      • ImagePlus

        public ImagePlus(String title,         Image img)
        Constructs an ImagePlus from an Image or BufferedImage. The first argument will be used as the title of the window that displays the image. Throws an IllegalStateException if an error occurs while loading the image.
      • ImagePlus

        public ImagePlus(String title,         ImageProcessor ip)
        Constructs an ImagePlus from an ImageProcessor.
      • ImagePlus

        public ImagePlus(String pathOrURL)
        Constructs an ImagePlus from a TIFF, BMP, DICOM, FITS, PGM, GIF or JPRG specified by a path or from a TIFF, DICOM, GIF or JPEG specified by a URL.
      • ImagePlus

        public ImagePlus(String title,         ImageStack stack)
        Constructs an ImagePlus from a stack.
    • Method Detail

      • lock

        public boolean lock()
        Locks the image so other threads can test to see if it is in use. Returns true if the image was successfully locked. Beeps, displays a message in the status bar, and returns false if the image is already locked.
      • lockSilently

        public boolean lockSilently()
        Similar to lock, but doesn't beep and display an error message if the attempt to lock the image fails.
      • unlock

        public void unlock()
        Unlocks the image.
      • draw

        public void draw()
        Draws the image. If there is an ROI, its outline is also displayed. Does nothing if there is no window associated with this image (i.e. show() has not been called).
      • draw

        public void draw(int x,        int y,        int width,        int height)
        Draws image and roi outline using a clip rect.
      • updateAndDraw

        public void updateAndDraw()
        Updates this image from the pixel data in its associated ImageProcessor, then displays it. Does nothing if there is no window associated with this image (i.e. show() has not been called).
      • updateChannelAndDraw

        public void updateChannelAndDraw()
        Updates this image from the pixel data in its associated ImageProcessor, then displays it. The CompositeImage class overrides this method to only update the current channel.
      • getChannelProcessor

        public ImageProcessor getChannelProcessor()
        Returns a reference to the current ImageProcessor. The CompositeImage class overrides this method so it returns the processor associated with the current channel.
      • getLuts

        public LUT[] getLuts()
      • repaintWindow

        public void repaintWindow()
        Calls draw to draw the image and also repaints the image window to force the information displayed above the image (dimension, type, size) to be updated.
      • updateAndRepaintWindow

        public void updateAndRepaintWindow()
        Calls updateAndDraw to update from the pixel data and draw the image, and also repaints the image window to force the information displayed above the image (dimension, type, size) to be updated.
      • updateImage

        public void updateImage()
        ImageCanvas.paint() calls this method when the ImageProcessor has generated new image.
      • hide

        public void hide()
        Closes the window, if any, that is displaying this image.
      • close

        public void close()
        Closes this image and sets the ImageProcessor to null. To avoid the "Save changes?" dialog, first set the public 'changes' variable to false.
      • show

        public void show()
        Opens a window to display this image and clears the status bar.
      • show

        public void show(String statusMessage)
        Opens a window to display this image and displays 'statusMessage' in the status bar.
      • setActivated

        public void setActivated()
        Called by ImageWindow.windowActivated().
      • getImage

        public Image getImage()
        Returns this image as a AWT image.
      • getBufferedImage

        public BufferedImage getBufferedImage()
        Returns this image as a BufferedImage.
      • getID

        public int getID()
        Returns this image's unique numeric ID.
      • setImage

        public void setImage(Image img)
        Replaces the image, if any, with the one specified. Throws an IllegalStateException if an error occurs while loading the image.
      • setImage

        public void setImage(ImagePlus imp)
        Replaces this image with the specified ImagePlus. May not work as expected if 'imp' is a CompositeImage and this image is not.
      • setProcessor

        public void setProcessor(ImageProcessor ip)
        Replaces the ImageProcessor with the one specified and updates the display.
      • setProcessor

        public void setProcessor(String title,                ImageProcessor ip)
        Replaces the ImageProcessor with the one specified and updates the display. Set 'title' to null to leave the image title unchanged.
      • setStack

        public void setStack(ImageStack stack)
        Replaces the image with the specified stack and updates the display.
      • setStack

        public void setStack(String title,            ImageStack newStack)
        Replaces the image with the specified stack and updates the display. Set 'title' to null to leave the title unchanged.
      • setStack

        public void setStack(ImageStack stack,            int nChannels,            int nSlices,            int nFrames)
      • setFileInfo

        public void setFileInfo(FileInfo fi)
        Saves this image's FileInfo so it can be later retieved using getOriginalFileInfo().
      • getWindow

        public ij.gui.ImageWindow getWindow()
        Returns the ImageWindow that is being used to display this image. Returns null if show() has not be called or the ImageWindow has been closed.
      • isVisible

        public boolean isVisible()
        Returns true if this image is currently being displayed in a window.
      • setWindow

        public void setWindow(ij.gui.ImageWindow win)
        This method should only be called from an ImageWindow.
      • getCanvas

        public ij.gui.ImageCanvas getCanvas()
        Returns the ImageCanvas being used to display this image, or null.
      • setColor

        public void setColor(Color c)
        Sets current foreground color.
      • isProcessor

        public boolean isProcessor()
      • getProcessor

        public ImageProcessor getProcessor()
        Returns a reference to the current ImageProcessor. If there is no ImageProcessor, it creates one. Returns null if this ImagePlus contains no ImageProcessor and no AWT Image. Sets the line width to the current line width and sets the calibration table if the image is density calibrated.
      • trimProcessor

        public void trimProcessor()
        Frees RAM by setting the snapshot (undo) buffer in the current ImageProcessor to null.
      • getMask

        public ImageProcessor getMask()
        For images with irregular ROIs, returns a byte mask, otherwise, returns null. Mask pixels have a non-zero value.
      • getStatistics

        public ImageStatistics getStatistics()
        Returns an ImageStatistics object generated using the standard measurement options (area, mean, mode, min and max). This plugin demonstrates how get the area, mean and max of the current image or selection:
           public class Get_Statistics implements PlugIn {      public void run(String arg) {         ImagePlus imp = IJ.getImage();         ImageStatistics stats = imp.getStatistics();         IJ.log("Area: "+stats.area);         IJ.log("Mean: "+stats.mean);         IJ.log("Max: "+stats.max);      }   }                
        See Also:
        ImageStatistics, ImageStatistics.getStatistics(ij.process.ImageProcessor, int, ij.measure.Calibration)
      • getStatistics

        public ImageStatistics getStatistics(int mOptions)
        Returns an ImageStatistics object generated using the specified measurement options. This plugin demonstrates how get the area and centroid of the current selection:
           public class Get_Statistics implements PlugIn, Measurements {      public void run(String arg) {         ImagePlus imp = IJ.getImage();         ImageStatistics stats = imp.getStatistics(MEDIAN+CENTROID);         IJ.log("Median: "+stats.median);         IJ.log("xCentroid: "+stats.xCentroid);         IJ.log("yCentroid: "+stats.yCentroid);      }   }                
        See Also:
        ImageStatistics, Measurements
      • getStatistics

        public ImageStatistics getStatistics(int mOptions,                            int nBins)
        Returns an ImageStatistics object generated using the specified measurement options and histogram bin count. Note: except for float images, the number of bins is currently fixed at 256.
      • getStatistics

        public ImageStatistics getStatistics(int mOptions,                            int nBins,                            double histMin,                            double histMax)
        Returns an ImageStatistics object generated using the specified measurement options, histogram bin count and histogram range. Note: for 8-bit and RGB images, the number of bins is fixed at 256 and the histogram range is always 0-255.
      • getTitle

        public String getTitle()
        Returns the image name.
      • getShortTitle

        public String getShortTitle()
        Returns a shortened version of image name that does not include spaces or a file name extension.
      • setTitle

        public void setTitle(String title)
        Sets the image name.
      • getWidth

        public int getWidth()
      • getHeight

        public int getHeight()
      • getStackSize

        public int getStackSize()
        If this is a stack, returns the number of slices, else returns 1.
      • getImageStackSize

        public int getImageStackSize()
        If this is a stack, returns the actual number of images in the stack, else returns 1.
      • setDimensions

        public void setDimensions(int nChannels,                 int nSlices,                 int nFrames)
        Sets the 3rd, 4th and 5th dimensions, where nChannels*nSlices*nFrames must be equal to the stack size.
      • isHyperStack

        public boolean isHyperStack()
        Returns 'true' if this image is a hyperstack.
      • getNDimensions

        public int getNDimensions()
        Returns the number of dimensions (2, 3, 4 or 5).
      • isDisplayedHyperStack

        public boolean isDisplayedHyperStack()
        Returns 'true' if this is a hyperstack currently being displayed in a StackWindow.
      • getNChannels

        public int getNChannels()
        Returns the number of channels.
      • getNSlices

        public int getNSlices()
        Returns the image depth (number of z-slices).
      • getNFrames

        public int getNFrames()
        Returns the number of frames (time-points).
      • getDimensions

        public int[] getDimensions()
        Returns the dimensions of this image (width, height, nChannels, nSlices, nFrames) as a 5 element int array.
      • getType

        public int getType()
        Returns the current image type (ImagePlus.GRAY8, ImagePlus.GRAY16, ImagePlus.GRAY32, ImagePlus.COLOR_256 or ImagePlus.COLOR_RGB).
        See Also:
        getBitDepth()
      • getBitDepth

        public int getBitDepth()
        Returns the bit depth, 8, 16, 24 (RGB) or 32. RGB images actually use 32 bits per pixel.
      • getBytesPerPixel

        public int getBytesPerPixel()
        Returns the number of bytes per pixel.
      • setProperty

        public void setProperty(String key,               Object value)
        Adds a key-value pair to this image's properties. The key is removed from the properties table if value is null.
      • getProperty

        public Object getProperty(String key)
        Returns the property associated with 'key'. May return null.
      • getProperties

        public Properties getProperties()
        Returns this image's Properties. May return null.
      • createLut

        public LookUpTable createLut()
        Creates a LookUpTable object that corresponds to this image.
      • isInvertedLut

        public boolean isInvertedLut()
        Returns true is this image uses an inverting LUT that displays zero as white and 255 as black.
      • getPixel

        public int[] getPixel(int x,             int y)
        Returns the pixel value at (x,y) as a 4 element array. Grayscale values are retuned in the first element. RGB values are returned in the first 3 elements. For indexed color images, the RGB values are returned in the first 3 three elements and the index (0-255) is returned in the last.
      • createEmptyStack

        public ImageStack createEmptyStack()
        Returns an empty image stack that has the same width, height and color table as this image.
      • getStack

        public ImageStack getStack()
        Returns the image stack. The stack may have only one slice. After adding or removing slices, call setStack() to update the image and the window that is displaying it.
        See Also:
        setStack(ij.ImageStack)
      • getImageStack

        public ImageStack getImageStack()
        Returns the base image stack.
      • getCurrentSlice

        public int getCurrentSlice()
        Returns the current stack slice number or 1 if this is a single image.
      • getChannel

        public int getChannel()
      • getSlice

        public int getSlice()
      • getFrame

        public int getFrame()
      • killStack

        public void killStack()
      • setPosition

        public void setPosition(int channel,               int slice,               int frame)
        Sets the current hyperstack position and updates the display, where 'channel', 'slice' and 'frame' are one-based indexes.
      • setPositionWithoutUpdate

        public void setPositionWithoutUpdate(int channel,                            int slice,                            int frame)
        Sets the current hyperstack position without updating the display, where 'channel', 'slice' and 'frame' are one-based indexes.
      • getStackIndex

        public int getStackIndex(int channel,                int slice,                int frame)
        Returns that stack index (one-based) corresponding to the specified position.
      • resetStack

        public void resetStack()
      • setPosition

        public void setPosition(int n)
        Set the current hyperstack position based on the stack index 'n' (one-based).
      • convertIndexToPosition

        public int[] convertIndexToPosition(int n)
        Converts the stack index 'n' (one-based) into a hyperstack position (channel, slice, frame).
      • setSlice

        public void setSlice(int n)
        Displays the specified stack image, where 1<=n<=stackSize. Does nothing if this image is not a stack.
      • setSliceWithoutUpdate

        public void setSliceWithoutUpdate(int n)
        Displays the specified stack image (1<=n<=stackSize) without updating the display.
      • getRoi

        public ij.gui.Roi getRoi()
        Returns the current selection, or null if there is no selection.
      • setRoi

        public void setRoi(ij.gui.Roi newRoi)
        Assigns the specified ROI to this image and displays it. Any existing ROI is deleted if roi is null or its width or height is zero.
      • setRoi

        public void setRoi(ij.gui.Roi newRoi,          boolean updateDisplay)
        Assigns 'newRoi' to this image and displays it if 'updateDisplay' is true.
      • setRoi

        public void setRoi(int x,          int y,          int width,          int height)
        Creates a rectangular selection.
      • setRoi

        public void setRoi(Rectangle r)
        Creates a rectangular selection.
      • createNewRoi

        public void createNewRoi(int sx,                int sy)
        Starts the process of creating a new selection, where sx and sy are the starting screen coordinates. The selection type is determined by which tool in the tool bar is active. The user interactively sets the selection size and shape.
      • killRoi

        public void killRoi()
        Deletes the current region of interest. Makes a copy of the current ROI so it can be recovered by the Edit/Selection/Restore Selection command.
      • saveRoi

        public void saveRoi()
      • restoreRoi

        public void restoreRoi()
      • revert

        public void revert()
        Implements the File/Revert command.
      • getOriginalFileInfo

        public FileInfo getOriginalFileInfo()
        Returns the FileInfo object that was used to open this image. Returns null for images created using the File/New command.
        See Also:
        FileInfo, getFileInfo()
      • imageUpdate

        public boolean imageUpdate(Image img,                  int flags,                  int x,                  int y,                  int w,                  int h)
        Used by ImagePlus to monitor loading of images.
        Specified by:
        imageUpdate in interface ImageObserver
      • flush

        public void flush()
        Sets the ImageProcessor, Roi, AWT Image and stack image arrays to null. Does nothing if the image is locked.
      • setIgnoreFlush

        public void setIgnoreFlush(boolean ignoreFlush)
      • duplicate

        public ImagePlus duplicate()
        Returns a copy (clone) of this ImagePlus.
      • createImagePlus

        public ImagePlus createImagePlus()
        Returns a new ImagePlus with this image's attributes (e.g. spatial scale), but no image.
      • createHyperStack

        public ImagePlus createHyperStack(String title,                         int channels,                         int slices,                         int frames,                         int bitDepth)
        Returns a new hyperstack with this image's attributes (e.g., width, height, spatial scale), but no image data.
      • copyScale

        public void copyScale(ImagePlus imp)
        Copies the calibration of the specified image to this image.
      • startTiming

        public void startTiming()
        Calls System.currentTimeMillis() to save the current time so it can be retrieved later using getStartTime() to calculate the elapsed time of an operation.
      • getStartTime

        public long getStartTime()
        Returns the time in milliseconds when startTiming() was last called.
      • getCalibration

        public Calibration getCalibration()
        Returns this image's calibration.
      • setCalibration

        public void setCalibration(Calibration cal)
        Sets this image's calibration.
      • setGlobalCalibration

        public void setGlobalCalibration(Calibration global)
        Sets the system-wide calibration.
      • getGlobalCalibration

        public Calibration getGlobalCalibration()
        Returns the system-wide calibration, or null.
      • getLocalCalibration

        public Calibration getLocalCalibration()
        Returns this image's local calibration, ignoring the "Global" calibration flag.
      • mouseMoved

        public void mouseMoved(int x,              int y)
        Displays the cursor coordinates and pixel value in the status bar. Called by ImageCanvas when the mouse moves. Can be overridden by ImagePlus subclasses.
      • updateStatusbarValue

        public void updateStatusbarValue()
        Redisplays the (x,y) coordinates and pixel value (which may have changed) in the status bar. Called by the Next Slice and Previous Slice commands to update the z-coordinate and pixel value.
      • getLocationAsString

        public String getLocationAsString(int x,                         int y)
        Converts the current cursor location to a string.
      • copy

        public void copy(boolean cut)
        Copies the contents of the current selection to the internal clipboard. Copies the entire image if there is no selection. Also clears the selection if cut is true.
      • paste

        public void paste()
        Inserts the contents of the internal clipboard into the active image. If there is a selection the same size as the image on the clipboard, the image is inserted into that selection, otherwise the selection is inserted into the center of the image.
      • getClipboard

        public static ImagePlus getClipboard()
        Returns the internal clipboard or null if the internal clipboard is empty.
      • resetClipboard

        public static void resetClipboard()
        Clears the internal clipboard.
      • addImageListener

        public static void addImageListener(ImageListener listener)
      • removeImageListener

        public static void removeImageListener(ImageListener listener)
      • isLocked

        public boolean isLocked()
        Returns 'true' if the image is locked.
      • setOpenAsHyperStack

        public void setOpenAsHyperStack(boolean openAsHyperStack)
      • getOpenAsHyperStack

        public boolean getOpenAsHyperStack()
      • isComposite

        public boolean isComposite()
        Returns true if this is a CompositeImage.
      • setDisplayRange

        public void setDisplayRange(double min,                   double max)
        Sets the display range of the current channel. With non-composite images it is identical to ip.setMinAndMax(min, max).
      • getDisplayRangeMin

        public double getDisplayRangeMin()
      • getDisplayRangeMax

        public double getDisplayRangeMax()
      • setDisplayRange

        public void setDisplayRange(double min,                   double max,                   int channels)
        Sets the display range of specified channels in an RGB image, where 4=red, 2=green, 1=blue, 6=red+green, etc. With non-RGB images, this method is identical to setDisplayRange(min, max). This method is used by the Image/Adjust/Color Balance tool .
      • resetDisplayRange

        public void resetDisplayRange()
      • setDefault16bitRange

        public static void setDefault16bitRange(int bitDepth)
        Set the default 16-bit display range, where 'bitDepth' must be 0 (auto-scaling), 8 (0-255), 10 (0-1023), 12 (0-4095, 15 (0-32767) or 16 (0-65535).
      • getDefault16bitRange

        public static int getDefault16bitRange()
        Returns the default 16-bit display range, 0 (auto-scaling), 8, 10, 12, 15 or 16.
      • updatePosition

        public void updatePosition(int c,                  int z,                  int t)
      • flatten

        public ImagePlus flatten()
        Returns a "flattened" version of this image, in RGB format.
      • setOverlay

        public void setOverlay(ij.gui.Overlay overlay)
        Installs a list of ROIs that will be drawn on this image as a non-destructive overlay.
        See Also:
        Roi.setStrokeColor(java.awt.Color), Roi.setStrokeWidth(float), Roi.setFillColor(java.awt.Color), Roi.setLocation(int, int), Roi.setNonScalable(boolean)
      • setOverlay

        public void setOverlay(Shape shape,              Color color,              BasicStroke stroke)
        Creates an Overlay from the specified Shape, Color and BasicStroke, and assigns it to this image.
        See Also:
        setOverlay(ij.gui.Overlay), Roi.setStrokeColor(java.awt.Color), Roi.setStrokeWidth(float)
      • setOverlay

        public void setOverlay(ij.gui.Roi roi,              Color strokeColor,              int strokeWidth,              Color fillColor)
        Creates an Overlay from the specified ROI, and assigns it to this image.
        See Also:
        setOverlay(ij.gui.Overlay)
      • getOverlay

        public ij.gui.Overlay getOverlay()
        Returns the current overly, or null if this image does not have an overlay.
      • setHideOverlay

        public void setHideOverlay(boolean hide)
      • getHideOverlay

        public boolean getHideOverlay()
      • clone

        public Object clone()
        Returns a shallow copy of this ImagePlus.
        Overrides:
        clone in class Object

SCaVis 1.8 © jWork.org