net.grelf.grip
Class Metadata

java.lang.Object
  extended by net.grelf.grip.Metadata

public class Metadata
extends java.lang.Object

This class manages metadata that GRIP puts into images, particularly for the new images created by combining photos in the batch astro-process. Such images are usually saved as 16-bit TIFF so this class concentrates on that format. The standard TIFF plug-in in jai_imageio.jar is assumed, with package com.sun.media.imageio.plugins.tiff. The writer uses two metadata formats: its native format, called com_sun_media_imageio_plugins_tiff_image_1.0, and the standard format, javax_imageio_1.0. The package description at http://download.java.net/media/jai-imageio/javadoc/1.1/com/sun/media/imageio/plugins/tiff/package-summary.html explains that only certain elements written in the standard metadata format are added into the TIFF structure when using javax.imageio.metadata.IIOMetadata.mergeTree (). Because of that, GRIP writes and reads only the following.
the camera timestamp when the last photo was originally taken


The ImageDescription content is a semicolon-separated sequence of values, of which this is an example:
GRIP combined image;32 images;First started at 2010:01:31 23:59:59;Last ended at 2010:02:01 00:10:59; Exposure 32 x 10s;ISO 3200;Aperture f/4.8;Focal length 1200mm That is separated out and displayed in image information, on GRIP's image menu.


Field Summary
static java.lang.String APERTURE_KEYWORD
           
static java.lang.String EXPOSURE_KEYWORD
           
static java.lang.String FIRST_KEYWORD
           
static java.util.Map<java.lang.String,java.lang.String> FITS_KEYWORDS
           
static java.lang.String FOCAL_LENGTH_KEYWORD
           
static java.lang.String GRIP_COMBINED_IMAGE_ID
           
static java.lang.String IMAGE_KIND_KEYWORD
           
static java.lang.String ISO_KEYWORD
           
static java.lang.String LAST_KEYWORD
           
static java.lang.String METHOD_KEYWORD
           
static java.lang.String NIMAGES_KEYWORD
           
 
Constructor Summary
Metadata()
          Construct an object holding no values, for the values to be added individually through addValue.
Metadata(java.util.List<FITS_KeywordRecord> list)
          Construct from a list of keywords as read from a FITS file.
Metadata(java.util.Map<java.lang.String,java.lang.String> values)
          Construct from a map using the keys defined as static _KEYWORD values in this class.
Metadata(java.lang.String value)
          Construct by parsing the value obtained from Im.getImageMetadataAsMap (), with key "ImageDescription" - which may have been constructed by this class.
 
Method Summary
 void addValue(java.lang.String key, java.lang.String value)
          Only the keys defined as static _KEYWORD strings in this class are recognised by its methods.
 javax.imageio.metadata.IIOMetadataNode buildTree()
          Build a tree fragment in standard (javax_imageio_1.0) format suitable for merging into a javax.imageio.metadata.IIOMetadata object.
 java.lang.StringBuffer formatForDisplay()
          Assemble metadata from all known keys into lines separated by HTML <br> elements.
 java.util.List<FITS_KeywordRecord> getList()
           
 java.util.Map<java.lang.String,java.lang.String> getMap()
           
 java.lang.String getValue(java.lang.String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGE_KIND_KEYWORD

public static final java.lang.String IMAGE_KIND_KEYWORD
See Also:
Constant Field Values

NIMAGES_KEYWORD

public static final java.lang.String NIMAGES_KEYWORD
See Also:
Constant Field Values

METHOD_KEYWORD

public static final java.lang.String METHOD_KEYWORD
See Also:
Constant Field Values

FIRST_KEYWORD

public static final java.lang.String FIRST_KEYWORD
See Also:
Constant Field Values

LAST_KEYWORD

public static final java.lang.String LAST_KEYWORD
See Also:
Constant Field Values

EXPOSURE_KEYWORD

public static final java.lang.String EXPOSURE_KEYWORD
See Also:
Constant Field Values

APERTURE_KEYWORD

public static final java.lang.String APERTURE_KEYWORD
See Also:
Constant Field Values

FOCAL_LENGTH_KEYWORD

public static final java.lang.String FOCAL_LENGTH_KEYWORD
See Also:
Constant Field Values

ISO_KEYWORD

public static final java.lang.String ISO_KEYWORD
See Also:
Constant Field Values

GRIP_COMBINED_IMAGE_ID

public static final java.lang.String GRIP_COMBINED_IMAGE_ID
See Also:
Constant Field Values

FITS_KEYWORDS

public static final java.util.Map<java.lang.String,java.lang.String> FITS_KEYWORDS
Constructor Detail

Metadata

public Metadata(java.util.Map<java.lang.String,java.lang.String> values)
Construct from a map using the keys defined as static _KEYWORD values in this class.


Metadata

public Metadata(java.util.List<FITS_KeywordRecord> list)
Construct from a list of keywords as read from a FITS file.


Metadata

public Metadata()
Construct an object holding no values, for the values to be added individually through addValue.


Metadata

public Metadata(java.lang.String value)
Construct by parsing the value obtained from Im.getImageMetadataAsMap (), with key "ImageDescription" - which may have been constructed by this class. If that value was not constructed by this class an empty Metadata object will be constructed.

Method Detail

getMap

public java.util.Map<java.lang.String,java.lang.String> getMap()

getList

public java.util.List<FITS_KeywordRecord> getList()

addValue

public void addValue(java.lang.String key,
                     java.lang.String value)
Only the keys defined as static _KEYWORD strings in this class are recognised by its methods.


getValue

public java.lang.String getValue(java.lang.String key)

buildTree

public javax.imageio.metadata.IIOMetadataNode buildTree()
Build a tree fragment in standard (javax_imageio_1.0) format suitable for merging into a javax.imageio.metadata.IIOMetadata object.


formatForDisplay

public java.lang.StringBuffer formatForDisplay()
Assemble metadata from all known keys into lines separated by HTML <br> elements.