WSxM_header.h

Go to the documentation of this file.
00001 /***********************************************************************
00002 *
00003 *       File Name: Header.h
00004 *
00005 *       Description: Header file for Header.c
00006 *
00007 ***********************************************************************/
00008 
00009 #include <cstdio>
00010 #include <glib-2.0/glib.h>
00011 
00012 // The max. number of chars in a value has to be defined.
00013 // This should already be done in 'WSxM_io.C'
00014 #ifndef WSXM_MAXCHARS
00015 #define WSXM_MAXCHARS 1000
00016 #endif
00017 
00018 #define IMAGE_HEADER_VERSION        "1.0 (April 2000)"
00019 #define IMAGE_HEADER_SIZE_TEXT      "Image header size: "
00020 #define IMAGE_HEADER_END_TEXT       "Header end"
00021 #define TEXT_COPYRIGHT_NANOTEC      "WSxM file copyright Nanotec Electronica\n"
00022 
00023 // File IDs, soon obsolent by using FileIdStruc
00024 #define STM_IMAGE_FILE_ID           "SxM Image file\n"
00025 #define CITS_IMAGE_FILE_ID          "CITS Image file\n"
00026 
00027 #define IMAGE_HEADER_GENERAL_INFO                  "General Info"
00028 #define IMAGE_HEADER_GENERAL_INFO_NUM_COLUMNS      "Number of columns"
00029 #define IMAGE_HEADER_GENERAL_INFO_NUM_ROWS         "Number of rows"
00030 #define IMAGE_HEADER_GENERAL_INFO_Z_AMPLITUDE      "Z Amplitude"
00031 #define IMAGE_HEADER_GENERAL_INFO_ACQ_CHANNEL      "Acquisition channel"
00032 #define IMAGE_HEADER_GENERAL_INFO_HEAD_TYPE        "Head type"
00033 // CITS additions
00034 #define IMAGE_HEADER_GENERAL_INFO_POINTS_PER_IV    "Number of points per IV"
00035 #define IMAGE_HEADER_GENERAL_INFO_I_AMPLITUDE      "Current Amplitude"
00036 // addtions to save curves
00037 #define IMAGE_HEADER_GENERAL_INFO_LINES            "Number of lines"
00038 #define IMAGE_HEADER_GENERAL_INFO_POINTS           "Number of points"
00039 #define IMAGE_HEADER_GENERAL_INFO_X_TEXT           "X axis text"
00040 #define IMAGE_HEADER_GENERAL_INFO_X_UNIT           "X axis unit"
00041 #define IMAGE_HEADER_GENERAL_INFO_Y_TEXT           "Y axis text"
00042 #define IMAGE_HEADER_GENERAL_INFO_Y_UNIT           "Y axis unit"
00043 
00044 #define IMAGE_HEADER_MISC_INFO                     "Miscellaneous"
00045 #define IMAGE_HEADER_MISC_INFO_MAXIMUM             "Maximum"
00046 #define IMAGE_HEADER_MISC_INFO_MINIMUM             "Minimum"
00047 #define IMAGE_HEADER_MISC_INFO_COMMENTS            "Comments"
00048 #define IMAGE_HEADER_MISC_INFO_VERSION             "Version"
00049 // additions to save curves
00050 #define IMAGE_HEADER_MISC_INFO_FIRST               "First Forward"
00051 
00052 #define IMAGE_HEADER_CONTROL                     "Control"
00053 #define IMAGE_HEADER_CONTROL_X_AMPLITUDE         "X Amplitude"
00054 #define IMAGE_HEADER_CONTROL_Y_AMPLITUDE         "Y Amplitude"
00055 #define IMAGE_HEADER_CONTROL_SET_POINT           "Set point"
00056 #define IMAGE_HEADER_CONTROL_Z_GAIN              "Z Gain"
00057 #define IMAGE_HEADER_CONTROL_BIAS                "Topography Bias"
00058 #define IMAGE_HEADER_CONTROL_X_FREQUENCY         "X-Frequency"
00059 #define IMAGE_HEADER_CONTROL_X_OFFSET            "X Offset"
00060 #define IMAGE_HEADER_CONTROL_Y_OFFSET            "Y Offset"
00061 #define IMAGE_HEADER_CONTROL_ROTATION            "Rotation"
00062 #define IMAGE_HEADER_CONTROL_SCAN_DIRECTION      "Direction"
00063 
00064 #define IMAGE_HEADER_HEADS                        "Head Settings"
00065 #define IMAGE_HEADER_HEADS_X_CALIBRATION          "X Calibration"
00066 #define IMAGE_HEADER_HEADS_Y_CALIBRATION          "Y Calibration"
00067 #define IMAGE_HEADER_HEADS_Z_CALIBRATION          "Z Calibration"
00068 #define IMAGE_HEADER_HEADS_PREAMP_GAIN            "Preamp Gain"
00069 
00070 #define IMAGE_HEADER_CURRENTIMAGE                "Current images bias list"
00071 #define IMAGE_HEADER_CURRENTIMAGE_IMAGE          "Image"
00072 #define IMAGE_HEADER_MAXMINSLIST                 "maxmins list"
00073 /***********************************************************************
00074 *
00075 *       WSxM_HEADER structure
00076 *
00077 *       This is the structure we will use to represent a header of a WSxM
00078 *       It will have three strings representing each value in the header
00079 *
00080 *       - The title will indicate the group of values this value is included
00081 *       in the header
00082 *
00083 *       - The label will precisate what is the value for
00084 *
00085 *       - The value will be an ASCII representation of the value
00086 *
00087 *       In the structure we can find too the total number of fields in the
00088 *       structure
00089 *
00090 ***********************************************************************/
00091 
00092 typedef struct typeHeader {
00093     char **tszTitles;
00094     char **tszLabels;
00095     char **tszValues;
00096 
00097     int iNumFields;
00098 } WSxM_HEADER;
00099 
00100 typedef struct FileIdStruc {
00101     int index;                  // index, used to set type
00102     gchar *name;                // name
00103     gchar *aliasname;           // aliasname
00104     gchar *fileidtag;           // id-tag used within the header (2nd line) for file type identification
00105     gchar *suffix;              // file suffix
00106     gchar *option;              // option used to select file type 
00107 };
00108 
00109 extern FileIdStruc FileId[];
00110 
00111 /* Initialization of the header */
00112 
00113 void HeaderInit(WSxM_HEADER * pHeader);
00114 
00115 /* Header file input/output */
00116 
00117 /* Header read */
00118 
00119 int HeaderRead(WSxM_HEADER * pHeader, FILE * pFile);
00120 
00121 /* Header write */
00122 
00123 int HeaderWrite(WSxM_HEADER * pHeader, FILE * pFile);
00124 int HeaderWrite(WSxM_HEADER * pHeader, FILE * pFile, gchar * gType);
00125 
00126 /* Header access to one field */
00127 
00128 /* Read */
00129 
00130 double HeaderGetAsNumber(WSxM_HEADER * pHeader, char *szTitle,
00131                          char *szLabel);
00132 int HeaderGetAsString(WSxM_HEADER * pHeader, char *szTitle, char *szLabel,
00133                       char *szValue);
00134 void HeaderReadTitle(char *szLine, char *szTitle);
00135 void HeaderReadLabel(char *szLine, char *szLabel);
00136 void HeaderReadValue(char *szLine, char *szValue);
00137 
00138 /* Write */
00139 
00140 void HeaderSetAsFloating(WSxM_HEADER * pHeader, char *szTitle,
00141                          char *szLabel, double lfValue);
00142 void HeaderSetAsInt(WSxM_HEADER * pHeader, char *szTitle, char *szLabel,
00143                     int iValue);
00144 void HeaderSetAsString(WSxM_HEADER * pHeader, char *szTitle, char *szLabel,
00145                        char *szValue);
00146 
00147 /* Header destroy */
00148 
00149 void HeaderDestroy(WSxM_HEADER * pHeader);
00150 
00151 /* Internally used functions */
00152 
00153 int HeaderReadLine(WSxM_HEADER * pHeader, FILE * pFile);
00154 int HeaderGetSize(WSxM_HEADER * pHeader);
00155 int HeaderAddValue(WSxM_HEADER * pHeader, char *szTitle, char *szLabel,
00156                    char *szValue);
00157 
00158 void RemoveLeftAndRightWhitesFromString(char *szString);
00159 void ReplaceStringInString(char *szDest, const char *szOld,
00160                            const char *szNew);

Generated on Sat Apr 1 09:04:28 2006 for GXSM by  doxygen 1.4.6