GiciFile
Class LoadFile

java.lang.Object
  extended by GiciFile.LoadFile

public class LoadFile
extends java.lang.Object

This class receives an image file and loads it.
The image file can be a standard format or raw data. Size and data type must be specified if we use raw data loading.
Usage example:
  construct
  getImage
  getTypes
  getRGBComponents

Version:
1.02
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
(package private)  float[][][] imageSamples
          Image samples (index meaning [z][y][x]).
(package private)  boolean RGBComponents
          Indicate if the 3 first components are RGB.
(package private)  java.lang.Class[] samplesType
          Type of the sample (byte, float, etc) for each component.
(package private)  int xSize
          Image width.
(package private)  int ySize
          Image height.
(package private)  int zSize
          Number of image components.
 
Constructor Summary
LoadFile(java.lang.String imageFile)
          Loads an image (JAI loading).
LoadFile(java.lang.String imageFile, int zSize, int ySize, int xSize, int sampleType, int byteOrder, boolean RGBComponents)
          Interface to call raw data image load.
 
Method Summary
static java.lang.Class getClass(int dataType)
          Assign a class to a number data type.
 float[][][] getImage()
          Returns the samples of the image.
(package private)  int[] getIntegerArray(java.lang.String line)
          Receives a String that contains a sequence of integer numbers and returns an array with the integers in the String
 int[] getPixelBitDepth()
          Indicates the bit depth of the loaded image.
 boolean getRGBComponents()
          Returns if the 3 first components are RGB.
 int[] getSignedPixels()
          Indicates if the loaded image has signed pixels.
static int getType(java.lang.String type)
          Assign a number to a data type.
 java.lang.Class[] getTypes()
          Returns the type of the image components.
 void LoadFile(java.lang.String imageFile, int zSize, int ySize, int xSize, java.lang.Class sampleType, int byteOrder, boolean RGBComponents)
          Interface to call raw data image load.
 void LoadPGM(java.lang.String imageFile)
          Loads a pgm image.
 void rawLoad(java.lang.String imageFile, int zSize, int ySize, int xSize, java.lang.Class sampleType, int byteOrder, boolean RGBComponents)
          Loads a raw data image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageSamples

float[][][] imageSamples
Image samples (index meaning [z][y][x]).

All values allowed.


zSize

int zSize
Number of image components.

Negative values are not allowed for this field.


ySize

int ySize
Image height.

Negative values are not allowed for this field.


xSize

int xSize
Image width.

Negative values are not allowed for this field.


samplesType

java.lang.Class[] samplesType
Type of the sample (byte, float, etc) for each component.

Only class types allowed.


RGBComponents

boolean RGBComponents
Indicate if the 3 first components are RGB.

All values allowed.

Constructor Detail

LoadFile

public LoadFile(java.lang.String imageFile)
         throws WarningException
Loads an image (JAI loading).

Parameters:
imageFile - an string that contains the name of the image file
Throws:
WarningException - when the file cannot be load

LoadFile

public LoadFile(java.lang.String imageFile,
                int zSize,
                int ySize,
                int xSize,
                int sampleType,
                int byteOrder,
                boolean RGBComponents)
         throws WarningException
Interface to call raw data image load.

Parameters:
imageFile - an string that contains the name of the image file
zSize - image depth
ySize - image height
xSize - image width
sampleType - an integer representing the class of image samples type
byteOrder - 0 if BIG_ENDIAN, 1 if LITTLE_ENDIAN
RGBComponents - a boolean that indicates if the three first components are RGB (true, otherwise false)
Throws:
WarningException - when the file cannot be load
Method Detail

LoadPGM

public void LoadPGM(java.lang.String imageFile)
             throws WarningException
Loads a pgm image.

Parameters:
imageFile - an string that contains the name of the image file
Throws:
WarningException - when the file cannot be load

getIntegerArray

int[] getIntegerArray(java.lang.String line)
Receives a String that contains a sequence of integer numbers and returns an array with the integers in the String

Parameters:
line - String containing integers separated by blank spaces
Returns:
an array of integers containing the numbers of the String in the same order

LoadFile

public void LoadFile(java.lang.String imageFile,
                     int zSize,
                     int ySize,
                     int xSize,
                     java.lang.Class sampleType,
                     int byteOrder,
                     boolean RGBComponents)
              throws WarningException
Interface to call raw data image load.

Parameters:
imageFile - an string that contains the name of the image file
zSize - an integer of image depth
ySize - an integer of image height
xSize - an integer of image width
sampleType - a Class of image samples type
byteOrder - 0 if BIG_ENDIAN, 1 if LITTLE_ENDIAN
RGBComponents - a boolean that indicates if the three first components are RGB (true, otherwise false)
Throws:
WarningException - when the file cannot be load

rawLoad

public void rawLoad(java.lang.String imageFile,
                    int zSize,
                    int ySize,
                    int xSize,
                    java.lang.Class sampleType,
                    int byteOrder,
                    boolean RGBComponents)
             throws WarningException
Loads a raw data image.

Parameters:
imageFile - an string that contains the name of the image file
zSize - an integer of image depth
ySize - an integer of image height
xSize - an integer of image width
sampleType - a Class of image samples type
byteOrder - 0 if BIG_ENDIAN, 1 if LITTLE_ENDIAN
RGBComponents - a boolean that indicates if the three first components are RGB (true, otherwise false)
Throws:
WarningException - when the file cannot be load

getImage

public float[][][] getImage()
Returns the samples of the image.

Returns:
a 3D float array that contains image samples

getTypes

public java.lang.Class[] getTypes()
Returns the type of the image components.

Returns:
a Class array with the type of each component

getRGBComponents

public boolean getRGBComponents()
Returns if the 3 first components are RGB.

Returns:
true if 3 first components are RGB and false otherwise

getPixelBitDepth

public int[] getPixelBitDepth()
Indicates the bit depth of the loaded image.

Returns:
an integer array containing the bit depth of each component

getSignedPixels

public int[] getSignedPixels()
Indicates if the loaded image has signed pixels.

Returns:
an integer array that indicates if the channel if signed

getType

public static int getType(java.lang.String type)
Assign a number to a data type.

Parameters:
type - an string that represents the data type (byte, boolean, etc.)
Returns:
an integer that represents a data type

getClass

public static java.lang.Class getClass(int dataType)
Assign a class to a number data type.

Parameters:
dataType - a number representing data type according to function getType
Returns:
the class represented by the number data type


TER - Copyright (C) 2006
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) - UAB (Spain)