Next / Previous / Contents / TCC Help System / NM Tech homepage

Table of Contents

1. Overview
1.1. How to get this document
2. Operation of the archx.py script
3. The archx.rnc schema
4. archx.py: The script
4.1. Prologue
4.2. Imports
4.3. Manifest constants
4.4. Main
4.5. processArchive(): Process the contents of one archive
4.6. processFile(): Check one image file
4.7. writeIndex(): Output the index for one archive directory
4.8. class Imagex: An object to describe one image
4.9. Imagex.__init__(): Constructor
4.10. Imagex.writeNode(): Translate self to XML
4.11. Epilogue
5. archindex.py: Reader for archive index files
5.1. Prologue
5.2. class ArchiveIndex: Index of one archive
5.3. ArchiveIndex.__init__(): Constructor
5.4. ArchiveIndex.getArchImage(): Retrieve an archived image
5.5. ArchiveIndex.genArchImages(): Generate contained image entries
5.6. ArchiveIndex.addArchImage(): Add one image
5.7. ArchiveIndex.readFile(): Instantiate from XML
5.8. class ArchImage: Archived catalog entry
5.9. ArchImage.readNode(): Convert an XML node
5.10. getIntAttr(): Retrieve an integer attribute value
6. Defect statistics
6.1. Syntax errors
6.2. Strong typing errors
6.3. Logic errors

1. Overview

The program described in this document is part of a system for indexing photos. For documentation on the base catalog, see An XML-based bird image cataloging system.

As scans are accumulated, they must be archived on CDs. The current scheme is to place groups of reference PNG files into directories named bird-001, bird-002, and so on, each sized to fit on a CD.

The purpose of the archx program is to build an index of one of these CD-sized directories. Given an archive number (e.g., 013 for archive directory bird-013), it finds all the .png image files in that directory, and does these operations for each image:

  1. The image file's base name should be its catalog number. If that number is not defined in the birdimages.xml file, an error message is written.

  2. The program reads the image file and determines its image height and width in pixels. We can calculate the actual image size using the scan attribute in the image's catalog entry.

  3. If there is no thumbnail image in the standard thumbnail directory, one is created.

A file named arch-nnn.xml will be written by this script, describing all the images in that file. This file will be used as input to a later processing stage that builds a set of web pages displaying the images of each species (yet to be written).

1.1. How to get this document

This publication is available in Web form and also as a PDF document. Please forward any comments to john@nmt.edu.

Files mentioned in this document include: