Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ImagePlus Class Reference
Inheritance diagram for ImagePlus:
BMP_Reader ColorPicker DICOM FITS PGM_Reader

Public Member Functions

 ImagePlus ()
 
 ImagePlus (String title, Image img)
 
 ImagePlus (String title, ImageProcessor ip)
 
 ImagePlus (String pathOrURL)
 
synchronized boolean lock ()
 
synchronized boolean lockSilently ()
 
synchronized void unlock ()
 
void draw ()
 
void draw (int x, int y, int width, int height)
 
void updateAndDraw ()
 
void repaintWindow ()
 
void updateAndRepaintWindow ()
 
void updateImage ()
 
void show ()
 
void show (String statusMessage)
 
void setActivated ()
 
Image getImage ()
 
int getID ()
 
void setImage (Image img)
 
void setProcessor (String title, ImageProcessor ip)
 
void setFileInfo (FileInfo fi)
 
void setColor (Color c)
 
boolean isProcessor ()
 
ImageProcessor getProcessor ()
 
synchronized void trimProcessor ()
 
void killProcessor ()
 
ImageProcessor getMask ()
 
ImageStatistics getStatistics ()
 
ImageStatistics getStatistics (int mOptions)
 
ImageStatistics getStatistics (int mOptions, int nBins)
 
ImageStatistics getStatistics (int mOptions, int nBins, double histMin, double histMax)
 
String getTitle ()
 
String getShortTitle ()
 
void setTitle (String title)
 
int getWidth ()
 
int getHeight ()
 
int getStackSize ()
 
int getType ()
 
int getBitDepth ()
 
void setProperty (String key, Object value)
 
Object getProperty (String key)
 
Properties getProperties ()
 
LookUpTable createLut ()
 
boolean isInvertedLut ()
 
int[] getPixel (int x, int y)
 
Roi getRoi ()
 
void setRoi (Roi roi)
 
void setRoi (int x, int y, int width, int height)
 
void setRoi (Rectangle r)
 
void createNewRoi (int x, int y)
 
void killRoi ()
 
void restoreRoi ()
 
FileInfo getFileInfo ()
 
FileInfo getOriginalFileInfo ()
 
boolean imageUpdate (Image img, int flags, int x, int y, int w, int h)
 
synchronized void flush ()
 
void setIgnoreFlush (boolean ignoreFlush)
 
ImagePlus createImagePlus ()
 
void copyScale (ImagePlus imp)
 
void startTiming ()
 
long getStartTime ()
 
Calibration getCalibration ()
 
void setCalibration (Calibration cal)
 
void setGlobalCalibration (Calibration global)
 
void mouseMoved (int x, int y)
 
void updateStatusbarValue ()
 
String getLocationAsString (int x, int y)
 
String toString ()
 
ImageCanvas getCanvas ()
 
void setCanvas (ImageCanvas ic)
 

Data Fields

boolean changes
 
double pixelWidth = 1.0
 
double pixelHeight = 1.0
 
double pixelDepth = 1.0
 
String unit = "pixel"
 
String units = "pixels"
 
boolean sCalibrated
 

Static Public Attributes

static final int GRAY8 = 0
 
static final int GRAY16 = 1
 
static final int GRAY32 = 2
 
static final int COLOR_256 = 3
 
static final int COLOR_RGB = 4
 

Protected Member Functions

void setType (int type)
 

Protected Attributes

Image img
 
ImageProcessor ip
 
int width
 
int height
 
boolean locked = false
 
ImageCanvas imageCanvas
 

Detailed Description

This is an extended image class that supports 8-bit, 16-bit, 32-bit (real) and RGB images.

See Also
ij.process.ImageProcessor
ij.gui.ImageCanvas

Definition at line 21 of file ImagePlus.java.

Constructor & Destructor Documentation

ImagePlus ( )
inline

Constructs an uninitialized ImagePlus.

Definition at line 86 of file ImagePlus.java.

ImagePlus ( String  title,
Image  img 
)
inline

Constructs an ImagePlus from an AWT Image. 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.

Definition at line 95 of file ImagePlus.java.

ImagePlus ( String  title,
ImageProcessor  ip 
)
inline

Constructs an ImagePlus from an ImageProcessor.

Definition at line 103 of file ImagePlus.java.

ImagePlus ( String  pathOrURL)
inline

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.

Definition at line 111 of file ImagePlus.java.

Member Function Documentation

void copyScale ( ImagePlus  imp)
inline

Copies the calibration of the specified image to this image.

Definition at line 874 of file ImagePlus.java.

ImagePlus createImagePlus ( )
inline

Returns a new ImagePlus with this ImagePlus' attributes (e.g. spatial scale), but no image.

Definition at line 866 of file ImagePlus.java.

LookUpTable createLut ( )
inline

Creates a LookUpTable object corresponding to this image.

Definition at line 555 of file ImagePlus.java.

void createNewRoi ( int  x,
int  y 
)
inline

Creates a new selection. The type is determined by which tool in the tool bar is active. The user interactively sets the size.

Definition at line 676 of file ImagePlus.java.

void draw ( )
inline

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).

Definition at line 196 of file ImagePlus.java.

void draw ( int  x,
int  y,
int  width,
int  height 
)
inline

Draws image and roi outline using a clip rect.

Definition at line 201 of file ImagePlus.java.

synchronized void flush ( )
inline

Sets the image arrays to null to help the garbage collector do its job. Does nothing if the image is locked or a setIgnoreFlush(true) call has been made.

Definition at line 845 of file ImagePlus.java.

int getBitDepth ( )
inline

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

Definition at line 511 of file ImagePlus.java.

Calibration getCalibration ( )
inline

Returns this image's calibration.

Definition at line 893 of file ImagePlus.java.

FileInfo getFileInfo ( )
inline

Returns a FileInfo object containing information, including the pixel array, needed to save this image. Use getOriginalFileInfo() to get a copy of the FileInfo object used to open the image.

See Also
ij.io.FileInfo
getOriginalFileInfo
setFileInfo

Definition at line 775 of file ImagePlus.java.

int getID ( )
inline

Returns this image's unique numeric ID.

Definition at line 270 of file ImagePlus.java.

Image getImage ( )
inline

Returns the current AWT image.

Definition at line 263 of file ImagePlus.java.

String getLocationAsString ( int  x,
int  y 
)
inline

Converts the current cursor location to a string.

Definition at line 960 of file ImagePlus.java.

ImageProcessor getMask ( )
inline

For images with irregular ROIs, returns a byte mask, otherwise, returns null. Mask pixels have a non-zero value.

Definition at line 403 of file ImagePlus.java.

FileInfo getOriginalFileInfo ( )
inline

Returns the FileInfo object that was used to open this image. Returns null for images created using the File/New command.

See Also
ij.io.FileInfo
getFileInfo

Definition at line 826 of file ImagePlus.java.

int [] getPixel ( int  x,
int  y 
)
inline

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.

Definition at line 580 of file ImagePlus.java.

ImageProcessor getProcessor ( )
inline

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.

Definition at line 376 of file ImagePlus.java.

Properties getProperties ( )
inline

Returns this image's Properties. May return null.

Definition at line 550 of file ImagePlus.java.

Object getProperty ( String  key)
inline

Returns the property associated with 'key'. May return null.

Definition at line 542 of file ImagePlus.java.

String getShortTitle ( )
inline

Returns a shortened version of image name.

Definition at line 465 of file ImagePlus.java.

int getStackSize ( )
inline

If this is a stack, return the number of slices, else return 1.

Definition at line 501 of file ImagePlus.java.

long getStartTime ( )
inline

Returns the time in milliseconds when startTiming() was last called.

Definition at line 888 of file ImagePlus.java.

ImageStatistics getStatistics ( )
inline

Returns an ImageStatistics object generated using the standard measurement options (area, mean, mode, min and max).

Definition at line 420 of file ImagePlus.java.

ImageStatistics getStatistics ( int  mOptions)
inline

Returns an ImageStatistics object generated using the specified measurement options.

Definition at line 426 of file ImagePlus.java.

ImageStatistics getStatistics ( int  mOptions,
int  nBins 
)
inline

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.

Definition at line 435 of file ImagePlus.java.

ImageStatistics getStatistics ( int  mOptions,
int  nBins,
double  histMin,
double  histMax 
)
inline

Returns an ImageStatistics object generated using the specified measurement options, histogram bin count and histogram range. Note: except for float images, the number of bins is currently fixed at 256 and the histogram range must be the same as the image range.

Definition at line 445 of file ImagePlus.java.

String getTitle ( )
inline

Returns the image name.

Definition at line 457 of file ImagePlus.java.

int getType ( )
inline

Returns the current image type.

Definition at line 506 of file ImagePlus.java.

boolean imageUpdate ( Image  img,
int  flags,
int  x,
int  y,
int  w,
int  h 
)
inline

Used by ImagePlus to monitor loading of images.

Definition at line 831 of file ImagePlus.java.

boolean isInvertedLut ( )
inline

Returns true is this image uses an inverted LUT that displays zero as white.

Definition at line 563 of file ImagePlus.java.

void killProcessor ( )
inline

Obsolete.

Definition at line 398 of file ImagePlus.java.

void killRoi ( )
inline

Deletes the current region of interest. Makes a copy of the current ROI so it can be recovered by the Edit/Restore Selection command.

Definition at line 706 of file ImagePlus.java.

synchronized boolean lock ( )
inline

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.

Definition at line 134 of file ImagePlus.java.

synchronized boolean lockSilently ( )
inline

Similar to lock, but doesn't beep and display an error message if the attempt to lock the image fails.

Definition at line 151 of file ImagePlus.java.

void mouseMoved ( int  x,
int  y 
)
inline

Displays the cursor coordinates and pixel value in the status bar. Called by ImageCanvas when the mouse moves. Can be overridden by ImagePlus subclasses.

Definition at line 928 of file ImagePlus.java.

void repaintWindow ( )
inline

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.

Definition at line 225 of file ImagePlus.java.

void setActivated ( )
inline

Called by ImageWindow.windowActivated().

Definition at line 258 of file ImagePlus.java.

void setCalibration ( Calibration  cal)
inline

Sets this image's calibration.

Definition at line 905 of file ImagePlus.java.

void setColor ( Color  c)
inline

Sets current foreground color.

Definition at line 347 of file ImagePlus.java.

void setFileInfo ( FileInfo  fi)
inline

Saves this image's FileInfo so it can be later retieved using getOriginalFileInfo().

Definition at line 339 of file ImagePlus.java.

void setGlobalCalibration ( Calibration  global)
inline

Sets the system-wide calibration.

Definition at line 916 of file ImagePlus.java.

void setIgnoreFlush ( boolean  ignoreFlush)
inline

Set ignoreFlush true to not have the pixel data set to null when the window is closed.

Definition at line 860 of file ImagePlus.java.

void setImage ( Image  img)
inline

Replaces the AWT image, if any, with the one specified. Throws an IllegalStateException if an error occurs while loading the image.

Definition at line 277 of file ImagePlus.java.

void setProcessor ( String  title,
ImageProcessor  ip 
)
inline

Replaces the ImageProcessor, if any, with the one specified. Set 'title' to null to leave the image title unchanged.

Definition at line 306 of file ImagePlus.java.

void setProperty ( String  key,
Object  value 
)
inline

Adds a key-value pair to this image's properties.

Definition at line 535 of file ImagePlus.java.

void setRoi ( Roi  roi)
inline

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.

Definition at line 639 of file ImagePlus.java.

void setRoi ( int  x,
int  y,
int  width,
int  height 
)
inline

Creates a rectangular selection.

Definition at line 656 of file ImagePlus.java.

void setRoi ( Rectangle  r)
inline

Creates a rectangular selection.

Definition at line 661 of file ImagePlus.java.

void setTitle ( String  title)
inline

Sets the image name.

Definition at line 474 of file ImagePlus.java.

void show ( )
inline

Opens a window to display this image and clears the status bar.

Definition at line 246 of file ImagePlus.java.

void show ( String  statusMessage)
inline

Opens a window to display this image and displays 'statusMessage' in the status bar.

Definition at line 252 of file ImagePlus.java.

void startTiming ( )
inline

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

Definition at line 882 of file ImagePlus.java.

synchronized void trimProcessor ( )
inline

Frees RAM by setting the snapshot (undo) buffer in the current ImageProcessor to null.

Definition at line 390 of file ImagePlus.java.

synchronized void unlock ( )
inline

Unlocks the image.

Definition at line 162 of file ImagePlus.java.

void updateAndDraw ( )
inline

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).

Definition at line 215 of file ImagePlus.java.

void updateAndRepaintWindow ( )
inline

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.

Definition at line 233 of file ImagePlus.java.

void updateImage ( )
inline

ImageCanvas.paint() calls this method when the ImageProcessor has generated new image.

Definition at line 239 of file ImagePlus.java.

void updateStatusbarValue ( )
inline

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.

Definition at line 939 of file ImagePlus.java.

Field Documentation

boolean changes

True if any changes have been made to this image.

Definition at line 39 of file ImagePlus.java.

final int COLOR_256 = 3
static

8-bit indexed color

Definition at line 33 of file ImagePlus.java.

final int COLOR_RGB = 4
static

32-bit RGB color

Definition at line 36 of file ImagePlus.java.

final int GRAY16 = 1
static

16-bit grayscale (unsigned)

Definition at line 27 of file ImagePlus.java.

final int GRAY32 = 2
static

32-bit floating-point grayscale

Definition at line 30 of file ImagePlus.java.

final int GRAY8 = 0
static

8-bit grayscale (unsigned)

Definition at line 24 of file ImagePlus.java.

double pixelDepth = 1.0

Obsolete. Use GetCalibration().

Definition at line 48 of file ImagePlus.java.

double pixelHeight = 1.0

Obsolete. Use GetCalibration().

Definition at line 45 of file ImagePlus.java.

double pixelWidth = 1.0

Obsolete. Use GetCalibration().

Definition at line 42 of file ImagePlus.java.

boolean sCalibrated

Obsolete. Use GetCalibration().

Definition at line 57 of file ImagePlus.java.

String unit = "pixel"

Obsolete. Use GetCalibration().

Definition at line 51 of file ImagePlus.java.

String units = "pixels"

Obsolete. Use GetCalibration().

Definition at line 54 of file ImagePlus.java.


The documentation for this class was generated from the following file: