|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.shapelogic.imageutil.SLBufferedImage
public class SLBufferedImage
Abstraction of ImageJ ImageProcessor.
This is an attempt to get Java BufferedImage to look like the ImageJ ImageProcessor.
They are not perfectly matched.
I think that I should make the assumption that this is either a
24 or 32 bit RGB
8 bit gray
And fail the creation if it is not.
Field Summary | |
---|---|
protected java.awt.image.BufferedImage |
_bufferedImage
|
protected java.awt.image.DataBuffer |
_dataBuffer
|
protected java.lang.String |
_filePath
|
protected int |
_lineStride
|
protected int |
_mask
|
protected java.lang.Object |
_pixels
|
protected byte[] |
_pixelsInBytes
|
protected int[] |
_pixelsInInt
|
protected short[] |
_pixelsInShort
|
protected java.awt.image.WritableRaster |
_rasta
|
protected java.awt.Rectangle |
_roi
|
static int |
INT_ALL_MASK
|
static int |
INT_BYTE_MASK
|
static int |
UNDEFINED
|
Constructor Summary | |
---|---|
SLBufferedImage(java.awt.image.BufferedImage image)
|
|
SLBufferedImage(java.lang.String filePath)
|
|
SLBufferedImage(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)
In ImageJ this will return the byte if it is a byte gray else an encoded RGB value. This does not work well with BufferedImage that has a method to always return the RGB. I might have to subclass this in order to make an effective implementation. |
java.awt.Rectangle |
getActiveRectangle()
The part of the image that is available in the pixels array. A hook to only have part of the image active at the same time. Returning null mean that the whole images is available in the pixels array. |
java.awt.image.BufferedImage |
getBufferedImage()
|
int |
getHeight()
Returns the height of this image in pixels. |
int |
getLineStride()
Number of index position in the pixels array to jump to get to the next line. |
int |
getNChannels()
Returns the number of color channels in the image. |
int |
getNChannelsOld()
|
int |
getPixelCount()
|
java.lang.Object |
getPixels()
Returns a reference to this image's pixel array. |
byte[] |
getPixelsInBytes()
|
int[] |
getPixelsInInt()
|
java.awt.Rectangle |
getRoi()
Not implemented for BufferedImage. |
int |
getWidth()
Returns the width of this image in pixels. |
boolean |
isEmpty()
Test for failed image read. If the read of an image fails it will still create the object but _bufferedImage == null. |
boolean |
isGray()
|
boolean |
isGray16()
|
boolean |
isGray8()
|
boolean |
isInvertedLut()
Always false for a BufferedImage. |
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 |
---|
public static final int INT_ALL_MASK
public static final int INT_BYTE_MASK
public static final int UNDEFINED
protected java.awt.image.BufferedImage _bufferedImage
protected java.lang.String _filePath
protected java.lang.Object _pixels
protected byte[] _pixelsInBytes
protected short[] _pixelsInShort
protected int[] _pixelsInInt
protected java.awt.image.WritableRaster _rasta
protected java.awt.image.DataBuffer _dataBuffer
protected int _mask
protected java.awt.Rectangle _roi
protected int _lineStride
Constructor Detail |
---|
public SLBufferedImage(java.lang.String filePath)
public SLBufferedImage(java.lang.String dir, java.lang.String fileName, java.lang.String fileFormat)
dir
- e.g. "./src/test/resources/images/smallThinShapes";fileName
- e.g. "blobs"fileFormat
- e.g. ".gif"public SLBufferedImage(java.awt.image.BufferedImage image)
Method Detail |
---|
public int get(int x, int y)
get
in interface SLImage
public int get(int index)
get
in interface SLImage
public int getHeight()
SLImage
getHeight
in interface SLImage
public int getNChannels()
SLImage
getNChannels
in interface SLImage
public int getNChannelsOld()
public int getPixelCount()
getPixelCount
in interface SLImage
public java.lang.Object getPixels()
SLImage
getPixels
in interface SLImage
public byte[] getPixelsInBytes()
public int[] getPixelsInInt()
public java.awt.Rectangle getRoi()
getRoi
in interface SLImage
public int getWidth()
SLImage
getWidth
in interface SLImage
public boolean isInvertedLut()
isInvertedLut
in interface SLImage
public void putPixel(int x, int y, int value)
SLImage
putPixel
in interface PixelHandler
putPixel
in interface SLImage
public void set(int x, int y, int value)
SLImage
set
in interface SLImage
public void set(int index, int value)
set
in interface SLImage
public void setPixels(java.lang.Object pixels)
SLImage
setPixels
in interface SLImage
public void setRoi(java.awt.Rectangle roi)
setRoi
in interface SLImage
public void setRoi(int x, int y, int rwidth, int rheight)
setRoi
in interface SLImage
public boolean isEmpty()
isEmpty
in interface SLImage
public java.awt.Rectangle getActiveRectangle()
getActiveRectangle
in interface SLImage
public int getLineStride()
getLineStride
in interface SLImage
public java.awt.image.BufferedImage getBufferedImage()
public boolean isGray()
isGray
in interface SLImage
public boolean isRgb()
isRgb
in interface SLImage
public boolean isGray8()
isGray8
in interface SLImage
public boolean isGray16()
isGray16
in interface SLImage
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |