ImgLib scripts

Scripts called from html pages

    displaytag
      referenced from the makeindex page icon to display the tags
      and a medium image (QUERY_STRING=both) or from the filename
      to just display the tags(No QUERY_STRING) 
      referenced from the edrecord form.

    makeindex  POST or GET method: col_name browse/search
        Creates the index page with the small thumbnails for a collection.
      Called from listdirs, and from the "previous and master collection" 
        buttons on makeindex and displaytag forms. 

        
    listdirs.pl  listdirs(curdir, UPcol_name)
        called by makeindex to list any subcollections
        Returns a count of the subcollections it found
        subroutine searchdir called by makeindex 

   rethiresurl.pl - returns a URL to the hiresolution data component
      called by makeindex, cgi-glimpse1, displaytag, stagedisplay.pl
        encapsualtes the information about how different collections want
        to allow access to hi-resolution images. For LUNG gives URL to MSS
        server, For BERKELEY-LAB sends you to order form, Doesn't work for
        KAISER.

   reporterr.pl - returns an HTML formated error reply
      called by most scripts.

   stereoview - form/applet to display stereoimages
      called from makeindex page "steroview" button for LUNG... collections
        calls the sv.class applet

   stagelist add images to a user's staging list
     invoked from makeindex:browse with action "Selected Files"
        takes each of the files input and adds them to a
        possibly already existing staging list.
        or action "All Files" to add all the files in the collection
        to the staging list.
     invoked from the stagelist form to delete, edit, move, link, rename
        and/or stage some files
       action= remove_all, remove_selected, stage_all, stage_selected,
               delete_all, delete_selected, edit_all, edit_selected
               move_all, move_selected, link_all, link_selected 
               order_all order_selected and rename

     invoked from editlist to display a specified list (fileq), action=View

   stagedisplay.pl  - displays the list of images queued for staging, etc.
      called by stagelist

   sv.java - applet that moves the stereovies around
      called from stereoview

   updatemate - updates the stereoview tags for LUNG collection images
      called by the sv.java applet


   wforms/addimages POST method: col_name, image_source, images,
        action: setup or add
        For setup action reads the description file to get the image_source
           then diplays all the files there on an addimage form with action
           add.
        For add action, requires image_source directory and list of image
           files. Adds the url,file and size for each image to the hi-res 
           directory. Runs wforms/imgcreate for all the files. 
           Checks the lockfile $URLbasedir$RELdir/tmp/ImgGen to see if any
           other adds are in progress. If so creates a queue file
           $URLbasedir$RELdir/tmp/ImgGen<pid> which is processed after the
           current adds are done. 
           Reports back to user.
     Called by: store.html, action = setup and addimages with action = add.

   wforms/create_tags
        Called by a POST method through the http server. 
        Reads its arguments (col_name, filename, dowhat) from the QUERY_STRING
        Puts whatever it reads from stdin into a tag file for col_name,filename
        Currently called by the DICOM server when loading a dicom file. (don't
        think it is used any longer) imgcreate calls extract_tags.pl instead.

   wforms/create_user 
       displays the current user and groups for the collection $col_name
       Called with METHOD-GET from edform(displaydefaults.pl)
       Called with METHOD-GET from wrhtaccess if a group/user does not exist
       Called with METHOD=POST from store.html and the form it creates- 
           creates a new group or user and adds to those files.
           Then diplays the same form with the new user and group list.

   wforms/createdir.pl check_path(UPcol_name, create_flag)
       checks to see if the UPcol_name collection exists, and if
       the current user has write permission here.
       if create_flag is true and user has write permission in closest existing
       parent, check_path will create any missing components: 
          for intermediate directories: forms
          for the final directory: forms, mdata/hi-res, tags, images
       returns 0 if the directory exists and the user has write permission 
         ( evrything OK )
       three different types of errors :
       - returns 1 if the collection does not exist and the user does not 
         want to create it..
       - returns 2 if the creation of the collection or of missing components 
         has failed because of a system error.
       - returns 3 if the user is not allowed to edit or create this collection. 
      Called by: edform, addimages, create_tags

   wforms/delcol GET method: col_name, images, 
            action: setup, delete_files, delete_collection
        For setup, displays all the files in the collection
        For delete_files: deletes all the files in images
        For delete_collection: deletes all the files in images and remove
             the collections if all files are gone and there are no 
             subcollections.
        Called from store.html (action: setup) and from the form delcol puts
             out
        presents a form for the user to confirm the file deletions and then
        calls deletefiles.pl to actually delete the files

   wforms/deletefiles.pl - actually deletes the files.
      Called from stagelist and delcol
        deletes images and whole collections. Calls iss_remove and dsm_checkid
        to delete Kaiser videos.

   wforms/displaydefaults.pl wr_defaults(col_name, *items,values*)
        writes out an input form that can be used to edit the
        default input form. It has the side effect of changing 
        the tagfile that represents the default input form.
     Called from edform

   wforms/edform POST method col_name,  owner, image_source, description
                existing_tags, more_tag, action: edit_from_file,
                edit_from_parent or add
        For add action takes all the data from the input stream, creates
           new tag and description files, put all the infomation back out
           as another edform.
        For edit_from_file action, reads the existing tag or parent tag file
           and takes the tags from there. If a description was not input
           reads the desciption file.
        For edit_from_parent uses the parent tag file, but the description
           info comes from the form, unless "default" values are selected
           in which case the parent description file values are used.
        Write out new tag and desciption file. Write out new edform html
        page for further edits
     Called by: store.html with edit_from_file and createform.html with
        description data given and either edit_from_file to use parent 
        tag form or add with a list of tags and defaults

   wforms/editlist - globally edit a list of tag file
      called from stagelist on "globally edit files"
      invoked from the editlist form with "verify" or "do edit"
        args are dowhat=setup | verify | do edit
           fileq=<name of stagelist>
           iconsize= tiny | small | default
           more_tags=<ag_name:tag_value,...>
           <tag_name>=<tag_value>

   wforms/edrecord POST method: col_name, image_name, key_word/values,
             action: delete, edit, edit_from_file, add_from_defaults,
                createindex, createtopindex
        Delete - deletes description file (not images???)
        Edit - assumes all input is given and replaces existing tag file.
        Edit_from_file: Picks up all the fields from an existing tag file
                and adds any input ones to them
        Add_from_defaults: Picks up all the values from the default tag
                files and adds them to any that have been input.
        Write the new description file and then displays it to the user
        for more edits.
     Called from: store.html with add_from_defaults, edit_from_file
                        (edit) or delete.  
                edrecord form with actions add_from_defaults, edit,
                        edit_from_file, delete, createtopindex
                displaytag with edit_tag (translates to edit_from_file) 


   wforms/exportmss (mss directory name)
        presents a form to call the MSS to export the directory
     Called from edform->displaydefaults.pl

   wforms/linkojb.pl - lk_object(*srcfiles, dstdir)
        script to link an object[s] from one directory to another.
        It is an error for there to already be an object
        with the target name in the destination directory. If more than
        one source object is given, the destination must be a directory.

        Usage: linkobj source_file... destination 


   wforms/mvojb.pl - mv_object(*srcfiles, dstdir)
        move or rename an object[s] from one directory to another.
        It is an error for there to already be an object
        with the target name in the destination directory. If more than one 
        source object is given, the destination must be a directory.
     Called from stagelist


   wforms/wrhtaccess.pl Writes htaccess files and checks access 
     wr_htaccess called by edform. Rewrites an htaccess file
     chk_access called by addimages, create_user, delcol, edform
             editlist and edrecord

Utility Scripts called by other scripts


   cgi-glimpse (modified from glimpse library)(previous version)
           case_insensitve, partial_match, number of errors, icon_size
           col_name, keyword query.

        Presents the form to run the glimpse search, and the script
        to run it and presents the results.
        called from listdirs.pl subroutine searchdir

   cgi-glimpse1 (modified from glimpse library)(current version)
        case_insensitve, partial_match, number of errors, icon_size
        col_name, keyword query. Added searching on specified fields
        and dates for the BERKELEY-LAB collection

        Present the form to run the glimpse search, and the script
        to run it and present the results.
        called from listdirs.pl subroutine searchdir

   tools/clean_stageq
         Called from a cron job to delete old TMPdir/stageq and selq files

   tools/cp_ics_tags.pl
       reads an ICS (Image Cytometry Standard) Data File and creates
       a tag file from the contents.
       Called by addimages.

   tools/date_parser
       script to take a date input by user and change to a standard form
       Called by cgi-glimpse1.

   tools/fwwhttp.pl - fetches a file from a URL
     Called by imgcreate. -currently no collection uses this feature

   tools/gatantopnm (sourcefile) pnm file written to stdout
        converts a gatan file (almost like tiff) to pnm
        The code is a slight variation of the netpmb tifftoraw filter
     Called by imgcreate

   tools/imgcreate (cnt, color, sformat, lformat, sourcefilelist, 
        destination directory)
      Creates cnt thumbnails of the sourcefile and puts them in the desdir.
        cnt=5 creates all, cnt=4 skips the 640xX to save space. color is
        the color of the original images: "gray" or "color",
        or "no_norm" where no_norm will prevent the script from
        normalizing greyscale thumbnaila. sformat and
        lformat are the fomats for the icon-thumb1, thumb-2,3,lowres images
        and can be gif, jpeg[50-95].
      Called from the addimages page.

   tools/macbintounix  (Macbinfile, unixfile) sh script
        Strips off the 128 byte Macbin header and reads the data fork into
        a Unix file. Check the nlen and zero1 and zero2 fields in the macbin
        to be sure the file is a Macbin file.
     Called by imgcreate when adding images 

   tools/parser
       parses the command line input by the user to cgi-glimpse1
       and translates AND, OR () into the glimpse equivalents ";",",","{","}"
       Called by cgi-glimse1.c.

   tools/pstopnm -o outfile sourcefile
        converts an encapsulated postscript file to pmn
     Called by imgcreate

   tools/tifftopnm sourcefile -writes pnm to stdout
        converts tiff (including 16-bit greyscale) to pnm
     Called by imgcreate

   tools/update-photo-archive
       update-photo-archive  called by buildindex from a cron script
       to update /Imglib/photo-archive.html which
       provides an informative head to the Berkeley-Lab collection

   tools/wwwerror.pl - returns errors found by fwwhttp to clients
     Called by fwwhttp.pl

   tools/wwwmime.pl
     Called by wwwerror.pl

   tools/wwwurl.pl
     Called by wwwerror.pl

   tools/wwwdates.pl 
     Called by wwwmime.pl

   tools/buildindex colname [-f]
        Script to create a static Data Object description page for each object
        in a collection and any subcollections, and a static html index 
        document that references each description
        Also creates the static homepage for the Berkely Lab collection 
        photo-archive.html
      Called by a cron job every night or from a button on the static 
        image and collection index pages

   tools/update-photo-archive - no args
        writes out to stdout the photo-archive.html homepage for the 
        BERKELEY-LAB collection.
     Called by tools/buildindex

   tools/gindex col_name 
        creates the glimpse indexes and field indexes by runing
        glimpseindex on the input collection.
     Called by edrecord

   tools/date_parser (date)
        script to format date into a  standard form
     Called by tools/gindex

   tools/parser
        this script parses the command line input by the user to cgi-glimpse1
        and translates AND, OR () into the glimpse equivalents ";",",","{","}".
        The two programs use IMGTMPdir/commadfile.dat to communicate
     Called by cgi-glimse1.c

Scripts for DICOM files

   tools/dcm_ctnto10
      converts DICOM image_server ctn format file to part10
        (home/imglib1/DICOM/src/ctn/apps/dcm_ctnto10/dcm_ctnto10.c)
      called by image_server - does not belong here???

   tools/dcm_dump_file
      reads a part10 file and prints out the tags and values in ascii
        (home/imglib1/DICOM/src/ctn/apps/dcm_dump_file/dcm_dump_file.c
      called by imgcreate

   tools/dctoraw
     converts dicom part10 files to raw
        (/home/imglib1/DICOM/dicom3tools/appsrc/dcfile/dctoraw.c
     Called by imgcreate

   tools/dirawtopnm
      converts a raw data from DICOM to a portable anymap, from Jef 
        Poskanzer netpbm library.
     Called by imgcreate

   tools/extract_tags.pl  (dicom_file, subcoll_dir, imagename)
        opens the tagfile located in the forms directory, reads 
        from it the list of tags to extract and the corresponding keys
        and calls dcm_dump_file to get the correct values.
     Called by imgcreate

Kaiser Specific Scripts


    Kaiser_scripts/kaiser_add
        Add a new image to a Kaiser collection. (iss/clients/imglib/kaiser_add)
      called with col_name=Procedure number, image_name=run number,
         set_id=DSM_set_id, dsm_host=DSM_host_name
      called by the IssImgLib ImgLibEnter call.
        writes the tagfile, metadata file, call Kimgcreate to create
        the icons, iss_compress to create the jpeg, adds the file to
        the Mpeg creation queue
 
    Kaiser_scripts/kaiser_start
        Creates a new subcollection (iss/clients/imglib/kaiser_start)
        This program makes sure the procedure name is unique
        Creates a new subcollection by that name in the Kaiser collection
        gets all the defaults for the collection from the parent
        Returns the name it used for the collection
     Called by the client Kaiser IssImglib routine ImgLibStartProcedure
       arguments are:
          the collection name (Start date concated with cathnum)
          the run number

    Kaiser_scripts/Kimgcreate
        Creates the derived images for Kaiser videos
        (iss/clients/imglib/Kimgcreate)
        Calls iss_copy_frame to get a single image to create the thumbnails 
        from
      Called by kaiser_add

    Kaiser_scripts/col2mss
        Downloads all the iss files in a collection to the mss
        (iss/clients/imglib/col2mss)
        Command called from command line... output to stdout   
           Usage: col2mss [-r] Kaiser collection_name 
        checks if there is enough MSS disk space
        calls sub_col2mss to do the work

    Kaiser_scripts/web_col2mss
        Downloads all the iss files in a collection to the mss
        (iss/clients/imglib/web_col2mss
        .../cgi-bin/iss/web_col2mss?col_name=???
        or to allow removing... /web_col2mss?col_name=???&remove=??
        remove is either "-r" or ""
      Called from the makeindex page for a Kaiser collection
 
    Kaiser_scripts/sub_col2mss
        Downloads all the iss files in a collection to the mss
        (iss/clients/imglib/sub_col2mss)
        Called by col2mss and web_col2mss.
        Calls iss2mss to copy the files to the mss

    Kaiser_scripts/purgecol
        Command line program to purge all sets in a collection from the DPSS
        (iss/clients/imglib/purgecol)
        Only works if sets are on the MSS
        Called from command line or script, Calls sub_purgecol to do the work

    Kaiser_scripts/web_purgecol
        Web interface to purge all sets in a collection from the DPSS
        (iss/clients/imglib/web_purgecol)
      Called from the makeindex page for a Kaiser collection

    Kaiser_scripts/sub_purgecol
        Common subroutine to purge iss sets (iss/clients/imglib/sub_purgecol)
        calls iss_remove for each set and jpeg set in the collection

    Kaiser_scripts/iss2mss
        DPSS program to copy a set to a file (iss/clients/imglib/iss2mss.c)
      Called by sub_col2mss

    Kaiser_scripts/load2iss
        DPSS program to load a file to the iss (iss/clients/imglib/load2iss.c)
      Called by vpl.c when some one want to view a set that
        is not currently on the DPSS

    Kaiser_scripts/creatempeg
        Script to create or cause an mpeg video to be played
        (iss/clients/imglib/creatempeg)
        It is called from the makeindex page when 
        The only argument is the full path name of the hi-res directory.

    Kaiser_scripts/mpeg_add
        Script to create mpeg movies (iss/clients/imglib/mpeg_add)
      Called from command line or cron job.
        Checks the queue in /ImgLib/ImgLibTmp/MpegImgGen.n.nnnn to see if any
        files are queued. If so, calls iss_compress -M to generate the mpeg
        version.

    Kaiser_scripts/write_mdata.pl
        Writes items into the mdata/image file.
      Called by kaiser_add and update_component

    Kaiser_scripts/update_component
        takes a col_name, an object name and a list of tag names and values
        and updates the values in the mdata/object file.
     Called by ????
       calls write_mdata.pl

    Kaiser_scripts/oneframe
        script to start the single frame jpeg viewer
        (iss/clients/web_tools/oneframe.c)
      Called from "single-frame-viewer" button on top of makeindex page
        with argument hiresfilename/all
      Called from Single_frame on each run on the makeindex page with
        just the hiresfilename.
        gets the setids for the run(s) selected and passes them as hidden
        args to the user and then back to showframe.

    Kaiser_scripts/showframe
      Called from the page that oneframe displays
        (iss/clients/web_tools/showframe.c)
        uses the iss_http server to return one frame of a jpeg file
        also lets user refresh to get next frame, select a new frame
        or go back to oneframe viewer.

    Kaiser_scripts/vpl
        script to cause vplayer.bin to be launched (iss/clients/imglib/vpl.c)
      Called from makeindex to show movie for the whole procedure or 
        individual runs.
        Gets a list of all the setids and jpeg setids for the collection. calls
        dsm_fetch to see which sets are loaded on DPSS. If not all sets are 
        loaded prsents form to allow user to request reloading. When reloading
        calls stage to see if the files need staging on MSS and if so, stages
        them. A child process waits for the staging to complete and then 
        reloads the file to the DPSS by calling load2iss. 
        If the user only wants to see loaded sets, the DPSS host and list of
        setids is returned as a mimetype video/iss message that causes launchvp
        to be run, which is turns calls vplayer.

    Kaiser_scripts/iss_copy_frame
        copies the middle frame from a raw Kaiser video to a file.
      Called by Kimgcreate to get an image to create the thumbnails from

    Kaiser_scripts/iss_compress
        Does jpeg and/or mpeg compression of raw Kaiser video   
        (iss/clients/compress/iss_compress.c,...)
      Called by Kimgcreate to create the jpeg version.

    Kaiser_scripts/iss_remove
        Removes set(s) from the DPSS (iss/clients/tools/iss_remove.c)
      Called by deletefiles.pl when removing objects from the collection
        and from sub_purgecol 

    Kaiser_scripts/dsm_checkid (DSMhostname, Upcol_name, runname, set_id)
        Checks to see if a dsm setid matches the name. 
        (iss/clients/imglib/dsm_checkid.c)
     Called by deletefiles.pl script when deleting the DPSS
        data associated with an entry. 
        Checks to see that the setid we have
        stored agrees with the collection name and run number.

Mbone Specific Scripts


Libraries


   portable bit map library: /vol/pub/netpbm-lbl: used by imgcreate
        tifftopnm(modified), pstopnm(modified), ppmtogif, pnmscale,
        pnmquant, pgmnorm, pnmdepth

   jpeg library: /vol/pub/jpeg-v5b1: used by imgcreate
        cjpeg 
        
   glimpse: /vol/pub/glimpse-2.0: used by listdirs'searchdir, tools/gindex
        cgi-glimpse: (modified), glimpseindex

   wwwhttp: perl library to support http accesses: from imagecreate
        wwwurl`parse, wwwhttp`request