edu.neu.ccs.gui
Class ImageTools

java.lang.Object
  extended byedu.neu.ccs.gui.ImageTools

public class ImageTools
extends Object

Class ImageTools is a special purpose class for reading images in various formats from a directory on the local system.

Since:
2.3.3
Version:
2.3.3

Field Summary
static FilenameFilter imageFilter
          The filter to pick out jpg, gif, and png files.
 
Constructor Summary
private ImageTools()
          Prevent instantiation.
 
Method Summary
static String[] readAllImageFileNames(String directory)
          Returns all image file names in the given directory.
static Image[] readAllImages(String directory)
          Reads all image files in the given directory.
static ImagePaintable[] readAllImagesAsPaintable(String directory)
          Reads all image files in the given directory.
static ImagePaintableLite[] readAllImagesAsPaintableLite(String directory)
          Reads all image files in the given directory.
static String[] readImageFileNames(String directory, String filelist)
          Returns all image file names in the given directory that are present in the given file list.
static Image[] readImages(String directory, String filelist)
          Reads the image files in the given directory with the given filelist that contains the image file names.
static Image[] readImages(String directory, String[] imageFileNames)
          Reads the image files in the given directory with the given image file names.
static ImagePaintable[] readImagesAsPaintable(String directory, String filelist)
          Reads the image files in the given directory with the given filelist that contains the image file names.
static ImagePaintable[] readImagesAsPaintable(String directory, String[] imageFileNames)
          Reads the image files in the given directory with the given image file names.
static ImagePaintableLite[] readImagesAsPaintableLite(String directory, String filelist)
          Reads the image files in the given directory with the given filelist that contains the image file names.
static ImagePaintableLite[] readImagesAsPaintableLite(String directory, String[] imageFileNames)
          Reads the image files in the given directory with the given image file names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageFilter

public static final FilenameFilter imageFilter
The filter to pick out jpg, gif, and png files. Expects the file name to end with ".jpg", ".gif", or, ".png", possibly with mixed or upper case.

Constructor Detail

ImageTools

private ImageTools()
Prevent instantiation.

Method Detail

readImages

public static Image[] readImages(String directory,
                                 String[] imageFileNames)

Reads the image files in the given directory with the given image file names.

Returns the image list as Image[].

If no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
imageFileNames - the array of image file names
Returns:
the image list as Image[]

readImages

public static Image[] readImages(String directory,
                                 String filelist)

Reads the image files in the given directory with the given filelist that contains the image file names.

The filelist is assumed to be a file in the same directory as the images.

Returns the image list as Image[].

If no image files are available, returns an empty array.

If filelist is null or is an empty string, then this method reads all images in the directory.

Parameters:
directory - the directory with the images and image file list
filelist - the name of the text file with the image file list
Returns:
the image list as Image[]

readAllImages

public static Image[] readAllImages(String directory)

Reads all image files in the given directory.

Returns the image list as Image[].

If no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
Returns:
the image list as Image[]

readImagesAsPaintable

public static ImagePaintable[] readImagesAsPaintable(String directory,
                                                     String[] imageFileNames)

Reads the image files in the given directory with the given image file names.

Returns the image list as ImagePaintable[].

If no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
imageFileNames - the array of image file names
Returns:
the image list as ImagePaintable[]

readImagesAsPaintable

public static ImagePaintable[] readImagesAsPaintable(String directory,
                                                     String filelist)

Reads the image files in the given directory with the given filelist that contains the image file names.

The filelist is assumed to be a file in the same directory as the images.

Returns the image list as ImagePaintable[].

If no image files are available, returns an empty array.

If filelist is null or is an empty string, then this method reads all images in the directory.

Parameters:
directory - the directory with the images and image file list
filelist - the name of the text file with the image file list
Returns:
the image list as ImagePaintable[]

readAllImagesAsPaintable

public static ImagePaintable[] readAllImagesAsPaintable(String directory)

Reads all image files in the given directory.

Returns the image list as ImagePaintable[].

If no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
Returns:
the image list as ImagePaintable[]

readImagesAsPaintableLite

public static ImagePaintableLite[] readImagesAsPaintableLite(String directory,
                                                             String[] imageFileNames)

Reads the image files in the given directory with the given image file names.

Returns the image list as ImagePaintableLite[].

If no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
imageFileNames - the array of image file names
Returns:
the image list as ImagePaintableLite[]

readImagesAsPaintableLite

public static ImagePaintableLite[] readImagesAsPaintableLite(String directory,
                                                             String filelist)

Reads the image files in the given directory with the given filelist that contains the image file names.

The filelist is assumed to be a file in the same directory as the images.

Returns the image list as ImagePaintableLite[].

If no image files are available, returns an empty array.

If filelist is null or is an empty string, then this method reads all images in the directory.

Parameters:
directory - the directory with the images and image file list
filelist - the name of the text file with the image file list
Returns:
the image list as ImagePaintableLite[]

readAllImagesAsPaintableLite

public static ImagePaintableLite[] readAllImagesAsPaintableLite(String directory)

Reads all image files in the given directory.

Returns the image list as ImagePaintableLite[].

If no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
Returns:
the image list as ImagePaintableLite[]

readAllImageFileNames

public static String[] readAllImageFileNames(String directory)

Returns all image file names in the given directory.

If the directory is null or no image files are available, returns an empty array.

Parameters:
directory - the directory with the images
Returns:
the image file names in the directory

readImageFileNames

public static String[] readImageFileNames(String directory,
                                          String filelist)

Returns all image file names in the given directory that are present in the given file list.

If the directory is null or no image files are available, returns an empty array.

If the file list is null or blank, then returns all image file names in the directory.

Parameters:
directory - the directory with the images and image file list
filelist - the name of the text file with the image file list
Returns:
the image file names in the list