TPCCLIB
|
Functions for processing PET study number. More...
#include "libtpcmisc.h"
Go to the source code of this file.
Functions | |
int | studynr_in_fname (char *fname, char *studynr) |
int | studynr_from_fname2 (char *fname, char *studynr, int force) |
int | studynr_from_fname (char *fname, char *studynr) |
int | studynr_match (char *studynr1, char *studynr2) |
int | studynr_validity_check2 (char *studynr, int zero_ok) |
int | studynr_validity_check (char *studynr) |
int | studynr_rm_zeroes (char *studynr) |
int | studynr_to_lowercase (char *studynr) |
Functions for processing PET study number.
Definition in file studynr.c.
int studynr_from_fname | ( | char * | fname, |
char * | studynr ) |
Extract study number (max MAX_STUDYNR_LEN chars) from filename. This function removes initial zeroes from the number part, and converts uppercase letters to lowercase, if necessary.
fname | Filename may include path. Filename is not modified. |
studynr | Pointer for the resulting study number. Memory (>=MAX_STUDYNR_LEN+1 chars) for it must be allocated before calling this. |
Definition at line 119 of file studynr.c.
Referenced by cptReadOne(), dftRead(), imgMicropetCTToEcat7(), imgMicropetPETToEcat7(), resFName2study(), resRead(), tsvRead(), and xelRead().
int studynr_from_fname2 | ( | char * | fname, |
char * | studynr, | ||
int | force ) |
Extract study number (max MAX_STUDYNR_LEN chars) from filename.
This function removes initial zeroes from the number part, and converts uppercase letters to lowercase, if necessary.
fname | Filename, which may include the path. Filename is not modified. |
studynr | Pointer for the resulting study number. Memory (>=MAX_STUDYNR_LEN+1 chars) must be allocated before calling this. |
force | Validity of studynr is verified (0) or not verified (1) |
Definition at line 67 of file studynr.c.
Referenced by imgGetMicropetHeader(), and studynr_from_fname().
int studynr_in_fname | ( | char * | fname, |
char * | studynr ) |
Find study number (max MAX_STUDYNR_LEN chars) inside filename; Study number must contain 1-5 letters followed by 1-5 digits, if such string is not found then error code is returned.
Initial zeroes are removed if necessary and uppercase letters are changed to lowercase.
fname | Filename may include path. Filename is not modified. |
studynr | Pointer to string (>=MAX_STUDYNR_LEN+1 chars) where the resulting study number is written. |
Definition at line 18 of file studynr.c.
Referenced by studynr_from_fname2().
int studynr_match | ( | char * | studynr1, |
char * | studynr2 ) |
Check whether two valid study numbers are the same. If either of study numbers is shorter than the other, the end parts are compared; thus study numbers that are changed by SPM can be matched. Argument strings are not modified.
studynr1 | compared number |
studynr2 | compared number |
Definition at line 142 of file studynr.c.
int studynr_rm_zeroes | ( | char * | studynr | ) |
Remove zeroes from the number part of the PET study number.
studynr | modified study number. |
Definition at line 211 of file studynr.c.
Referenced by studynr_from_fname2(), and studynr_in_fname().
int studynr_to_lowercase | ( | char * | studynr | ) |
Convert the PET study number letters to lowercase. Conversion is not done to non-valid study number.
studynr | modified study number. |
Definition at line 233 of file studynr.c.
Referenced by studynr_from_fname2(), and studynr_in_fname().
int studynr_validity_check | ( | char * | studynr | ) |
Check that the argument string is a valid TPC study number.
Valid study number here is defined as containing 1-5 letters (upper- or lowercase) followed by at least 1 digit, with total length of max 10 characters.
studynr | Evaluated study number; not modified. |
Definition at line 196 of file studynr.c.
Referenced by ecat63ReadAllToImg(), ecat63ReadPlaneToImg(), imgGetEcat63MHeader(), imgGetEcat7MHeader(), and studynr_from_fname2().
int studynr_validity_check2 | ( | char * | studynr, |
int | zero_ok ) |
Check that the argument string is a valid TPC study number.
Valid study number here is defined as containing 1-5 letters (upper- or lowercase) followed by at least 1 digit, with total length of max 10 characters.
studynr | String to be evaluated as study number. Not modified here. |
zero_ok | Number part of study number may start with zero (1) or may not (0) |
Definition at line 166 of file studynr.c.
Referenced by studynr_in_fname(), and studynr_validity_check().