Ignore:
Timestamp:
04/10/07 11:40:47 (13 years ago)
Author:
melissa
Message:

Updated documentation to reflect recent API changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/reader-guide.txt

    r2568 r2588  
    1515  not (or if there is no way of checking). 
    1616 
    17 int getImageCount(String) throws FormatException, IOException : 
    18   Return the number of image planes in the file.  This method should begin 
    19   by checking if the given argument is equal to the current file; if not, 
    20   initFile(String) should be called (see below). 
     17int getImageCount() throws FormatException, IOException : 
     18  Return the number of image planes in the file.   
    2119 
    22 boolean isRGB(String) throws FormatException, IOException : 
     20boolean isRGB() throws FormatException, IOException : 
    2321  This should only return true if the file's image planes are stored as RGB 
    24   or indexed color.  All other cases return false.  This method should begin 
    25   by checking if the given argument is equal to the current file; if not, 
    26   initFile(String) should be called (see below). 
     22  or indexed color.  All other cases return false.  
    2723 
    28 boolean isLittleEndian(String) throws FormatException, IOException : 
     24boolean isLittleEndian() throws FormatException, IOException : 
    2925  Return the byte ordering of the pixel data.  Note that in some cases, this 
    3026  is different from the file's native ordering.  If the pixel data is 
    3127  guaranteed to have 8 bits per pixel, then isLittleEndian can return 
    32   anything. This method should begin by checking if the given argument is equal 
    33   to the current file; if not, initFile(String) should be called (see below). 
     28  anything. 
    3429 
    35 boolean isInterleaved(String) throws FormatException, IOException : 
     30boolean isInterleaved() throws FormatException, IOException : 
    3631  This is only relevant if the file's image planes are stored as RGB or 
    3732  indexed color; however, it should always be implemented.  If the image 
    3833  planes are RGB, and the pixel data is stored as "RRR...GGG...BBB", then 
    3934  return false.  Otherwise, if the pixel data is stored as "RGBRGBRGB..." 
    40   return true.  This method should begin by checking if the given argument 
    41   is equal to the current file; if not, initFile(String) should be called 
    42   (see below). 
     35  return true. 
    4336 
    44 String[] getUsedFiles(String) throws FormatException, IOException : 
     37String[] getUsedFiles() throws FormatException, IOException : 
    4538  You only need to override this if your format uses multiple files in a single 
    4639  dataset.  This method should return a list of all the files associated with 
     
    4841  For an example of how this works, see loci.formats.in.PerkinElmerReader. 
    4942 
    50 byte[] openBytes(String, int) throws FormatException, IOException : 
     43byte[] openBytes(int) throws FormatException, IOException : 
    5144  Returns a byte array containing the pixel data for the specified image from 
    5245  the given file.  Should throw a FormatException if the image number is invalid 
    5346  (less than 0 or >= the number of images).  The ordering of the array 
    5447  returned by openBytes should correspond to the values returned by 
    55   isLittleEndian(String) and isInterleaved(String).  Also, the length of the 
     48  isLittleEndian() and isInterleaved().  Also, the length of the 
    5649  byte array should be [image width * image height * bytes per pixel].  Extra 
    57   bytes will generally be truncated.  This method should begin 
    58   by checking if the given argument is equal to the current file; if not, 
    59   initFile(String) should be called (see below). 
     50  bytes will generally be truncated. 
    6051 
    61 BufferedImage openImage(String, int) throws FormatException, IOException : 
     52BufferedImage openImage(int) throws FormatException, IOException : 
    6253  Basically the same as openBytes, but returns a java.awt.image.BufferedImage 
    6354  instead of a byte array.  In general, the easiest way to implement this is 
     
    8475  super.initFile(String).  You will also need to set up the stream for reading 
    8576  the file, as well as initializing any dimension information and metadata. 
    86   Most of this logic is up to you; however, it is wise to set the following 
    87   variables: 
    88     int sizeX[0] : the image width 
    89     int sizeY[0] : the image height 
    90     int sizeZ[0] : number of planes along Z axis (set to 1 if there are none) 
    91     int sizeC[0] : the number of channels (set to 3 if RGB/indexed color) 
    92     int sizeT[0] : number of planes along T axis (set to 1 if there are none) 
    93     String currentOrder[0] : the dimension ordering of the planes 
    94     int pixelType[0] : corresponds to the number of bytes per pixel; see 
    95                        constant values in FormatReader for a list of valid 
    96                        values 
    97     boolean orderCertain[0] : set to true if you are certain that the dimension 
    98                               order is correct 
     77  Most of this logic is up to you; however, you should populate the 'core' 
     78  variable (see loci.formats.CoreMetadata). 
    9979 
    10080  Note that each variable is initialized to 0 or null when 
     
    167147  loci.formats.MetadataStore (every subclass of FormatReader keeps an instance 
    168148  of MetadataStore by default); so to add OME-XML support is as simple as 
    169   calling getMetadataStore(String) on a format reader instance, and then 
     149  calling getMetadataStore() on a format reader instance, and then 
    170150  calling the appropriate "set" methods as documented in OMEXMLMetadataStore. 
    171151 
Note: See TracChangeset for help on using the changeset viewer.