public class ImageDataset extends IODataset
Constructor and Description |
---|
ImageDataset()
Empty constructor for (de)serialization.
|
ImageDataset(java.io.File dataSource)
Creates a new ImageDataset from the specified file.
|
ImageDataset(java.lang.String dataFileName)
Creates a new ImageDataset from the specified file.
|
Modifier and Type | Method and Description |
---|---|
long |
getBigFileSize()
Size in bytes for "big" images.
|
int |
getCurrentFrame()
Returns the current position in the image file
|
static double[] |
getData(java.awt.image.BufferedImage image,
int x,
int y,
int w,
int h)
Reads a specified region in an image and returns the RGB data.
|
int |
getNumFrames()
Returns the number of frames in the image file
|
static int[] |
getPixelData(java.awt.image.BufferedImage img)
Returns the pixel data from an image.
|
void |
read()
Retrieves the data from the image.
|
double[] |
read(int idx)
For multi-image file formats, reads the image at the specified index.
|
void |
rewind()
Resets the current frame to the first frame.
|
void |
setBigFileSize(long bytes)
Sets the threshold size in bytes for "big" images.
|
public ImageDataset(java.io.File dataSource) throws java.io.IOException
dataSource
- source of datajava.io.IOException
- if an I/O error occurs.public ImageDataset(java.lang.String dataFileName) throws java.io.IOException
dataFileName
- name of source filejava.io.IOException
- if an I/O error occurs.public ImageDataset()
public static int[] getPixelData(java.awt.image.BufferedImage img)
img
- image to readpublic void read() throws java.io.IOException
for (int i=0; i<instance.getNumFrames(); i++) { instance.read(); // instance's data is now the contents of the current frame }
public static double[] getData(java.awt.image.BufferedImage image, int x, int y, int w, int h)
image
- image to processx
- x-coordinate of top left corner of bounding box to ready
- y-coordinate of top left corner of bounding box to readw
- width of regionh
- height of regionjava.lang.IndexOutOfBoundsException
- if provided an invalid regionpublic double[] read(int idx) throws java.io.IOException
idx
- index to readjava.io.IOException
- if an I/O error occursjava.lang.IndexOutOfBoundsException
- if specified index is less than 0 or greater than the number of frames in the imagepublic void rewind()
public int getCurrentFrame()
public int getNumFrames() throws java.io.IOException
java.io.IOException
- if an I/O error occurspublic long getBigFileSize()
. Files smaller than this value are read as conventional
,
.
public void setBigFileSize(long bytes)
bytes
- threshold filesize in bytes.