|
TPCCLIB
|
Header file for library libtpcift. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include "tpcextensions.h"Go to the source code of this file.
Data Structures | |
| struct | IFT_ITEM |
| struct | IFT |
Functions | |
| void | iftInit (IFT *ift) |
| void | iftFree (IFT *ift) |
| int | iftPut (IFT *ift, const char *key, const char *value, char comment, TPCSTATUS *status) |
| int | iftPutDouble (IFT *ift, const char *key, const double value, char comment, TPCSTATUS *status) |
| int | iftPutInt (IFT *ift, const char *key, const int value, char comment, TPCSTATUS *status) |
| int | iftPutUInt (IFT *ift, const char *key, const unsigned int value, char comment, TPCSTATUS *status) |
| int | iftDelete (IFT *ift, int index) |
| int | iftDuplicate (IFT *ift1, IFT *ift2) |
| int | iftReplaceValue (IFT *ift, int i, const char *value, TPCSTATUS *status) |
| int | iftReplaceKey (IFT *ift, int i, const char *key, TPCSTATUS *status) |
| int | iftDeleteDuplicateKeys (IFT *ift, TPCSTATUS *status) |
| int | iftCopyItems (IFT *ift1, IFT *ift2, int is_key_required, int is_value_required, int is_comment_accepted, TPCSTATUS *status) |
| int | iftWrite (IFT *ift, FILE *fp, TPCSTATUS *status) |
| int | iftWriteItem (IFT *ift, int item, FILE *fp, TPCSTATUS *status) |
| int | iftRead (IFT *ift, FILE *fp, int is_key_required, int is_comment_accepted, TPCSTATUS *status) |
| int | iftPutFromString (IFT *ift, const char *line, int is_key_required, int is_comment_accepted, TPCSTATUS *status) |
| int | iftPutFromStringWithSpaceSeparator (IFT *ift, const char *line, int is_comment_accepted, TPCSTATUS *status) |
| int | iftFindKey (IFT *ift, const char *key, int start_index) |
| int | iftFindPair (IFT *ift, const char *key, const char *value, int start_index) |
| int | iftSearchKey (IFT *ift, const char *s, int start_index) |
| int | iftSearchValue (IFT *ift, const char *s, int start_index) |
| int | iftFindNrOfKeys (IFT *ift, const char *key) |
| void | iftDeleteKey (IFT *ift, const char *key) |
| int | iftGetDoubleValue (IFT *ift, const char *key, int index, double *v) |
| int | iftGetFloat (IFT *ift, int index, float *v) |
| int | iftGetDouble (IFT *ift, int index, double *v) |
| int | iftGetInt (IFT *ift, int index, int *v) |
| int | iftGetUInt (IFT *ift, int index, unsigned int *v) |
| int | iftGetDoubleWithUnit (IFT *ift, int index, double *v, int *unit) |
Header file for library libtpcift.
Interfile-type header information processing and file i/o
Definition in file tpcift.h.
|
extern |
Copy items from one IFT struct into another.
Duplicates, empty source, or no copied items are not considered as errors.
| ift1 | Pointer to target IFT. |
| ift2 | Pointer to source IFT. |
| is_key_required | Specifies whether items without key name are copied (0) or not (1). |
| is_value_required | Specifies whether items without value are copied (0) or not (1). |
| is_comment_accepted | Specifies whether comment items are copied or not.
|
| status | Pointer to status data; enter NULL if not needed |
Definition at line 386 of file ift.c.
|
extern |
Remove the specified item from IFT struct.
| ift | Pointer to existing IFT |
| index | Index [0..keyNr-1] of key and value |
Definition at line 206 of file ift.c.
Referenced by dcmFileList(), iftDeleteDuplicateKeys(), iftDeleteKey(), parReadCSV(), parSetStudyNr(), tacReadAllogg(), tacReadGEMS(), tacReadOldAllogg(), tacReadScanditronics(), tacSetHeaderDecayCorrection(), tacSetHeaderInjectiontime(), tacSetHeaderIsotope(), tacSetHeaderScanstarttime(), tacSetHeaderStudynr(), tacSetHeaderTimeunit(), and tacSetHeaderUnit().
Find and delete items that have similar key names.
The first occurrence of the key is kept. Search is case-insensitive, but otherwise key name match must be exact.
| ift | Pointer to IFT. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 348 of file ift.c.
|
extern |
Delete all items which have the the specified key in the IFT.
Key is case insensitive.
| ift | Pointer to existing IFT. |
| key | Pointer to the key string. |
Definition at line 169 of file iftfind.c.
Referenced by imgFillOHeader(), and parWriteCSV().
Make a copy (duplicate) of an IFT struct.
| ift1 | Pointer to source IFT struct to be copied |
| ift2 | Pointer to initiated target IFT struct; any previous contents are deleted. |
Definition at line 236 of file ift.c.
Referenced by imgFillOHeader(), parReadCSV(), tacCopyHdr(), tacReadAllogg(), tacReadCSV(), tacReadDFT(), tacReadGEMS(), tacReadOldAllogg(), tacReadPMOD(), tacReadScanditronics(), tacReadSimple(), tacWriteCSV(), and tacWriteDFT().
|
extern |
Find the IFT item with specified key.
Search is case-insensitive, but otherwise match must be exact.
| ift | Pointer to IFT. |
| key | Key to be searched for. |
| start_index | IFT item index [0..keyNr-1] from which search is started. |
Definition at line 30 of file iftfind.c.
Referenced by abssWrite(), ecatWriteMainheader(), iftCheckKeyValue(), iftCheckKeyValues(), iftDeleteDuplicateKeys(), iftDeleteKey(), iftGetDoubleValue(), mfCreateTAC(), micropetHeaderRead(), parAllocateWithTAC(), parFromIFT(), parIsOptcrit(), parIsStudyNr(), parReadCSV(), parReadFIT(), parReadRES(), parSetStudyNr(), parWriteCSV(), parWriteFIT(), parWriteRES(), tacAllocateWithPAR(), tacGetHeaderDecayCorrection(), tacGetHeaderInjectiontime(), tacGetHeaderIsotope(), tacGetHeaderScanstarttime(), tacGetHeaderStudynr(), tacGetHeaderTimeunit(), tacGetHeaderUnit(), tacRead(), tacReadAllogg(), tacReadGEMS(), tacReadOldAllogg(), tacReadScanditronics(), tacSetHeaderDecayCorrection(), tacSetHeaderInjectiontime(), tacSetHeaderIsotope(), tacSetHeaderScanstarttime(), tacSetHeaderStudynr(), tacSetHeaderTimeunit(), and tacSetHeaderUnit().
|
extern |
Find the nr of exact occurrences of the specified key in the IFT.
Key is case insensitive.
| ift | Pointer to existing IFT. |
| key | Pointer to the key string; if empty or NULL, then the nr of empty keys is returned. |
Definition at line 142 of file iftfind.c.
Referenced by iftCheckKeyValue(), iftCheckKeyValues(), and parFromIFT().
|
extern |
Find the IFT item with specified key and value.
Search is case-insensitive, but otherwise match must be exact.
| ift | Pointer to IFT. |
| key | Key to be searched for. |
| value | Value to be searched for. |
| start_index | IFT item index [0..keyNr-1] from which search is started. |
Definition at line 55 of file iftfind.c.
Referenced by tacRead().
|
extern |
Free memory allocated for IFT data. All contents are destroyed.
| ift | Pointer to IFT |
Definition at line 37 of file ift.c.
Referenced by dcmFileList(), dcmFileRemove(), iftDuplicate(), imgFree(), imgRead(), micropetExists(), micropetHeaderRead(), parFree(), parRead(), parReadLimits(), parWriteIFT(), parWriteLimits(), pathRemoveFiles(), tacCopyHdr(), tacFree(), tacRead(), tacWriteCSV(), and tacWriteDFT().
|
extern |
Read the value in IFT as a double from given item index.
Value in IFT must not contain decimal comma.
| ift | Pointer to IFT |
| index | IFT item index |
| v | Pointer to double which is read from item value. It will be set to NaN in case of an error. |
Definition at line 52 of file iftget.c.
Referenced by parFromIFT().
|
extern |
Finds the specified key string from IFT structure, and reads the corresponding value as double.
| ift | Pointer to existing IFT. |
| key | Pointer to the key string; search is case-insensitive. |
| index | Index [0..keyNr-1] from which the search is started. |
| v | Pointer to double variable where value is written; NaN is written in case of an error. |
Definition at line 191 of file iftfind.c.
Referenced by micropetExists(), and parReadLimits().
|
extern |
Read the value in IFT as a double with unit from given item index.
Value in IFT is allowed to be written with decimal comma, and units may be written in pars () or [].
| ift | Pointer to IFT |
| index | IFT item index |
| v | Pointer to double which is read from item value. It will be set to NaN in case of an error. |
| unit | Pointer for unit (enum unit) which is read from item value. It will be to 0 (enum UNIT_UNKNOWN) if not identified or not present. |
Definition at line 129 of file iftget.c.
Referenced by parReadCSV().
|
extern |
Read the value in IFT as a float from given item index.
Value in IFT must not contain decimal comma.
|
extern |
Read the value in IFT as an integer from given item index.
| ift | Pointer to IFT |
| index | IFT item index |
| v | Pointer to int which is read from item value. It will be set to -9999 in case of an error. |
Definition at line 76 of file iftget.c.
Referenced by parFromIFT(), and parReadCSV().
|
extern |
Read the value in IFT as an unsigned integer from given item index.
| ift | Pointer to IFT |
| index | IFT item index |
| v | Pointer to unsigned int which is read from item value. It will be set to 0 in case of an error. |
Definition at line 101 of file iftget.c.
Referenced by parFromIFT().
|
extern |
Initiate the IFT struct before any use.
| ift | Pointer to IFT |
Definition at line 21 of file ift.c.
Referenced by dcmFileRemove(), iftFree(), imgInit(), imgRead(), micropetExists(), micropetHeaderRead(), parInit(), parRead(), parReadLimits(), parWriteIFT(), parWriteLimits(), pathRemoveFiles(), tacInit(), tacRead(), tacWriteCSV(), and tacWriteDFT().
|
extern |
Add specified key and its value to the IFT.
Either key or value can be empty, but not both of them.
| ift | Pointer to initiated IFT; previous contents are not changed |
| key | Key string; can be empty ("" or NULL) |
| value | Value string; can be empty ("" or NULL) |
| comment | Is this comment line, or line that is commented out?
|
| status | Pointer to status data; enter NULL if not needed |
Definition at line 63 of file ift.c.
Referenced by dcmFileList(), ecatReadMainheader(), iftCopyItems(), iftDuplicate(), iftPutDouble(), iftPutFromString(), iftPutFromStringWithSpaceSeparator(), iftPutInt(), iftPutUInt(), imgFillOHeader(), parAllocateWithTAC(), parExamplePerfectBolus(), parExampleRadiowaterBolus(), parExampleTTACs(), parFromIFT(), parReadFIT(), parReadRES(), parSetStudyNr(), parToIFT(), parWriteCSV(), pathFileList(), tacAllocateWithPAR(), tacReadGEMS(), tacReadScanditronics(), tacSetHeaderDecayCorrection(), tacSetHeaderInjectiontime(), tacSetHeaderIsotope(), tacSetHeaderScanstarttime(), tacSetHeaderStudynr(), tacSetHeaderTimeunit(), and tacSetHeaderUnit().
|
extern |
Add specified key and its floating point (double) value to the IFT.
| ift | Pointer to initiated IFT; previous contents are not changed |
| key | Key string; can be empty ("" or NULL). |
| value | Value as double. |
| comment | Is this comment line, or line that is commented out?
|
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 128 of file ift.c.
Referenced by parWriteLimits().
|
extern |
Process a given string to add key and value to IFT.
Either key or value can be empty, but not both of them.
| ift | Pointer to initiated IFT; previous contents are not changed. |
| line | Pointer to the string to be processed, e.g. "key := value"; extra space characters are excluded from key and value. |
| is_key_required | Specifies whether key name is required or not. If not required, then line contents without equals sign are assumed to represent a value string and key name in IFT struct is left empty.
|
| is_comment_accepted | Specifies whether comment lines are processed or not.
|
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 229 of file iftio.c.
Referenced by iftRead().
|
extern |
Process a given string to add key and value to IFT.
Key and value must be present, with space character as the field separator.
| ift | Pointer to initiated IFT; previous contents are not changed. |
| line | Pointer to the string to be processed, e.g. "key value"; extra space characters are excluded from key and value. |
| is_comment_accepted | Specifies whether comment lines are processed or not.
|
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 339 of file iftio.c.
Referenced by iftPutFromString(), and iftRead().
|
extern |
Add specified key and its integer (signed) value to the IFT.
| ift | Pointer to initiated IFT; previous contents are not changed |
| key | Key string; can be empty ("" or NULL). |
| value | Value as int. |
| comment | Is this comment line, or line that is commented out?
|
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 154 of file ift.c.
|
extern |
Add specified key and its integer (unsigned) value to the IFT.
| ift | Pointer to initiated IFT; previous contents are not changed |
| key | Key string; can be empty ("" or NULL). |
| value | Value as int. |
| comment | Is this comment line, or line that is commented out?
|
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 180 of file ift.c.
Referenced by imgFillOHeader().
|
extern |
Read IFT data into IFT structure.
Any previous contents of IFT are preserved. This function can read the initial ASCII part of files that contain also binary data in the end (from some Interfile images), but not the binary data itself.
| ift | Pointer to IFT. |
| fp | Input file pointer. |
| is_key_required | Specifies whether key name is required or not. If not required, then line contents without equals sign are assumed to represent a value string and key name in IFT struct is left empty.
|
| is_comment_accepted | Specifies whether comment lines are processed or not.
|
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 130 of file iftio.c.
Referenced by micropetHeaderRead(), parRead(), parReadLimits(), and tacRead().
Replace the key name of a specified IFT item.
| ift | Pointer to IFT containing at least the item to be edited. |
| i | IFT item index [0..keyNr-1] to be edited. |
| key | New key string; can be empty ("" or NULL) |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 307 of file ift.c.
Replace the value of specified IFT item.
| ift | Pointer to IFT containing at least the item to be edited. |
| i | IFT item index [0..keyNr-1] to be edited. |
| value | New value string; can be empty ("" or NULL) |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 268 of file ift.c.
|
extern |
Find the IFT item where key contains the given search string.
Search is case-insensitive.
| ift | Pointer to IFT. |
| s | String to be searched for in keys. |
| start_index | IFT item index [0..keyNr-1] from which search is started. |
Definition at line 86 of file iftfind.c.
Referenced by abssWrite().
|
extern |
Find the IFT item where value contains the given search string.
Search is case-insensitive.
| ift | Pointer to IFT. |
| s | String to be searched for in values. |
| start_index | IFT item index [0..keyNr-1] from which search is started. |
Definition at line 114 of file iftfind.c.
Referenced by parReadRES(), tacRead(), tacReadAllogg(), tacReadGEMS(), and tacReadScanditronics().
Write the contents of IFT to the specified file pointer.
| ift | Pointer to IFT. |
| fp | Output file pointer. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 98 of file iftio.c.
Referenced by parReadFIT(), parReadRES(), parWriteCSV(), parWriteIFT(), parWriteLimits(), tacWriteCSV(), tacWriteDFT(), tacWritePMOD(), and tacWriteSimple().
Write one item in IFT to the specified file pointer.
Use iftWrite() to write all IFT items.
| ift | Pointer to IFT. |
| item | Index [0..keyNr-1] of key and value to print. |
| fp | Output file pointer. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 25 of file iftio.c.
Referenced by abssWrite(), and iftWrite().