pmFPAfile.h

Go to the documentation of this file.
00001 /* @file  pmFPAview.h
00002  * @brief Tools to manipulate the FPA structure elements.
00003  *
00004  * @author EAM, IfA
00005  *
00006  * @version $Revision: 1.12 $ $Name:  $
00007  * @date $Date: 2007/01/24 02:54:14 $
00008  * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
00009  */
00010 
00011 #ifndef PM_FPA_FILE_H
00012 #define PM_FPA_FILE_H
00013 
00014 /// @addtogroup Camera Camera Layout
00015 /// @{
00016 
00017 #include "pslib.h"
00018 #include "pmConfig.h"
00019 #include "pmFPA.h"
00020 #include "pmFPAview.h"
00021 
00022 typedef enum {
00023     PM_FPA_BEFORE,
00024     PM_FPA_AFTER,
00025 } pmFPAfilePlace;
00026 
00027 typedef enum {
00028     PM_FPA_FILE_NONE,
00029     PM_FPA_FILE_SX,
00030     PM_FPA_FILE_OBJ,
00031     PM_FPA_FILE_CMP,
00032     PM_FPA_FILE_CMF,
00033     PM_FPA_FILE_RAW,
00034     PM_FPA_FILE_IMAGE,
00035     PM_FPA_FILE_PSF,
00036     PM_FPA_FILE_JPEG,
00037     PM_FPA_FILE_KAPA,
00038     PM_FPA_FILE_MANAPLOT,
00039     PM_FPA_FILE_MASK,
00040     PM_FPA_FILE_WEIGHT,
00041     PM_FPA_FILE_FRINGE,
00042 } pmFPAfileType;
00043 
00044 typedef enum {
00045     PM_FPA_MODE_NONE,
00046     PM_FPA_MODE_READ,
00047     PM_FPA_MODE_WRITE,
00048     PM_FPA_MODE_INTERNAL,
00049     PM_FPA_MODE_REFERENCE,
00050 } pmFPAfileMode;
00051 
00052 typedef enum {
00053     PM_FPA_STATE_OPEN     = 0x01,
00054     PM_FPA_STATE_CLOSED   = 0x02,
00055     PM_FPA_STATE_INACTIVE = 0x04,
00056 } pmFPAfileState;
00057 
00058 typedef struct
00059 {
00060     pmFPAfileMode mode;   // is this file read, written, or only used internally?
00061     pmFPAfileType type;   // what type of data is read from / written to disk?
00062     pmFPAfileState state;  // have we opened the file, etc?
00063 
00064     // Desired levels, set by the user
00065     pmFPALevel fileLevel;  // what level in the FPA hierarchy represents a unique file?
00066     pmFPALevel dataLevel;  // at what level do we read/write the data segment?
00067     pmFPALevel freeLevel;  // at what level do we free the data segment?
00068     pmFPALevel mosaicLevel;             // at what level is the mosaic?
00069 
00070     pmFPA *fpa;    // for I/O files, we carry a pointer to the complete fpa
00071     psFits *fits;   // for I/O files of fits type (IMAGE, CMP, CMF), we carry a file handle
00072 
00073     bool phu;             // have we written a PHU for this file?
00074     psMetadata *header;   // pointer (view) to the current hdu header
00075 
00076     pmReadout *readout;   // for internal files, we only carry a single readout
00077 
00078     psMetadata *names;   // filenames supplied by the cmdline or detdb are saved here
00079 
00080     char *filerule;   // rule for constructing a filename when needed
00081     char *filextra;   // additional information used to define filenames (context dependent)
00082     char *extrule;   // rule for constructing an extension name when needed
00083     char *extxtra;   // additional information used to define extension names (context dependent)
00084 
00085     char *name;    // the name of the rule (useful for debugging / tracing)
00086     char *filename;   // the current name of an active file
00087     char *extname;   // the current name of an active file extension
00088 
00089     bool save;
00090 
00091     // the following elements are used for WRITE-mode IMAGE-type pmFPAfiles to inform
00092     // the creation of a new image based on an existing image
00093     pmFPA *src;    // if an output FPA, inherit from this FPA
00094     int xBin;    // desired binning in x direction
00095     int yBin;    // desired binning in y direction
00096 
00097     psMetadata *camera;
00098     psMetadata *format;
00099 }
00100 pmFPAfile;
00101 
00102 // allocate an empty pmFPAfile structure
00103 pmFPAfile *pmFPAfileAlloc ();
00104 
00105 // select the readout from the named pmFPAfile; if the named file does not exist,
00106 pmReadout *pmFPAfileThisReadout (psMetadata *files, const pmFPAview *view, const char *name);
00107 
00108 // select the cell from the named pmFPAfile; if the named file does not exist,
00109 pmCell *pmFPAfileThisCell (psMetadata *files, const pmFPAview *view, const char *name);
00110 
00111 // select the chip from the named pmFPAfile; if the named file does not exist,
00112 pmChip *pmFPAfileThisChip (psMetadata *files, const pmFPAview *view, const char *name);
00113 
00114 // add the specified filename info (value) to the files of the given mode using the given reference name
00115 bool pmFPAfileAddFileNames (psMetadata *files, char *name, char *value, int mode);
00116 
00117 // convert the rule to a name based on the current view
00118 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, const pmFPAview *view);
00119 
00120 bool pmFPAfileCopyView (pmFPA *out, pmFPA *in, const pmFPAview *view);
00121 
00122 bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, int xBin, int yBin, const pmFPAview *view);
00123 
00124 // Return the file type enum from a string
00125 pmFPAfileType pmFPAfileTypeFromString(const char *type);
00126 
00127 /// @}
00128 # endif

Generated on Fri Feb 2 22:35:28 2007 for Pan-STARRS Module Library by  doxygen 1.5.1