Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

studynr.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "include/studynr.h"

Functions

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)

Function Documentation

int fncasematch char *  key,
char *  fname
 

Case-independent check whether string fname matches string key, which may contain wildcards ? and *.

Returns:
Returns 1 if strings do match and 0 if not.

int fnmatch char *  key,
char *  fname
 

Check if string fname matches string key, which may contain wildcards ? and *.

Returns:
Returns 1 if strings do match and 0 if not.

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.

Returns:
Returns 1, in case of match or 0 if not matched.
Parameters:
rname  Region name which is tested
rnr  Region number (1..)
test_str  Test string

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.

Returns:
Returns the number of subparts.
Parameters:
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

int studynr_from_fname char *  fname,
char *  studynr
 

Extract study number (max 8 chars) from filename (may include path). Fname is not modified. Memory (>=MAX_STUDYNR_LEN+1 chars) for studynr must be allocated when calling this.

Returns:
Returns 0 if successful.


Generated on Fri Jan 21 16:17:42 2005 for libPET by  doxygen 1.4.1