org.shapelogic.imageutil
Class IJImage

java.lang.Object
  extended by org.shapelogic.imageutil.IJImage
All Implemented Interfaces:
PixelHandler, SLImage

public class IJImage
extends java.lang.Object
implements SLImage

Abstraction of ImageJ ImageProcessor.
The other main implementation should probably be build on top of BufferedImage.

Author:
Sami Badawi

Field Summary
protected  java.lang.String _filePath
           
protected  ij.ImagePlus _image
           
protected  ij.process.ImageProcessor _imageProcessor
           
 
Constructor Summary
IJImage(ij.ImagePlus image)
           
IJImage(ij.process.ImageProcessor ip)
           
IJImage(java.lang.String filePath)
           
IJImage(java.lang.String dir, java.lang.String fileName, java.lang.String fileFormat)
          Constructor with 3 string arguments.
 
Method Summary
 int get(int index)
           
 int get(int x, int y)
          This is a faster version of getPixel() that does not do bounds checking.
 java.awt.Rectangle getActiveRectangle()
          This mean that the whole images is available in the pixels array.
 int getHeight()
          Returns the height of this image in pixels.
 ij.process.ImageProcessor getImageProcessor()
           
 int getLineStride()
           
 int getNChannels()
          Returns the number of color channels in the image.
 int getPixelCount()
           
 java.lang.Object getPixels()
          Returns a reference to this image's pixel array.
 java.awt.Rectangle getRoi()
           
 int getWidth()
          Returns the width of this image in pixels.
 boolean isEmpty()
           
 boolean isGray()
           
 boolean isGray16()
           
 boolean isGray8()
           
 boolean isInvertedLut()
          Returns true if this image uses an inverting LUT that displays zero as white and 255 as black.
 boolean isRgb()
           
 void putPixel(int x, int y, int value)
          Stores the specified value at (x,y).
 void set(int index, int value)
           
 void set(int x, int y, int value)
          This is a faster version of putPixel() that does not clip out of range values and does not do bounds checking.
 void setPixels(java.lang.Object pixels)
          Sets a new pixel array for the image.
 void setRoi(int x, int y, int rwidth, int rheight)
           
 void setRoi(java.awt.Rectangle roi)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_imageProcessor

protected ij.process.ImageProcessor _imageProcessor

_image

protected ij.ImagePlus _image

_filePath

protected java.lang.String _filePath
Constructor Detail

IJImage

public IJImage(java.lang.String filePath)

IJImage

public IJImage(java.lang.String dir,
               java.lang.String fileName,
               java.lang.String fileFormat)
Constructor with 3 string arguments.

Parameters:
dir - e.g. "./src/test/resources/images/smallThinShapes";
fileName - e.g. "blobs"
fileFormat - e.g. ".gif"

IJImage

public IJImage(ij.ImagePlus image)

IJImage

public IJImage(ij.process.ImageProcessor ip)
Method Detail

get

public int get(int x,
               int y)
Description copied from interface: SLImage
This is a faster version of getPixel() that does not do bounds checking.

Specified by:
get in interface SLImage

get

public int get(int index)
Specified by:
get in interface SLImage

getHeight

public int getHeight()
Description copied from interface: SLImage
Returns the height of this image in pixels.

Specified by:
getHeight in interface SLImage

getNChannels

public int getNChannels()
Description copied from interface: SLImage
Returns the number of color channels in the image. The color channels can be accessed by toFloat(channelNumber, fp) and written by setPixels(channelNumber, fp).

Specified by:
getNChannels in interface SLImage
Returns:
1 for grayscale images, 3 for RGB images

getPixelCount

public int getPixelCount()
Specified by:
getPixelCount in interface SLImage

getPixels

public java.lang.Object getPixels()
Description copied from interface: SLImage
Returns a reference to this image's pixel array. The array type (byte[], short[], float[] or int[]) varies depending on the image type.

Specified by:
getPixels in interface SLImage

getRoi

public java.awt.Rectangle getRoi()
Specified by:
getRoi in interface SLImage

getWidth

public int getWidth()
Description copied from interface: SLImage
Returns the width of this image in pixels.

Specified by:
getWidth in interface SLImage

isInvertedLut

public boolean isInvertedLut()
Description copied from interface: SLImage
Returns true if this image uses an inverting LUT that displays zero as white and 255 as black.

Specified by:
isInvertedLut in interface SLImage

putPixel

public void putPixel(int x,
                     int y,
                     int value)
Description copied from interface: SLImage
Stores the specified value at (x,y). Does nothing if (x,y) is outside the image boundary. For 8-bit and 16-bit images, out of range values are clipped. For RGB images, the argb values are packed in 'value'. For float images, 'value' is expected to be a float converted to an int using Float.floatToIntBits().

Specified by:
putPixel in interface PixelHandler
Specified by:
putPixel in interface SLImage

set

public void set(int x,
                int y,
                int value)
Description copied from interface: SLImage
This is a faster version of putPixel() that does not clip out of range values and does not do bounds checking.

Specified by:
set in interface SLImage

set

public void set(int index,
                int value)
Specified by:
set in interface SLImage

setPixels

public void setPixels(java.lang.Object pixels)
Description copied from interface: SLImage
Sets a new pixel array for the image. The length of the array must be equal to width*height. Use setSnapshotPixels(null) to clear the snapshot buffer.

Specified by:
setPixels in interface SLImage

setRoi

public void setRoi(java.awt.Rectangle roi)
Specified by:
setRoi in interface SLImage

setRoi

public void setRoi(int x,
                   int y,
                   int rwidth,
                   int rheight)
Specified by:
setRoi in interface SLImage

getImageProcessor

public ij.process.ImageProcessor getImageProcessor()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface SLImage

getActiveRectangle

public java.awt.Rectangle getActiveRectangle()
This mean that the whole images is available in the pixels array.

Specified by:
getActiveRectangle in interface SLImage

getLineStride

public int getLineStride()
Specified by:
getLineStride in interface SLImage

isGray

public boolean isGray()
Specified by:
isGray in interface SLImage

isRgb

public boolean isRgb()
Specified by:
isRgb in interface SLImage

isGray8

public boolean isGray8()
Specified by:
isGray8 in interface SLImage

isGray16

public boolean isGray16()
Specified by:
isGray16 in interface SLImage


Copyright © 2009. All Rights Reserved.