colorspace
Class ColorSpace

java.lang.Object
  |
  +--colorspace.ColorSpace

public class ColorSpace
extends java.lang.Object

This class analyzes the image to provide colorspace information for the decoding chain. It does this by examining the box structure of the JP2 image. It also provides access to the parameter list information, which is stored as a public final field.

See Also:
jj2000.j2k.icc.ICCProfile

Nested Class Summary
static class ColorSpace.CSEnum
          Colorspace enumeration class
static class ColorSpace.Enumeration
          Typesafe enumeration class
static class ColorSpace.MethodEnum
          Method enumeration class
 
Field Summary
(package private) static int BLUE
           
private  ChannelDefinitionBox cdbox
           
private  ComponentMappingBox cmbox
           
private  ColorSpecificationBox csbox
           
static ColorSpace.MethodEnum ENUMERATED
          method enumeration
static java.lang.String eol
           
(package private) static int GRAY
           
(package private) static int GREEN
           
static ColorSpace.CSEnum GreyScale
          colorspace enumeration
 HeaderDecoder hd
          Parameter Specs
static ColorSpace.MethodEnum ICC_PROFILED
          method enumeration
private  ImageHeaderBox ihbox
           
static ColorSpace.CSEnum Illegal
          colorspace enumeration
private  RandomAccessIO in
          Input image
private  PaletteBox pbox
           
 ParameterList pl
          Parameter Specs
(package private) static int RED
           
static ColorSpace.CSEnum sRGB
          colorspace enumeration
static ColorSpace.CSEnum sYCC
          colorspace enumeration
static ColorSpace.CSEnum Unknown
          colorspace enumeration
 
Constructor Summary
ColorSpace(RandomAccessIO in, HeaderDecoder hd, ParameterList pl)
          public constructor which takes in the image, parameterlist and the image header decoder as args.
 
Method Summary
 boolean debugging()
          Are profiling diagnostics turned on
protected  void getBoxes()
          Retrieve the various boxes from the JP2 file.
 int getChannelDefinition(int c)
          Return the channel definition of the input component.
 ColorSpace.CSEnum getColorSpace()
          Return the colorspace (sYCC, sRGB, sGreyScale).
 byte[] getICCProfile()
          Retrieve the ICC profile from the images as a byte array.
 ColorSpace.MethodEnum getMethod()
          Return the colorspace method (Profiled, enumerated, or palettized).
 PaletteBox getPaletteBox()
          Return number of channels in the palette.
 int getPaletteChannelBits(int c)
          Return bitdepth of the palette entries.
 int getPaletteChannels()
          Return number of channels in the palette.
 int getPalettizedSample(int channel, int index)
          Return a palettized sample
static java.lang.String indent(java.lang.String ident, java.lang.String instr)
          Indent a String that contains newlines.
static java.lang.String indent(java.lang.String ident, java.lang.StringBuffer instr)
          Indent a String that contains newlines.
 boolean isOutputSigned(int channel)
          Signed output predicate.
 boolean isPalettized()
          Is palettized predicate.
 java.lang.String toString()
          Return a suitable String representation of the class instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

eol

public static final java.lang.String eol

GRAY

static final int GRAY
See Also:
Constant Field Values

RED

static final int RED
See Also:
Constant Field Values

GREEN

static final int GREEN
See Also:
Constant Field Values

BLUE

static final int BLUE
See Also:
Constant Field Values

pl

public ParameterList pl
Parameter Specs


hd

public HeaderDecoder hd
Parameter Specs


pbox

private PaletteBox pbox

cmbox

private ComponentMappingBox cmbox

csbox

private ColorSpecificationBox csbox

cdbox

private ChannelDefinitionBox cdbox

ihbox

private ImageHeaderBox ihbox

in

private RandomAccessIO in
Input image


ICC_PROFILED

public static final ColorSpace.MethodEnum ICC_PROFILED
method enumeration


ENUMERATED

public static final ColorSpace.MethodEnum ENUMERATED
method enumeration


sRGB

public static final ColorSpace.CSEnum sRGB
colorspace enumeration


GreyScale

public static final ColorSpace.CSEnum GreyScale
colorspace enumeration


sYCC

public static final ColorSpace.CSEnum sYCC
colorspace enumeration


Illegal

public static final ColorSpace.CSEnum Illegal
colorspace enumeration


Unknown

public static final ColorSpace.CSEnum Unknown
colorspace enumeration

Constructor Detail

ColorSpace

public ColorSpace(RandomAccessIO in,
                  HeaderDecoder hd,
                  ParameterList pl)
           throws java.io.IOException,
                  ColorSpaceException
public constructor which takes in the image, parameterlist and the image header decoder as args.

Parameters:
in - input RandomAccess image file.
hd - provides information about the image header.
pl - provides parameters from the default and commandline lists.
Throws:
IOException, - ColorSpaceException
java.io.IOException
ColorSpaceException
Method Detail

getICCProfile

public byte[] getICCProfile()
Retrieve the ICC profile from the images as a byte array.

Returns:
the ICC Profile as a byte [].

indent

public static java.lang.String indent(java.lang.String ident,
                                      java.lang.StringBuffer instr)
Indent a String that contains newlines.


indent

public static java.lang.String indent(java.lang.String ident,
                                      java.lang.String instr)
Indent a String that contains newlines.


getBoxes

protected final void getBoxes()
                       throws ColorSpaceException,
                              java.io.IOException
Retrieve the various boxes from the JP2 file.

Throws:
ColorSpaceException, - IOException
ColorSpaceException
java.io.IOException

getChannelDefinition

public int getChannelDefinition(int c)
Return the channel definition of the input component.


getMethod

public ColorSpace.MethodEnum getMethod()
Return the colorspace method (Profiled, enumerated, or palettized).


getColorSpace

public ColorSpace.CSEnum getColorSpace()
Return the colorspace (sYCC, sRGB, sGreyScale).


getPaletteBox

public PaletteBox getPaletteBox()
Return number of channels in the palette.


getPaletteChannels

public int getPaletteChannels()
Return number of channels in the palette.


getPaletteChannelBits

public int getPaletteChannelBits(int c)
Return bitdepth of the palette entries.


getPalettizedSample

public int getPalettizedSample(int channel,
                               int index)
Return a palettized sample

Parameters:
channel - requested
index - of entry
Returns:
palettized sample

isPalettized

public boolean isPalettized()
Is palettized predicate.


isOutputSigned

public boolean isOutputSigned(int channel)
Signed output predicate.


toString

public java.lang.String toString()
Return a suitable String representation of the class instance.

Overrides:
toString in class java.lang.Object

debugging

public boolean debugging()
Are profiling diagnostics turned on

Returns:
yes or no