TPCCLIB
Loading...
Searching...
No Matches
tpcextensions.h
Go to the documentation of this file.
1
6#ifndef _TPCEXTENSIONS_H_
7#define _TPCEXTENSIONS_H_
8/*****************************************************************************/
9
10/*****************************************************************************/
11#include "tpcclibConfig.h"
12/*****************************************************************************/
13#include <errno.h>
14#include <stdio.h>
15#include <stdint.h>
16#include <stdlib.h>
17#include <string.h>
18#include <strings.h>
19#include <ctype.h>
20#include <math.h>
21#include <float.h>
22#include <time.h>
23/*****************************************************************************/
24
25/*****************************************************************************/
27#ifndef MAX_UNITS_LEN
28#define MAX_UNITS_LEN 32
29#endif
30/*****************************************************************************/
31
32/*****************************************************************************/
34#ifndef MAX_TACNAME_LEN
35#define MAX_TACNAME_LEN 31
36#endif
38#ifndef MAX_PARNAME_LEN
39#define MAX_PARNAME_LEN MAX_TACNAME_LEN
40#endif
41/*****************************************************************************/
42
43/*****************************************************************************/
45#ifndef MAX_STUDYNR_LEN
46#define MAX_STUDYNR_LEN 255
47#endif
48/*****************************************************************************/
49
50/*****************************************************************************/
52typedef enum {
59 // possibility to add more weighting schemes
60 WEIGHTING_LAST
61} weights;
62/*****************************************************************************/
63
64/*****************************************************************************/
77/*****************************************************************************/
78
79/*****************************************************************************/
84typedef enum {
180 UNIT_LAST
182/*****************************************************************************/
183
184/*****************************************************************************/
231/*****************************************************************************/
232
233/*****************************************************************************/
253/*****************************************************************************/
254
255/*****************************************************************************/
256/* stringext */
257extern int strTokenNr(const char *s1, const char *s2);
258extern int strTokenNCpy(const char *s1, const char *s2, int i, char *s3, int count);
259extern int strChrCount(const char *s1, const char *s2);
260extern int strUppercaseCount(const char *s);
261extern void strReplaceChar(char *s, char c1, char c2);
263extern char *strcasestr(const char *haystack, const char *needle);
265#ifndef HAVE_STRDUP
266extern char *strdup(const char *s);
267#endif
268#ifndef HAVE_STRNDUP
269extern char *strndup(const char *s, size_t n);
270#endif
271//#ifndef HAVE_STRNLEN
272extern size_t strnlen(const char *s, size_t n);
273//#endif
274//#ifndef HAVE_STRLCAT
275extern size_t strlcat(char *dst, const char *src, size_t dstsize);
276//#endif
277//#ifndef HAVE_STRLCPY
278extern size_t strlcpy(char *dst, const char *src, size_t dstsize);
279//#endif
280extern char *strstrNoQuotation(const char *haystack, const char *needle);
281extern int strncpyCleanSpaces(char *s1, const char *s2, int maxlen);
282extern int strCleanSpaces(char *s);
283extern int strncpyClean(char *s1, const char *s2, int maxlen);
284extern int strClean(char *s);
285extern char *strTokenDup(const char *s1, const char *s2, int *next);
286extern int strInPars(char *s);
287extern void strCleanPars(char *s);
288extern char *strncatInt(char *str1, const int n, size_t count);
289extern char *strncatDouble(char *str1, const double d, size_t count);
290extern char *strncatIntZ(char *str1, const int n, const int maxn, size_t count);
291extern int strIsSpaceOnly(char *s);
292extern char *strdelstr(char *s1, const char *s2);
293extern char *strTrimLeft(char *s, const size_t t);
294extern char *strEncodeForXML(const char *s);
295extern void strCleanForXML(char *s);
296/*****************************************************************************/
297
298/*****************************************************************************/
299/* decpoint */
300extern int strIsValidNumber(const char *s);
301extern double atofVerified(const char *s);
302extern int atofCheck(const char *s, double *v);
303extern int strHaveDecimalComma(const char *s);
304extern int strHaveDecimalSeparator(const char *s);
305extern int atofList(const char *s1, const char *s2, double *x, int maxn);
306/*****************************************************************************/
307
308/*****************************************************************************/
309/* filename */
310extern void filenameRmPath(char *s);
311extern void filenameRmFile(char *s);
312extern int filenameRmExtension(char *s);
313extern void filenameRmExtensions(char *s);
314extern int fnmatch(const char *fname, const char *key);
315extern int fncasematch(const char *fname, const char *key);
316extern char *filenameGetExtension(const char *s);
317extern char *filenameGetExtensions(const char *s);
318/*****************************************************************************/
319
320/*****************************************************************************/
321/* proginfo */
322extern int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level);
323extern void tpcPrintUsage(const char *program, char *text[], FILE *fp);
324extern int tpcHtmlUsage(const char *program, char *text[], const char *path);
325extern void tpcPrintBuild(const char *program, FILE *fp);
326extern void tpcProgramName(const char *program, int version, int copyright, char *prname, int n);
327extern int tpcYesNo(const char *s);
328/*****************************************************************************/
329
330/*****************************************************************************/
331/* units */
332extern char *unitName(int unit_code);
333extern int unitIdentify(const char *s);
334extern int unitIdentifyFilename(const char *s);
335extern int unitIsDistance(int u);
336extern int unitIsTime(int u);
337extern int unitIsVolume(int u);
338extern int unitIsMass(int u);
339extern int unitIsMole(int u);
340extern int unitIsRadioactivity(int u);
341extern int unitIsRAConc(int u);
342extern int unitIsCombinatorial(int u);
343extern double unitConversionFactor(const int u1, const int u2);
344extern int unitInverse(int u);
345extern int unitDividerHasVolume(int u);
346extern int unitDividerHasMass(int u);
347extern int unitDividendHasRadioactivity(int u);
348extern int unitCombination(const int u1, const int u2, const int v1, const int v2);
349extern int unitDividerMassVolumeConversion(int u);
350extern int unitMultiply(int ua, int ub);
351/*****************************************************************************/
352
353/*****************************************************************************/
354/* statusmsg */
355extern void statusPrint(FILE *fp, TPCSTATUS *s);
356extern void statusInit(TPCSTATUS *s);
357extern void statusFree(TPCSTATUS *s);
358extern void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error);
359extern char *errorMsg(tpcerror e);
360/*****************************************************************************/
361
362/*****************************************************************************/
363/* readasciifile */
364extern size_t asciiFileSize(FILE *fp, int *nonprintable);
365extern char *asciiFileRead(FILE *fp, char *data, size_t maxlen);
366extern int asciiCommentLine(const char *line, int *cont);
367/*****************************************************************************/
368
369/*****************************************************************************/
370/* datetime */
371#ifndef HAVE_GMTIME_R
372extern struct tm* gmtime_r(const time_t* t, struct tm* tm);
373#endif
374#ifndef HAVE_LOCALTIME_R
375extern struct tm* localtime_r(const time_t* t, struct tm* tm);
376#endif
377//#ifndef HAVE_TIMEGM
378extern time_t timegm(struct tm *tm); // always needed at least in macOS
379//#endif
380extern char* ctime_r_int(const time_t *t, char *buf);
381extern int strDateValid(const char *str);
382extern int strDateValid2(const char *str, char *intdate);
383extern int strDateValid3(const char *str, char *intdate);
384extern int strDateValid4(int dateint, char *intdate, int *year, int *month, int *day);
385extern int strTimeValid(const char *str);
386extern int strDateTimeValid(const char *str, char *intdate);
387extern int strDateTimeRead(const char *str, struct tm *date);
388extern int strDateRead(const char *str, struct tm *date);
389extern void time_to_tm(time_t totalsecs, int offset, struct tm *result);
390extern double tmDifference(struct tm *tm1, struct tm *tm0);
391extern void tmAdd(int s, struct tm *d);
392extern double strDateTimeDifference(const char *dt1, const char *dt0);
393extern int strDateTimeAdd(int s, char *dt);
394/*****************************************************************************/
395
396/*****************************************************************************/
397/* studynr */
398extern int studynrVerify(const char *s, int zero_ok);
399extern int studynrStandardize(char *s);
400extern int studynrFromFilename(const char *fname, char *studynr, int force);
401/*****************************************************************************/
402
403/*****************************************************************************/
404/* doubleutil */
405extern int doubleMatch(const double v1, const double v2, const double lim);
406extern int doubleArrayMatch(const double *a1, const double *a2, const unsigned int n, const double lim);
407extern int doubleMatchRel(const double v1, const double v2, const double lim);
408extern double doubleMachEps();
409extern void doubleCopy(double *t, double *s, const unsigned int n);
410extern unsigned int doubleCopyFinite(double *t, double *s, const unsigned int n);
411extern unsigned int doubleNaNs(double *a, const unsigned int n);
412extern unsigned int doubleRange(double *a, const unsigned int n, double *amin, double *amax);
413extern double doubleSum(double *a, const unsigned int n);
414extern double doubleMean(double *a, const unsigned int n);
415extern double doubleWMean(double *a, double *w, const unsigned int n);
416extern int doubleGetWithUnit(const char *s, double *v, int *u);
417extern int doubleSpanPositives(double *a, const int n);
418extern int doubleCSpanPositives(double *a, const int n);
419extern unsigned int doubleNonzeroes(double *a, const unsigned int n);
420extern unsigned int doubleMaxIndex(double *a, const unsigned int n);
421extern unsigned int doubleAbsMaxIndex(double *a, const unsigned int n);
422extern unsigned int doubleMinIndex(double *a, const unsigned int n);
423extern unsigned int doubleAbsMinIndex(double *a, const unsigned int n);
424extern unsigned int doubleGEIndex(double *a, const unsigned int n, double lim);
425extern unsigned int doubleGTIndex(double *a, const unsigned int n, double lim);
426extern double inverfc(double x);
427/*****************************************************************************/
428
429/*****************************************************************************/
430/* floatutil */
431extern int floatMatch(const float v1, const float v2, const float lim);
432extern int floatMatchRel(const float v1, const float v2, const float lim);
433extern float floatMachEps();
434extern void floatCopy(float *t, float *s, const unsigned int n);
435extern unsigned int floatMaxIndex(float *a, const unsigned int n);
436extern float floatSum(float *a, const unsigned int n);
437extern float floatMean(float *a, const unsigned int n);
438extern int floatGetWithUnit(const char *s, float *v, int *u);
439extern int floatSpanPositives(float *a, const int n);
440extern int floatCSpanPositives(float *a, const int n);
441extern unsigned int floatNonzeroes(float *a, const unsigned int n);
442/*****************************************************************************/
443
444/*****************************************************************************/
445/* intutil */
446extern int atoiCheck(const char *s, int *v);
447extern unsigned int factorial(unsigned int n);
448extern unsigned long long int lfactorial(unsigned long long int n);
449
452typedef struct INTLIST {
454 int nr;
456 int _nr;
458 int *i;
459} INTLIST;
460extern void intlistInit(INTLIST *l);
461extern void intlistFree(INTLIST *l);
462extern int intlistAdd(INTLIST *l, const int v, const int ifnew);
463extern void intlistSort(INTLIST *l);
464extern int intlistAddFromString(const char *s1, const char *s2, INTLIST *l, const int ifnew);
465extern int intlistExpandFromString(const char *s1, const char *s2, INTLIST *l, const int ifnew);
466/*****************************************************************************/
467
468/*****************************************************************************/
469/* roiname */
470extern char *roinameSubpart(
471 const char *roiname, const char *dlm, const unsigned int si,
472 char *subpart, const unsigned int slen
473);
474extern char *roinameEditByTemplate(
475 const char *template, const char *currname,
476 char *newname, const unsigned int count
477);
478extern char *roinameAddField(
479 char *roiname, const char *field,
480 const unsigned int in, const unsigned int count
481);
482extern int roinameExists(char *roiname);
483extern int roinameMatch(const char *roiname, const char *test_str, TPCSTATUS *status);
484/*****************************************************************************/
485
486/*****************************************************************************/
487/* endian */
488enum { // used by endianness()
489 ENDIAN_UNKNOWN,
490 ENDIAN_BIG,
491 ENDIAN_LITTLE,
492 ENDIAN_BIG_WORD, /* Middle-endian, Honeywell 316 style */
493 ENDIAN_LITTLE_WORD /* Middle-endian, PDP-11 style */
494};
495extern int endianness();
496extern int endianLittle();
497extern void swap(void *from, void *to, int size);
498extern void swabip(void *buf, int size);
499extern void swawbip(void *buf, int size);
500extern void swawip(void *buf, int size);
501extern void swap64ip(void *buf, unsigned long long size);
502extern void swap32ip(void *buf, unsigned long long size);
503extern void swap16ip(void *buf, unsigned long long size);
504/*****************************************************************************/
505
506/*****************************************************************************/
507#endif /* TPCEXTENSIONS */
508
int verbose
Verbose level, used by statusPrint() etc.
FILE * fp
File pointer for writing log information during development and testing.
int forgiving
Force level, 0 for strict tests for data units etc.
char * current_func
Function where status was last time set.
int current_line
Source line nr where status was last time set.
char * last_file
Source file name where status previously set.
char * current_file
Source file name where status was last time set.
int last_line
Source line nr where status was previously set.
tpcerror error
Error code.
char * last_func
Function where status was previously set.
weights
Is data weighted, or are weight factors available with data?
@ WEIGHTING_OFF
Not weighted or weights not available (weights for all included samples are 1.0).
@ WEIGHTING_ON_FD
Weights based on decay and sample frequency or frame length (Thiele et al, 2008).
@ WEIGHTING_UNKNOWN
Not known; usually assumed that not weighted.
@ WEIGHTING_ON_GENERAL
Weighted or weights are available, but not specified.
@ WEIGHTING_ON_F
Weights based on sample frequency or frame length.
@ WEIGHTING_ON_COUNTS
Weights based on counts (Mazoyer et al, 1986).
double atofVerified(const char *s)
Definition decpoint.c:75
int strDateValid3(const char *str, char *intdate)
Definition datetime.c:214
unsigned int doubleNonzeroes(double *a, const unsigned int n)
Definition doubleutil.c:339
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
Definition proginfo.c:47
int strTokenNr(const char *s1, const char *s2)
Definition stringext.c:25
float floatMachEps()
Definition floatutil.c:82
int roinameMatch(const char *roiname, const char *test_str, TPCSTATUS *status)
Definition roiname.c:183
void filenameRmFile(char *s)
Definition filename.c:44
unsigned int doubleNaNs(double *a, const unsigned int n)
Definition doubleutil.c:156
int doubleGetWithUnit(const char *s, double *v, int *u)
Definition doubleutil.c:272
int doubleSpanPositives(double *a, const int n)
Definition doubleutil.c:302
void intlistInit(INTLIST *l)
Definition intutil.c:80
int intlistExpandFromString(const char *s1, const char *s2, INTLIST *l, const int ifnew)
Definition intutil.c:190
char * ctime_r_int(const time_t *t, char *buf)
Convert calendar time t into a null-terminated string of the form YYYY-MM-DD hh:mm:ss,...
Definition datetime.c:119
char * filenameGetExtensions(const char *s)
Get all extensions of a file name.
Definition filename.c:203
void swap32ip(void *buf, unsigned long long size)
Definition endian.c:210
unsigned int doubleAbsMinIndex(double *a, const unsigned int n)
Definition doubleutil.c:416
double doubleMachEps()
Definition doubleutil.c:105
unsigned int doubleGEIndex(double *a, const unsigned int n, double lim)
Definition doubleutil.c:435
void strReplaceChar(char *s, char c1, char c2)
Definition stringext.c:134
int doubleCSpanPositives(double *a, const int n)
Definition doubleutil.c:320
void statusPrint(FILE *fp, TPCSTATUS *s)
Definition statusmsg.c:82
int unitIsRAConc(int u)
Definition units.c:726
unsigned long long int lfactorial(unsigned long long int n)
Definition intutil.c:63
float floatMean(float *a, const unsigned int n)
Definition floatutil.c:150
int unitDividendHasRadioactivity(int u)
Definition units.c:710
int strDateValid(const char *str)
Definition datetime.c:155
unit
@ UNIT_UMOL_PER_DL_MIN
umol/(dL*min)
@ UNIT_L
liter
@ UNIT_MMOL_PER_DL_MIN
mmol/(dL*min)
@ UNIT_MIN_KBQ_PER_ML
min*kBq/mL
@ UNIT_YEAR
years
@ UNIT_MMOL_PER_G_MIN
mmol/(g*min)
@ UNIT_MOL
mole
@ UNIT_BQ_PER_G
Bq/g.
@ UNIT_MBQ_PER_ML
MBq/mL.
@ UNIT_MIN
minutes
@ UNIT_KG
kilogram
@ UNIT_ML_PER_ML
mL/mL
@ UNIT_MMOL_PER_100G_MIN
mmol/(100g*min)
@ UNIT_ML_PER_ML_MIN
mL/(mL*min)
@ UNIT_MSEC
milliseconds
@ UNIT_UMOL_PER_ML_MIN
umol/(mL*min)
@ UNIT_MIN_BQ_PER_ML
min*Bq/mL
@ UNIT_CPS
counts/s
@ UNIT_MG_PER_DL_MIN
mg/(dL*min)
@ UNIT_PID_PER_L
Percent of injected dose / L.
@ UNIT_UMOL
micromole
@ UNIT_MBQ
megaBecquerel
@ UNIT_UNKNOWN
Unknown unit.
@ UNIT_ML_PER_100G_MIN
mL/(100g*min)
@ UNIT_CPM
counts/min
@ UNIT_KCOUNTS
kilocounts
@ UNIT_UMOL_PER_L
umol/L
@ UNIT_ML
milliliter
@ UNIT_PER_SEC
1/s
@ UNIT_KCPM
kilocounts/min
@ UNIT_ML_PER_DL
mL/dL
@ UNIT_KCPS
kilocounts/s
@ UNIT_MMOL_PER_ML
mmol/mL
@ UNIT_MOL_PER_L
mol/L
@ UNIT_G
gram
@ UNIT_PID_PER_G
Percent of injected dose / g.
@ UNIT_NMOL
nanomole
@ UNIT_UCI_PER_G
uCi/g
@ UNIT_KBQ
kiloBecquerel
@ UNIT_LAST
end of list
@ UNIT_ML_PER_G
mL/g
@ UNIT_NMOL_PER_ML
nmol/mL
@ UNIT_SEC_BQ_PER_ML
s*Bq/mL
@ UNIT_KBQ_PER_ML
kBq/mL
@ UNIT_MONTH
months
@ UNIT_ML_PER_G_MIN
mL/(g*min)
@ UNIT_ML_PER_DL_MIN
mL/(dL*min)
@ UNIT_UNITLESS
Unitless.
@ UNIT_PMOL_PER_L
pmol/L
@ UNIT_G_PER_ML
g/mL
@ UNIT_PID_PER_ML
Percent of injected dose / mL.
@ UNIT_MMOL_PER_ML_MIN
mmol/(mL*min)
@ UNIT_CM
centimeter
@ UNIT_UCI_PER_ML
uCi/mL
@ UNIT_COUNTS
counts
@ UNIT_DL
desiliter
@ UNIT_MBQ_PER_NMOL
MBq/nmol (specific activity)
@ UNIT_MCI
milliCurie
@ UNIT_NMOL_PER_L
nmol/L
@ UNIT_PER_HOUR
1/h
@ UNIT_SEC
seconds
@ UNIT_MBQ_PER_G
MBq/g.
@ UNIT_NCI
nanoCurie
@ UNIT_KBQ_PER_G
kBq/g
@ UNIT_DAY
days
@ UNIT_PID
Percent of injected dose.
@ UNIT_100G
100 grams
@ UNIT_UMOL_PER_ML
umol/mL
@ UNIT_PID_PER_KG
Percent of injected dose / kg.
@ UNIT_GBQ_PER_NMOL
GBq/nmol (specific activity)
@ UNIT_ML_PER_ML_SEC
mL/(mL*sec)
@ UNIT_UG
microgram
@ UNIT_MM
millimeter
@ UNIT_BQ
Becquerel.
@ UNIT_UMOL_PER_G_MIN
umol/(g*min)
@ UNIT_SEC_KBQ_PER_ML
s*kBq/mL
@ UNIT_PMOL_PER_ML
pmol/mL
@ UNIT_PMOL
picomole
@ UNIT_HU
Hounsfield Unit.
@ UNIT_UL
microliter
@ UNIT_HOUR
hours
@ UNIT_UMOL_PER_100G_MIN
umol/(100g*min)
@ UNIT_UM
micrometer
@ UNIT_UCI
microCurie
@ UNIT_MMOL_PER_L
mmol/L
@ UNIT_PER_MIN
1/min
@ UNIT_GBQ
gigaBecquerel
@ UNIT_PERCENTAGE
Percentage (%)
@ UNIT_CI
Curie.
@ UNIT_NCI_PER_G
nCi/g
@ UNIT_MG
milligram
@ UNIT_BQ_PER_ML
Bq/mL.
@ UNIT_MG_PER_100G_MIN
mg/(100g*min)
@ UNIT_M
meter
@ UNIT_MMOL
millimole
@ UNIT_NCI_PER_ML
nCi/mL
char * filenameGetExtension(const char *s)
Get the last extension of a file name.
Definition filename.c:178
void intlistFree(INTLIST *l)
Definition intutil.c:92
void filenameRmPath(char *s)
Definition filename.c:20
int strDateTimeRead(const char *str, struct tm *date)
Definition datetime.c:350
int strDateRead(const char *str, struct tm *date)
Definition datetime.c:378
int unitIsMass(int u)
Definition units.c:402
int unitInverse(int u)
Definition units.c:654
int strInPars(char *s)
Definition stringext.c:453
int doubleMatch(const double v1, const double v2, const double lim)
Definition doubleutil.c:27
char * roinameSubpart(const char *roiname, const char *dlm, const unsigned int si, char *subpart, const unsigned int slen)
Definition roiname.c:20
tpcerror
Error codes. Error code tpcerror, same as error message position in the table (table can not be acces...
@ TPCERROR_NO_REFERENCE
Reference not found.
@ TPCERROR_INVALID_SEPARATOR
Invalid field delimiter.
@ TPCERROR_DUPLICATE_DATA
File contains duplicate data.
@ TPCERROR_INVALID_XRANGE
Invalid sample time range.
@ TPCERROR_INVALID_VALUE
Invalid value.
@ TPCERROR_NO_FILE
File does not exist.
@ TPCERROR_NO_SOLUTION
No solution.
@ TPCERROR_INVALID_PARNR
Invalid number of parameters.
@ TPCERROR_NO_VALUE
Value not found.
@ TPCERROR_OVERLAPPING_DATA
Overlapping data.
@ TPCERROR_NO_DATETIME
File contains no date or time.
@ TPCERROR_BAD_FIT
Fitting not successful.
@ TPCERROR_UNKNOWN_UNIT
Unknown data unit.
@ TPCERROR_FAIL
General error.
@ TPCERROR_INVALID_FORMAT
Invalid file format.
@ TPCERROR_INVALID_HEADER
Invalid header contents.
@ TPCERROR_TOO_BIG
File is too big.
@ TPCERROR_CANNOT_OPEN
Cannot open file.
@ TPCERROR_OUT_OF_MEMORY
Cannot allocate memory.
@ TPCERROR_INVALID_X
Invalid sample time.
@ TPCERROR_NO_KEY
Key not found.
@ TPCERROR_NO_X
No sample times.
@ TPCERROR_UNSUPPORTED
Unsupported file type.
@ TPCERROR_FILE_EXISTS
File exists.
@ TPCERROR_OK
No error.
@ TPCERROR_LAST
marking the end of list
@ TPCERROR_NO_WEIGHTS
File contains no weights.
@ TPCERROR_INCOMPATIBLE_UNIT
Incompatible units.
@ TPCERROR_LARGE_GAP
Large gap in data.
@ TPCERROR_INVALID_FILENAME
Invalid file name.
@ TPCERROR_UNKNOWN_ISOTOPE
Unknown isotope.
@ TPCERROR_NO_DATA
File contains no data.
@ TPCERROR_MISSING_HEADER
Missing header.
@ TPCERROR_CANNOT_DELETE
Cannot delete.
@ TPCERROR_TOO_FEW
File contains too few samples.
@ TPCERROR_CANNOT_READ
Cannot read file.
@ TPCERROR_MISSING_DATA
File contains missing values.
@ TPCERROR_INCOMPATIBLE_DATA
Incompatible data.
@ TPCERROR_CANNOT_WRITE
Cannot write file.
int unitIdentify(const char *s)
Definition units.c:162
int doubleMatchRel(const double v1, const double v2, const double lim)
Definition doubleutil.c:77
char * roinameAddField(char *roiname, const char *field, const unsigned int in, const unsigned int count)
Definition roiname.c:106
int unitIdentifyFilename(const char *s)
Definition units.c:311
unsigned int floatNonzeroes(float *a, const unsigned int n)
Definition floatutil.c:247
time_t timegm(struct tm *tm)
Inverse of gmtime, converting struct tm to time_t.
Definition datetime.c:77
double doubleWMean(double *a, double *w, const unsigned int n)
Definition doubleutil.c:244
unsigned int doubleMaxIndex(double *a, const unsigned int n)
Definition doubleutil.c:357
void filenameRmExtensions(char *s)
Definition filename.c:89
void strCleanForXML(char *s)
Definition stringext.c:769
char * strstrNoQuotation(const char *haystack, const char *needle)
Definition stringext.c:225
int unitIsRadioactivity(int u)
Definition units.c:444
int strHaveDecimalComma(const char *s)
Definition decpoint.c:115
char * strdup(const char *s)
Definition stringext.c:185
char * strncatIntZ(char *str1, const int n, const int maxn, size_t count)
Definition stringext.c:539
double inverfc(double x)
Definition doubleutil.c:473
void intlistSort(INTLIST *l)
Definition intutil.c:137
int strCleanSpaces(char *s)
Definition stringext.c:300
int studynrFromFilename(const char *fname, char *studynr, int force)
Definition studynr.c:79
double strDateTimeDifference(const char *dt1, const char *dt0)
Definition datetime.c:519
char * asciiFileRead(FILE *fp, char *data, size_t maxlen)
double unitConversionFactor(const int u1, const int u2)
Definition units.c:487
char * unitName(int unit_code)
Definition units.c:143
int atoiCheck(const char *s, int *v)
Definition intutil.c:25
char * strncatDouble(char *str1, const double d, size_t count)
Definition stringext.c:517
void tmAdd(int s, struct tm *d)
Definition datetime.c:500
int roinameExists(char *roiname)
Verifies whether TAC name exists or not.
Definition roiname.c:158
int strTimeValid(const char *str)
Definition datetime.c:284
void strCleanPars(char *s)
Definition stringext.c:476
char * strEncodeForXML(const char *s)
Definition stringext.c:731
char * strTrimLeft(char *s, const size_t t)
Definition stringext.c:710
void floatCopy(float *t, float *s, const unsigned int n)
Definition floatutil.c:94
void statusInit(TPCSTATUS *s)
Definition statusmsg.c:104
void time_to_tm(time_t totalsecs, int offset, struct tm *result)
Definition datetime.c:443
size_t strnlen(const char *s, size_t n)
Definition stringext.c:566
int unitCombination(const int u1, const int u2, const int v1, const int v2)
Definition units.c:745
int strncpyCleanSpaces(char *s1, const char *s2, int maxlen)
Definition stringext.c:265
int doubleArrayMatch(const double *a1, const double *a2, const unsigned int n, const double lim)
Definition doubleutil.c:51
void swap64ip(void *buf, unsigned long long size)
Definition endian.c:184
int unitIsCombinatorial(int u)
Definition units.c:468
float floatSum(float *a, const unsigned int n)
Definition floatutil.c:132
char * strncatInt(char *str1, const int n, size_t count)
Definition stringext.c:495
int strTokenNCpy(const char *s1, const char *s2, int i, char *s3, int count)
Definition stringext.c:53
size_t strlcpy(char *dst, const char *src, size_t dstsize)
Definition stringext.c:632
void tpcProgramName(const char *program, int version, int copyright, char *prname, int n)
Definition proginfo.c:406
int tpcYesNo(const char *s)
Definition proginfo.c:459
int floatGetWithUnit(const char *s, float *v, int *u)
Definition floatutil.c:174
char * errorMsg(tpcerror e)
Definition statusmsg.c:68
int strncpyClean(char *s1, const char *s2, int maxlen)
Definition stringext.c:321
int asciiCommentLine(const char *line, int *cont)
unsigned int doubleCopyFinite(double *t, double *s, const unsigned int n)
Definition doubleutil.c:136
int strIsSpaceOnly(char *s)
Definition stringext.c:671
int strChrCount(const char *s1, const char *s2)
Definition stringext.c:98
char * strTokenDup(const char *s1, const char *s2, int *next)
Definition stringext.c:413
int strDateValid2(const char *str, char *intdate)
Definition datetime.c:179
char * strdelstr(char *s1, const char *s2)
Definition stringext.c:688
int unitIsDistance(int u)
Definition units.c:339
int intlistAddFromString(const char *s1, const char *s2, INTLIST *l, const int ifnew)
Definition intutil.c:156
unsigned int doubleRange(double *a, const unsigned int n, double *amin, double *amax)
Definition doubleutil.c:174
int strClean(char *s)
Definition stringext.c:389
int floatMatch(const float v1, const float v2, const float lim)
Definition floatutil.c:27
int intlistAdd(INTLIST *l, const int v, const int ifnew)
Definition intutil.c:108
int floatCSpanPositives(float *a, const int n)
Definition floatutil.c:228
int strUppercaseCount(const char *s)
Definition stringext.c:118
int floatMatchRel(const float v1, const float v2, const float lim)
Definition floatutil.c:54
unsigned int doubleAbsMaxIndex(double *a, const unsigned int n)
Definition doubleutil.c:377
void swabip(void *buf, int size)
Definition endian.c:115
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
Definition statusmsg.c:142
int studynrStandardize(char *s)
Definition studynr.c:47
int filenameRmExtension(char *s)
Definition filename.c:71
struct tm * gmtime_r(const time_t *t, struct tm *tm)
Convert time_t to GMT struct tm.
Definition datetime.c:31
unsigned int doubleGTIndex(double *a, const unsigned int n, double lim)
Definition doubleutil.c:452
int endianLittle()
Definition endian.c:53
int unitDividerHasVolume(int u)
Definition units.c:678
int fnmatch(const char *fname, const char *key)
Definition filename.c:104
void swawip(void *buf, int size)
Definition endian.c:161
void swap16ip(void *buf, unsigned long long size)
Definition endian.c:234
int unitIsMole(int u)
Definition units.c:423
int strDateTimeValid(const char *str, char *intdate)
Definition datetime.c:308
char * strcasestr(const char *haystack, const char *needle)
Definition stringext.c:155
int endianness()
Definition endian.c:26
int strDateValid4(int dateint, char *intdate, int *year, int *month, int *day)
Definition datetime.c:250
int tpcHtmlUsage(const char *program, char *text[], const char *path)
Definition proginfo.c:169
double doubleSum(double *a, const unsigned int n)
Definition doubleutil.c:206
int studynrVerify(const char *s, int zero_ok)
Definition studynr.c:22
int atofCheck(const char *s, double *v)
Definition decpoint.c:94
unsigned int floatMaxIndex(float *a, const unsigned int n)
Definition floatutil.c:113
void doubleCopy(double *t, double *s, const unsigned int n)
Definition doubleutil.c:117
tactype
TAC content types.
@ TACTYPE_REF
Reference region TAC.
@ TACTYPE_PARENT
Parent tracer in plasma.
@ TACTYPE_UNKNOWN
Content type not known.
@ TACTYPE_METABOLITE
Metabolite in plasma.
@ TACTYPE_PLASMA
Plasma TAC.
@ TACTYPE_PIXEL
Image pixel TAC.
@ TACTYPE_VOI
Image volume-of-interest TAC.
@ TACTYPE_BLOOD
Blood TAC.
size_t strlcat(char *dst, const char *src, size_t dstsize)
Definition stringext.c:592
int atofList(const char *s1, const char *s2, double *x, int maxn)
Definition decpoint.c:150
int unitDividerMassVolumeConversion(int u)
Definition units.c:775
void swap(void *from, void *to, int size)
Definition endian.c:69
double doubleMean(double *a, const unsigned int n)
Definition doubleutil.c:224
unsigned int doubleMinIndex(double *a, const unsigned int n)
Definition doubleutil.c:396
void tpcPrintBuild(const char *program, FILE *fp)
Definition proginfo.c:339
char * strndup(const char *s, size_t n)
Definition stringext.c:205
int strDateTimeAdd(int s, char *dt)
Definition datetime.c:537
int unitMultiply(int ua, int ub)
Definition units.c:809
int unitIsVolume(int u)
Definition units.c:382
struct tm * localtime_r(const time_t *t, struct tm *tm)
Convert time_t to local time in struct tm.
Definition datetime.c:54
int fncasematch(const char *fname, const char *key)
Definition filename.c:139
size_t asciiFileSize(FILE *fp, int *nonprintable)
int unitIsTime(int u)
Definition units.c:359
double tmDifference(struct tm *tm1, struct tm *tm0)
Definition datetime.c:486
unsigned int factorial(unsigned int n)
Definition intutil.c:46
char * roinameEditByTemplate(const char *template, const char *currname, char *newname, const unsigned int count)
Definition roiname.c:65
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
Definition proginfo.c:114
int strHaveDecimalSeparator(const char *s)
Definition decpoint.c:132
int unitDividerHasMass(int u)
Definition units.c:694
int strIsValidNumber(const char *s)
Definition decpoint.c:33
int floatSpanPositives(float *a, const int n)
Definition floatutil.c:210
void swawbip(void *buf, int size)
Definition endian.c:138
void statusFree(TPCSTATUS *s)
Definition statusmsg.c:126