|
My Project
|
#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include <string.h>#include "include/studynr.h"#include "include/substitutions.h"
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 | fnmatch (char *key, char *fname) |
| int | fncasematch (char *key, char *fname) |
| int | rnameSplit (char *rname, char *name1, char *name2, char *name3, int max_name_len) |
| int | rnameMatch (char *rname, int rnr, char *test_str) |
| 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) |
| int fncasematch | ( | char * | key, |
| char * | fname | ||
| ) |
Case-independent check whether string fname matches string key, which may contain wildcards ? and *.
| key | key string |
| fname | filename that is evaluated |
References fnmatch().
Referenced by rnameMatch().

| int fnmatch | ( | char * | key, |
| char * | fname | ||
| ) |
Check if string fname matches string key, which may contain wildcards ? and *.
| key | key string |
| fname | filename that is evaluated |
References fnmatch().
Referenced by fncasematch(), and fnmatch().

| int rnameMatch | ( | char * | rname, |
| int | rnr, | ||
| char * | test_str | ||
| ) |
Test whether region name or number matches with a test string. Test string can contain wildcards. If test string contains only one subname, it is tested against whole rname. If it contains 2-3 subnames, those are tested against the corresponding tokens in rname. Subname '.' stands for empty name. Number is tested only if test string contains one token of all digits.
| rname | Region name which is tested |
| rnr | Region number (1..) |
| test_str | Test string |
References fncasematch(), MAX_REGIONNAME_LEN, and rnameSplit().

| int rnameSplit | ( | char * | rname, |
| char * | name1, | ||
| char * | name2, | ||
| char * | name3, | ||
| int | max_name_len | ||
| ) |
Split region name into 1-3 subparts of given max length.
| rname | Region name to split (string is not edited) |
| name1 | Pointer to 1st subname (anatomical region) |
| name2 | Pointer to 2nd subname (usually hemisphere) |
| name3 | Pointer to 3rd subname (usually image plane) |
| max_name_len | Max lenght of subnames, excluding terminal null |
References MAX_REGIONNAME_LEN.
Referenced by rnameMatch().
| 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. |
References studynr_from_fname2().

| 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) |
References MAX_STUDYNR_LEN, studynr_in_fname(), studynr_rm_zeroes(), studynr_to_lowercase(), and studynr_validity_check().
Referenced by 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. |
References MAX_STUDYNR_LEN, studynr_rm_zeroes(), studynr_to_lowercase(), and studynr_validity_check2().
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 |
References MAX_STUDYNR_LEN.
| int studynr_rm_zeroes | ( | char * | studynr | ) |
Remove zeroes from the number part of the PET study number.
| studynr | modified study number |
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 |
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 containing 1-5 letters (upper- or lowercase) followed by 1-5 digits. Argument string is not modified.
| studynr | evaluated study number |
References studynr_validity_check2().
Referenced by studynr_from_fname2().

| int studynr_validity_check2 | ( | char * | studynr, |
| int | zero_ok | ||
| ) |
Check that the argument string is a valid TPC study number containing 1-5 letters (upper- or lowercase) followed by 1-5 digits. Argument string is not modified.
| 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) |
References MAX_STUDYNR_LEN.
Referenced by studynr_in_fname(), and studynr_validity_check().