|
TPCCLIB
|
Header file for library libtpctac. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include "tpccsv.h"#include "tpcift.h"#include "tpcisotope.h"Go to the source code of this file.
Data Structures | |
| struct | TACC |
| struct | TAC |
| struct | MTAC |
Functions | |
| void | tacInit (TAC *tac) |
| void | taccInit (TACC *tacc) |
| void | tacFree (TAC *tac) |
| void | tacFreeExceptHeader (TAC *tac) |
| void | taccFree (TACC *tacc) |
| int | tacAllocate (TAC *tac, int sampleNr, int tacNr) |
| int | tacAllocateMore (TAC *tac, int tacNr) |
| int | tacCopyTacc (TACC *d1, TACC *d2, int sampleNr) |
| int | tacCopyTaccdata (TACC *d1, TACC *d2, int sampleNr) |
| int | tacCopyTacchdr (TACC *d1, TACC *d2) |
| int | tacCopyHdr (TAC *tac1, TAC *tac2) |
| Copy TAC header data from tac1 to tac2. | |
| int | tacIsSize (TAC *d) |
| int | tacDuplicate (TAC *tac1, TAC *tac2) |
| Make a duplicate of TAC structure. | |
| int | tacExtract (TAC *d1, TAC *d2, const int i) |
| Extract the specified TAC from existing TAC structure into a new TAC. | |
| int | tacAllocateMoreSamples (TAC *tac, int addNr) |
| Allocate memory for more samples in TAC data. | |
| void | mtacInit (MTAC *mtac) |
| void | mtacFree (MTAC *mtac) |
| int | mtacAllocate (MTAC *mtac, int nr) |
| int | mtacAllocateMore (MTAC *mtac, int nr) |
| int | mtacAddTAC (MTAC *mtac, TAC *tac) |
| char * | tacFormattxt (tacformat c) |
| int | tacFormatIdentify (const char *s) |
| char * | tacDefaultExtension (tacformat c) |
| int | tacFormatDetermine (const char *fname, TPCSTATUS *status) |
| int | tacFormatWriteSupported (tacformat format) |
| int | tacWrite (TAC *tac, FILE *fp, tacformat format, int extra, TPCSTATUS *status) |
| int | tacRead (TAC *d, const char *fname, TPCSTATUS *status) |
| int | tacGetHeaderStudynr (IFT *h, char *s, TPCSTATUS *status) |
| int | tacSetHeaderStudynr (IFT *h, const char *s) |
| int | tacGetHeaderUnit (TAC *tac, TPCSTATUS *status) |
| int | tacSetHeaderUnit (IFT *h, int u) |
| int | tacGetHeaderTimeunit (TAC *tac, TPCSTATUS *status) |
| int | tacSetHeaderTimeunit (IFT *h, int u) |
| int | tacGetHeaderIsotope (IFT *h, char *s, TPCSTATUS *status) |
| int | tacSetHeaderIsotope (IFT *h, const char *s) |
| int | tacGetHeaderScanstarttime (IFT *h, char *s, TPCSTATUS *status) |
| int | tacSetHeaderScanstarttime (IFT *h, const char *s) |
| int | tacGetHeaderInjectiontime (IFT *h, char *s, TPCSTATUS *status) |
| int | tacSetHeaderInjectiontime (IFT *h, const char *s) |
| decaycorrection | tacGetHeaderDecayCorrection (IFT *h) |
| int | tacSetHeaderDecayCorrection (IFT *h, decaycorrection dc) |
| int | tacWriteSimple (TAC *tac, FILE *fp, int extra, TPCSTATUS *status) |
| int | tacReadSimple (TAC *tac, CSV *csv, IFT *hdr, TPCSTATUS *status) |
| int | tacNameSplit (const char *rname, char *name1, char *name2, char *name3, unsigned int max_name_len) |
| int | tacWriteDFT (TAC *tac, FILE *fp, int extra, TPCSTATUS *status) |
| int | tacReadDFT (TAC *tac, CSV *csv, IFT *hdr, TPCSTATUS *status) |
| int | tacWriteSIF (TAC *tac, FILE *fp, int extra, TPCSTATUS *status) |
| int | tacReadSIF (TAC *tac, CSV *csv, IFT *hdr, TPCSTATUS *status) |
| int | tacWritePMOD (TAC *tac, FILE *fp, int extra, TPCSTATUS *status) |
| int | tacReadPMOD (TAC *tac, CSV *csv, IFT *hdr, TPCSTATUS *status) |
| int | tacReadQView (TAC *tac, CSV *csv, const int grouponly, TPCSTATUS *status) |
| int | tacRead4DM (TAC *tac, CSV *csv, TPCSTATUS *status) |
| int | tacReadMat (TAC *tac, CSV *csv, TPCSTATUS *status) |
| int | tacWriteCSV (TAC *tac, FILE *fp, int extra, tacformat format, TPCSTATUS *status) |
| int | tacReadCSV (TAC *tac, CSV *csv, IFT *hdr, TPCSTATUS *status) |
| int | tacReadInveonCSV (TAC *tac, CSV *csv, TPCSTATUS *status) |
| int | tacReadCarimasTxt (TAC *tac, CSV *csv, TPCSTATUS *status) |
| int | tacReadHRRTHC (TAC *tac, CSV *csv, TPCSTATUS *status) |
| int | tacReadHRPLUSHC (TAC *tac, CSV *csv, TPCSTATUS *status) |
| int | tacXNaNs (TAC *tac) |
| int | tacYNaNs (TAC *tac, const int i) |
| int | tacNaNs (TAC *tac) |
| int | tacNotNaNs (TAC *tac, const int i) |
| int | tacFixNaNs (TAC *tac) |
| int | tacNthSample (TAC *tac, const int sn, const int i) |
| int | tacSelectTACs (TAC *d, const char *region_name, int reset, TPCSTATUS *status) |
| int | tacSelectedTACs (TAC *d) |
| int | tacFirstSelected (TAC *d) |
| int | tacSelectBestReference (TAC *d) |
| int | tacVerifyTimeOrder (TAC *d, TPCSTATUS *status) |
| int | tacSortByTime (TAC *d, TPCSTATUS *status) |
| int | tacSortByConc (TAC *d, const int i, TPCSTATUS *status) |
| int | tacSortByName (TAC *d, TPCSTATUS *status) |
| int | tacSortByAUC (TAC *d, TPCSTATUS *status) |
| int | tacMoveTACC (TAC *d, int from, int to) |
| int | tacSwapTACCs (TAC *d, int i1, int i2) |
| int | tacDeleteTACC (TAC *d, int i) |
| int | tacMultipleSamples (TAC *d1, const int fixMode, TAC *d2, const int verbose) |
| Check TAC data for multiple samples with the same sample time. Optionally replace the multiple samples with their mean. | |
| int | tacCompareUnit (TAC *d1, TAC *d2, TPCSTATUS *status) |
| int | tacCompareNames (TAC *d1, TAC *d2, const int i, TPCSTATUS *status) |
| int | tacCompareConc (TAC *d1, TAC *d2, const int i, const double test_abs, const double test_rel, TPCSTATUS *status) |
| int | tacCompareTimes (TAC *d1, TAC *d2, const double test_abs, const double test_rel, TPCSTATUS *status) |
| int | tacCompareWeights (TAC *d1, TAC *d2, const double test_abs, const double test_rel, TPCSTATUS *status) |
| int | tacXUnitConvert (TAC *d, const int u, TPCSTATUS *status) |
| int | tacYUnitConvert (TAC *d, const int u, TPCSTATUS *status) |
| int | tacYUnitMass2Volume (TAC *tac, const double density, TPCSTATUS *status) |
| int | tacYUnitVolume2Mass (TAC *tac, const double density, TPCSTATUS *status) |
| int | tacIndividualNames (TAC *tac) |
| void | tacEnsureNames (TAC *tac) |
| int | tacXCopy (TAC *tac1, TAC *tac2, int i1, int i2) |
| int | tacCorrectFrameOverlap (TAC *d, TPCSTATUS *status) |
| Correct PET frame start and end times if frames are slightly overlapping or have small gaps in between. | |
| int | tacXRange (TAC *d, double *xmin, double *xmax) |
| Get the range of x values (times) in TAC structure. | |
| int | tacSampleXRange (TAC *d, double *xmin, double *xmax) |
| Get the range of x values (times) in TAC structure. | |
| int | tacMinX (TAC *d) |
| Get the minimum x value in TAC structure. | |
| int | tacIsX (TAC *d) |
| Verify if TAC structure contains reasonable x values (times). | |
| int | tacXMatch (TAC *d1, TAC *d2, const int verbose) |
| Check whether sample (frame) times are the same (or very close to) in two TAC structures. | |
| int | tacAddZeroSample (TAC *d, TPCSTATUS *status) |
| Add an initial sample to TAC(s) with zero time and concentration. | |
| int | tacDeleteSample (TAC *d, int i) |
| Delete a certain sample (time frame) from TAC structure. | |
| int | tacDeleteMissingSamples (TAC *d) |
| Delete those samples (time frames) from TAC structure, which contain only missing y values, and/or x is NaN. | |
| int | tacExtractRange (TAC *d1, TAC *d2, double startT, double endT) |
| Extract the specified time (x) range from TAC structure. | |
| int | tacExtractSamples (TAC *d1, TAC *d2, int si, int ei) |
| Extract the specified sample range from TAC structure. | |
| int | tacCheckX1X2X (TAC *d) |
| Check that sample (time frame) x, x1, and x2 values are reasonably set when compared to each other in TAC structure. | |
| int | tacSetX (TAC *d, TPCSTATUS *status) |
| Set TAC x values based on x1 and x2 values, or guess x1 and x2 values based on x values. | |
| int | tacGetSampleInterval (TAC *d, double ilimit, double *minfdur, double *maxfdur) |
| Get the shortest and longest sampling intervals or frame lengths in TAC structure. | |
| int | tacToBars (TAC *tac1, TAC *tac2) |
| Transform TAC data with frame start and end times into suitable form for plotting with frames as bars. | |
| int | tacFramesToSteps (TAC *inp, TAC *out, TPCSTATUS *status) |
| Transform TAC with frames into TAC with frames represented with stepwise changing dot-to-dot data. | |
| int | tacIsXContiguous (TAC *d) |
| Check that PET TAC frame times are contiguous, without even tiny overlap or gaps in between. | |
| int | tacSetXContiguous (TAC *d) |
| Set PET TAC frame times contiguous, without even tiny overlap or gaps in between. | |
| int | tacYRange (TAC *d, int i, double *ymin, double *ymax, int *smin, int *smax, int *imin, int *imax) |
| Get the range of y values (concentrations) in TAC struct. | |
| int | tacYRangeInXRange (TAC *d, int i, const double xmin, const double xmax, double *ymin, double *ymax, int *smin, int *smax, int *imin, int *imax) |
| Get the range of y values (concentrations) in TAC struct, including only samples with x (times) inside given range. | |
| int | tacIsWeighted (TAC *tac) |
| int | tacWCopy (TAC *tac1, TAC *tac2, int i1, int i2) |
| int | tacWMove (TAC *tac, int ow, TPCSTATUS *status) |
| int | tacWByFreq (TAC *tac, isotope isot, TPCSTATUS *status) |
| unsigned int | tacWSampleNr (TAC *tac) |
| int | tacWeightNorm (TAC *tac, TPCSTATUS *status) |
| int | tacWeightModerate (TAC *tac, const double minprop, const int doZeroes, const int doNaNs, TPCSTATUS *status) |
| int | sifWeight (TAC *sif, isotope isot, TPCSTATUS *status) |
| int | tacSetWeights (TAC *tac, weights weightMethod, int weightNr, TPCSTATUS *status) |
| int | tacGetIsotope (TAC *tac) |
| void | tacSetIsotope (TAC *tac, int isotope) |
| int | tacDecayCorrection (TAC *tac, int isotope, int mode, TPCSTATUS *status) |
| int | tacReadAllogg (TAC *tac, IFT *hdr, TPCSTATUS *status) |
| int | tacReadOldAllogg (TAC *tac, IFT *hdr, TPCSTATUS *status) |
| int | tacReadScanditronics (TAC *tac, IFT *hdr, TPCSTATUS *status) |
| int | tacReadGEMS (TAC *tac, IFT *hdr, TPCSTATUS *status) |
| int | tacWriteXML (TAC *tac, FILE *fp, TPCSTATUS *status) |
Header file for library libtpctac.
Time-activity curve (TAC) processing and file i/o.
Definition in file tpctac.h.
| enum tacformat |
TAC file format codes; see tac_format
| Enumerator | |
|---|---|
| TAC_FORMAT_UNKNOWN | Unknown format. |
| TAC_FORMAT_SIMPLE | x and y's with space delimiters |
| TAC_FORMAT_DFT | Data format of Turku PET Centre. |
| TAC_FORMAT_IFT | Interfile-type data (supported for writing) |
| TAC_FORMAT_NCI | Old Turku PET Centre format. |
| TAC_FORMAT_PMOD | PMOD TAC format. |
| TAC_FORMAT_CSV_INT | International CSV. |
| TAC_FORMAT_CSV_UK | UK CSV. |
| TAC_FORMAT_TSV_INT | International TSV (comma as decimal separator) |
| TAC_FORMAT_TSV_UK | UK TSV (point as decimal separator) |
| TAC_FORMAT_CPT | CPT format. |
| TAC_FORMAT_IDWC | Hammersmith tissue file format. |
| TAC_FORMAT_IF | Hammersmith input file format. |
| TAC_FORMAT_XML | XML format (supported for writing) |
| TAC_FORMAT_HTML | HTML table format (supported for writing) |
| TAC_FORMAT_SIF | Scan information file. |
| TAC_FORMAT_XELERIS | Xeleris format (reading supported) |
| TAC_FORMAT_INVEON | Inveon format (reading supported) |
| TAC_FORMAT_AMIDE | Amide format (reading supported) |
| TAC_FORMAT_CARIMAS_TXT | Carimas txt format (reading supported) |
| TAC_FORMAT_QVIEW | |
| TAC_FORMAT_MAT | Matlab matrix TAC format (reading supported) |
| TAC_FORMAT_4DM | 4DM TAC format (reading supported) |
| TAC_FORMAT_HRRT_HC | HRRT head curve format (reading supported) |
| TAC_FORMAT_HRPLUS_HC | HR+ head curve format (reading supported) |
| TAC_FORMAT_ABSS_SCANDITRONICS | Scanditronics ABSS data; reading supported. |
| TAC_FORMAT_ABSS_GEMS | GEMS ABSS data; reading supported. |
| TAC_FORMAT_ABSS_ALLOGG_OLD | ALLOGG ABSS data (old format); reading supported. |
| TAC_FORMAT_ABSS_ALLOGG | ALLOGG ABSS data; reading supported. |
| TAC_FORMAT_BINARY | Binary format (currently not supported) |
Definition at line 27 of file tpctac.h.
Copy given TAC structure into MTAC list.
| mtac | Pointer to initiated MTAC structure; any old contents are preserved. |
| tac | Pointer to TAC structure to add. |
|
extern |
Allocate memory for TACs in MTAC data structure.
| mtac | Pointer to initiated MTAC structure; any old contents are deleted. Number of TACs is kept at zero, but TACs in the list are initiated. |
| nr | Nr of TACs to allocate |
Definition at line 56 of file mtac.c.
Referenced by mtacAllocateMore().
|
extern |
Allocate memory for more TACs in MTAC structure. Previous contents are not changed.
| mtac | Pointer to initiated and previously allocated MTAC structure; any old contents are preserved, including nr of TACs. |
| nr | Nr of additional TAC structures to allocate; if structure contains unused space for requested TACs already, then nothing is done. |
Definition at line 83 of file mtac.c.
Referenced by mtacAddTAC().
|
extern |
Free memory allocated for MTAC data. All contents are destroyed.
| mtac | Pointer to MTAC. |
Definition at line 38 of file mtac.c.
Referenced by mtacAllocate().
|
extern |
Calculate weights for frames in SIF data based on true counts.
Weights are calculated from formula weight=(frame duration)^2 / (trues in a frame) which is applicable to non-decay corrected data. If weights are to be applied to decay-corrected data, provide function with isotope to use formula weight=(frame duration)^2 / (decay corrected trues in a frame) instead.
Reference: Mazoyer BM, Huesman RH, Budinger TF, Knittel BL. Dynamic PET data analysis. J Comput Assist Tomogr 1986; 10:645-653.
Formula is not applicable to initial frames where trues can be zero or even less, but weights for frames with no trues should still be high for fitting purposes; therefore, in those cases, weight is set to the maximum weight that was calculated from the data.
Weights are normalized to have an average of 1.0 for frames that have weight above zero.
| sif | Pointer to SIF data, stored in TAC structure. Weights are added to the structure. Data must have at least two columns (TACs), which are assumed to represent prompts and randoms, to calculate trues as prompts - randoms. Counts in SIF are assumed to be not corrected for physical decay. Frame times are assumed to be in seconds. |
| isot | Isotope code, in case the weights are calculated for decay corrected data. Enter ISOTOPE_UNKNOWN if calculating weights for non-corrected data. SIF should contain isotope, too, but that is not used in this function. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 363 of file tacw.c.
Referenced by tacSetWeights().
Add an initial sample to TAC(s) with zero time and concentration.
If the sample time of the first sample is zero (or smaller) already, then nothing is done. Sort by sample time before calling this.
| d | Pointer to the TAC structure. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 366 of file tacx.c.
Referenced by tacInput2sim().
|
extern |
Allocate memory for TAC data (and set data pointers inside the structure). Any previous contents are deleted. Contents are set to NaN.
| tac | Pointer to initiated TAC structure data; any old contents are deleted. tacNr and sampleNr inside the structure are set to or kept at zero. |
| sampleNr | Nr of samples to allocate. |
| tacNr | Nr of concentration arrays (regional TACs) to allocate. |
Definition at line 130 of file tac.c.
Referenced by bfm1TCM(), bfmSRTM(), imgToSIF(), mfCreateTAC(), tacAllocateMoreSamples(), tacAllocateWithPAR(), tacDelayFit(), tacDuplicate(), tacExtract(), tacExtractRange(), tacExtractSamples(), tacInterpolate(), tacInterpolateToEqualLengthFrames(), tacMultipleSamples(), tacRead4DM(), tacReadAllogg(), tacReadCarimasTxt(), tacReadCSV(), tacReadDFT(), tacReadGEMS(), tacReadHRPLUSHC(), tacReadHRRTHC(), tacReadInveonCSV(), tacReadMat(), tacReadOldAllogg(), tacReadPMOD(), tacReadQView(), tacReadScanditronics(), tacReadSIF(), tacReadSimple(), and tacSetWeights().
|
extern |
Allocate memory for more TACs in TAC data (and set data pointers inside the structure).
Previous contents are not changed. New contents are set to NaN.
| tac | Pointer to initiated and previously allocated TAC structure data; any old contents are preserved, including tacNr. |
| tacNr | Nr of additional concentration arrays (regional TACs) to allocate; if structure contains unused space for requested TACs already, then nothing is done. |
Definition at line 178 of file tac.c.
Referenced by imgToSIF(), tacInterpolateInto(), tacReadReference(), and tacSetX().
|
extern |
Allocate memory for more samples in TAC data.
Previous contents are not changed. _sampleNr is increased by nr_to_add, but sampleNr is not changed, and the contents of the new last frame(s) are empty (NaN).
| tac | Pointer to initiated and previously allocated TAC structure data; any old contents are preserved, including tacNr and sampleNr. |
| addNr | Nr of samples to add; if TAC structure contains unused space for requested samples already, then nothing is done. |
Definition at line 435 of file tac.c.
Referenced by imgToSIF(), tacAddZeroSample(), tacFramesToSteps(), tacInput2sim(), tacSetXContiguous(), and tacToBars().
|
extern |
Free memory allocated for TACC data. All contents are destroyed.
| tacc | Pointer to TACC |
Definition at line 68 of file tac.c.
Referenced by tacFree(), and tacFreeExceptHeader().
|
extern |
Check that sample (time frame) x, x1, and x2 values are reasonably set when compared to each other in TAC structure.
| d | Pointer to the TAC structure. TAC samples must be sorted. TAC isframe setting has no effect here. |
Definition at line 621 of file tacx.c.
Referenced by tacSetX().
|
extern |
Initiate the TACC structure before any use.
| tacc | Pointer to TACC |
Definition at line 48 of file tac.c.
Referenced by tacAllocate(), tacAllocateMore(), and taccFree().
|
extern |
Check whether TAC concentrations (y values) are the same in two TAC data. Note that units are ignored here.
If either absolute or relative difference is below the limit, the test is reported as passed.
| d1 | Pointer to TAC structure. |
| d2 | Pointer to TAC structure. |
| i | TAC index [0..tacNr-1] to compare; enter <0 to verify all TACs. |
| test_abs | Limit for accepted absolute difference; obligatory. |
| test_rel | Optional limit for accepted relative difference |2*(x1-x2)/(x1+x2)| ; set to negative value to not test this; in case of zero mean, this test is assumed to fail, but test for absolute difference may still pass. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 122 of file taccomp.c.
Check whether TAC names are the same in two TAC data.
Comparison is very strict and even case-sensitive, thus TAC names may need to be preprocessed if this is used for other purpose than SW testing.
| d1 | Pointer to TAC structure. |
| d2 | Pointer to TAC structure. |
| i | TAC index [0..tacNr-1] to compare; enter <0 to verify all TACs. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 67 of file taccomp.c.
|
extern |
Check whether TAC sample times (x values) are the same in two TAC data. Note that units are ignored here.
If either absolute or relative difference is below the limit, the test is reported as passed.
| d1 | Pointer to TAC structure. |
| d2 | Pointer to TAC structure. |
| test_abs | Limit for accepted absolute difference. |
| test_rel | Optional limit for accepted relative difference |2*(x1-x2)/(x1+x2)| ; set to negative value to not test this; in case of zero mean, this test is assumed to fail, but test for absolute difference may still pass. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 201 of file taccomp.c.
Check whether time and concentration units are the same in two TAC data.
| d1 | Pointer to TAC structure. |
| d2 | Pointer to TAC structure. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 27 of file taccomp.c.
|
extern |
Check whether TAC weights are the same in two TAC data.
If either absolute or relative difference is below the limit, the test is reported as passed.
| d1 | Pointer to TAC structure. |
| d2 | Pointer to TAC structure. |
| test_abs | Limit for accepted absolute difference. |
| test_rel | Optional limit for accepted relative difference |2*(w1-w2)/(w1+w2)| ; set to negative value to not test this; in case of zero mean, this test is assumed to fail, but test for absolute difference may still pass. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 289 of file taccomp.c.
Copy TAC header data from tac1 to tac2.
Information regarding data size or weighting is not copied. IFT contents are copied if available. Previous IFT contents are deleted.
Definition at line 310 of file tac.c.
Referenced by tacAllocateMoreSamples(), tacDuplicate(), tacExtract(), tacExtractRange(), tacExtractSamples(), tacInterpolate(), tacInterpolateToEqualLengthFrames(), and tacMultipleSamples().
Copy TACC contents (y data and its header) from tacc1 to tacc2.
These may be inside different TAC structures, therefore sampleNr is needed.
| d1 | Pointer to source TACC structure. |
| d2 | Pointer to target TACC structure. |
| sampleNr | Sample (frame) number. |
Definition at line 233 of file tac.c.
Referenced by tacAllocateMoreSamples(), tacDuplicate(), tacExtract(), and tacReadReference().
Copy TACC y data from tacc1 to tacc2.
These may be inside different TAC structures, therefore sampleNr is needed.
| d1 | Pointer to source TACC structure. |
| d2 | Pointer to target TACC structure. |
| sampleNr | Sample (frame) nr. |
Definition at line 260 of file tac.c.
Referenced by tacCopyTacc().
Copy TACC header data from tacc1 to tacc2.
| d1 | Pointer to source TACVOI structure. |
| d2 | Pointer to target TACVOI structure. |
Definition at line 282 of file tac.c.
Referenced by tacCopyTacc(), tacExtractRange(), tacExtractSamples(), tacInterpolate(), tacInterpolateInto(), tacInterpolateToEqualLengthFrames(), and tacMultipleSamples().
Correct PET frame start and end times if frames are slightly overlapping or have small gaps in between.
Large gap is not corrected and it does not lead to an error. If TAC file does not contain frame start and end times, but just mid time point, then this function does nothing but check that samples are in correct order. Data must be sorted for increasing sample time before calling this function, otherwise an error is returned.
| d | Pointer to TAC data which is sorted by increasing sample time. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 65 of file tacx.c.
Referenced by tacReadModelingData().
Correct TAC data for physical decay, or remove the decay correction. Sample weights, if available, are modified, too.
| tac | Pointer to TAC structure; status of decay correction in TAC is not verified, but set in this function. TAC must contain valid sample time unit. |
| isotope | Isotope code. |
| mode | 0=Remove decay correction; 1=Correct for decay. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 59 of file tacdc.c.
Referenced by tacSetWeights().
|
extern |
Return pointer to default TAC filename extension, including the dot, based on the TAC format code.
| c | TAC format code. |
Definition at line 144 of file tacio.c.
|
extern |
Delete those samples (time frames) from TAC structure, which contain only missing y values, and/or x is NaN.
| d | Pointer to the TAC structure. |
Definition at line 450 of file tacx.c.
Referenced by tacMultipleSamples().
|
extern |
Delete a certain sample (time frame) from TAC structure.
| d | Pointer to the TAC structure. |
| i | Index of the sample to delete, [0..sampleNr-1]. |
Definition at line 426 of file tacx.c.
Referenced by tacDeleteMissingSamples(), and tacMultipleSamples().
|
extern |
Delete specified TACC inside TAC structure, moving the positions of other TACCs accordingly.
| d | Pointer to TAC data. Main header is not changed, but tacNr is decreased. |
| i | TACC index [0..tacNr-1]. |
Definition at line 310 of file tacorder.c.
Referenced by tacReadReference(), and tacWMove().
Make a duplicate of TAC structure.
In the duplicate, space is allocated only for the tacNr and sampleNr specified in the original TAC.
| tac1 | Pointer to the source TAC. |
| tac2 | Pointer to the target TAC; must be initiated; any old contents are deleted. |
Definition at line 356 of file tac.c.
Referenced by mtacAddTAC(), tacAllocateMoreSamples(), tacDelayFit(), tacExtractRange(), tacExtractSamples(), tacFramesToSteps(), tacInput2sim(), tacIntegrate(), tacIntegrateFE(), tacMultipleSamples(), tacReadReference(), tacSetX(), tacSetXContiguous(), and tacToBars().
|
extern |
Ensure that TAC structure contains a name for each TAC. If not available, then TAC index+1 is written as name.
| tac | Pointer to TAC structure. |
Definition at line 50 of file tacname.c.
Referenced by tacWriteCSV(), tacWriteDFT(), tacWritePMOD(), tacWriteSheetIntoXML(), and tacWriteXML().
Extract the specified TAC from existing TAC structure into a new TAC.
| d1 | Pointer to the source TAC structure. Not modified. |
| d2 | Pointer to the target TAC structure; any previous contents are deleted. |
| i | Index of the TAC to extract [0..tacNr-1]. |
Extract the specified time (x) range from TAC structure.
| d1 | Pointer to the source TAC structure. Data must be sorted by ascending x. |
| d2 | Pointer to the target TAC structure; any previous contents are deleted. The source TAC pointer can be given for in-place extraction. |
| startT | Start time of data that is preserved (in same units as in TAC) |
| endT | End time of data that is preserved (in same units as in TAC) |
Definition at line 486 of file tacx.c.
Extract the specified sample range from TAC structure.
| d1 | Pointer to the source TAC structure. Data must be sorted by ascending x. |
| d2 | Pointer to the target TAC structure; any previous contents are deleted. |
| si | Index of first sample to extract. |
| ei | Index of last sample to extract. |
Definition at line 568 of file tacx.c.
|
extern |
Get the index of first selected TAC (sw!=0) in TAC structure.
| d | Pointer to TAC data. |
Definition at line 122 of file tacselect.c.
|
extern |
Fix missing y values in TAC structure by interpolation. X values cannot be fixed. Extrapolation of the last missing values is not possible, but beginning can be estimated assuming first point (0,0).
| tac | Pointer to TAC structure. |
Definition at line 121 of file tacnan.c.
|
extern |
Determine the format of TAC file.
| fname | Pointer to the file name; this string is not modified. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 161 of file tacio.c.
|
extern |
Identify the string representation of the TAC file format.
| s | TAC format as a string. |
Definition at line 113 of file tacio.c.
|
extern |
Return pointer to TAC file format description with the format code.
| c | TAC format code. |
Definition at line 98 of file tacio.c.
Referenced by tacFormatDetermine(), tacRead(), and tacWrite().
|
extern |
Check whether writing of specified TAC format is supported.
| format | File format code, for example TAC->format. |
Definition at line 291 of file tacio.c.
Transform TAC with frames into TAC with frames represented with stepwise changing dot-to-dot data.
| inp | Pointer to source TAC structure. |
| out | Pointer to the initiated target TAC structure; any previous contents are deleted. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 942 of file tacx.c.
Referenced by tacAUC(), and tacDelay().
|
extern |
Free memory allocated for TAC data. All contents are destroyed, including any header data.
| tac | Pointer to TAC |
Definition at line 106 of file tac.c.
Referenced by bfm1TCM(), bfmSRTM(), freeDelayFitData(), imgReadNifti(), imgWriteNifti(), mfCreateTAC(), mtacFree(), tacAllocate(), tacAllocateMoreSamples(), tacAUC(), tacDelay(), tacDuplicate(), tacExtract(), tacExtractRange(), tacExtractSamples(), tacFramesToSteps(), tacInput2sim(), tacIntegrate(), tacIntegrateFE(), tacInterpolate(), tacInterpolateToEqualLengthFrames(), tacMultipleSamples(), tacRead(), tacRead4DM(), tacReadAllogg(), tacReadCarimasTxt(), tacReadCSV(), tacReadDFT(), tacReadGEMS(), tacReadHRPLUSHC(), tacReadHRRTHC(), tacReadInveonCSV(), tacReadMat(), tacReadModelingData(), tacReadModelingInput(), tacReadOldAllogg(), tacReadPMOD(), tacReadQView(), tacReadReference(), tacReadScanditronics(), tacReadSIF(), tacReadSimple(), tacSetWeights(), tacSetX(), tacSetXContiguous(), and tacToBars().
|
extern |
Free memory allocated for TAC data. All contents are destroyed, except the header data in IFT structure.
| tac | Pointer to TAC |
|
extern |
Get the status of decay correction from TAC struct header.
| h | Pointer to TAC header structure. |
Definition at line 548 of file tacift.c.
Get injection time from TAC structure header.
| h | Pointer to TAC header structure. |
| s | Pointer to preallocated string of length 19+1 (at least); enter NULL if you only want to test if header contains injection time. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 462 of file tacift.c.
Get isotope from TAC struct header.
| h | Pointer to TAC header structure. |
| s | Pointer to preallocated string of length MAX_ISOTOPE_LEN+1 (at least); enter NULL if you only want to test if header contains isotope code. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 290 of file tacift.c.
Referenced by abssWrite(), tacGetIsotope(), tacReadSIF(), and tacWriteSIF().
Get scan start time from TAC structure header.
| h | Pointer to TAC header structure. |
| s | Pointer to preallocated string of length 19+1 (at least); enter NULL if you only want to test if header contains scan start time. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 372 of file tacift.c.
Referenced by abssWrite(), imgFromSIF(), tacReadSIF(), and tacWriteSIF().
Get study number from TAC struct header.
| h | Pointer to TAC header struct |
| s | Pointer to preallocated string of length MAX_STUDYNR_LEN+1 (at least); enter NULL if you only want to test whether header contains studynr |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 26 of file tacift.c.
Referenced by abssWrite(), imgFromSIF(), tacRead(), tacReadSIF(), tacWriteCSV(), tacWriteDFT(), and tacWriteSIF().
Get time (x) unit from TAC struct header and write to main TAC struct.
| tac | Pointer to TAC struct |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 234 of file tacift.c.
Referenced by tacReadCSV(), tacReadDFT(), tacReadPMOD(), and tacReadSimple().
Get concentration (y) unit from TAC struct header and write to main TAC struct.
| tac | Pointer to TAC struct |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 145 of file tacift.c.
Referenced by tacReadCSV(), tacReadDFT(), tacReadPMOD(), and tacReadSimple().
|
extern |
Read isotope code from TAC header.
| tac | Pointer to source TAC structure. |
Definition at line 25 of file tacdc.c.
Referenced by imgFromSIF(), tacReadModelingData(), tacReadReference(), and tacSetWeights().
|
extern |
Get the shortest and longest sampling intervals or frame lengths in TAC structure.
Data is not modified. Data must be sorted by increasing x.
| d | Pointer to TAC structure. |
| ilimit | Interval limit: smaller sampling intervals of frame lengths are not accepted; use this to prevent 0 interval in case of step functions or zero length frames; enter NaN if not applied. |
| minfdur | Pointer to variable for minimum interval (NULL if not needed). |
| maxfdur | Pointer to variable for maximum interval (NULL if not needed). |
Definition at line 832 of file tacx.c.
Referenced by tacInterpolateToEqualLengthFrames().
|
extern |
Verifies that TAC structure contains a name for each TAC, and no other TAC has the same name.
| tac | Pointer to TAC structure. |
Definition at line 24 of file tacname.c.
|
extern |
Initiate the TAC structure before any use.
| tac | Pointer to TAC |
Definition at line 24 of file tac.c.
Referenced by bfm1TCM(), imgReadNifti(), imgWriteNifti(), initDelayFitData(), mtacAllocate(), mtacAllocateMore(), tacAllocateMoreSamples(), tacAUC(), tacDelay(), tacExtractRange(), tacFree(), tacFreeExceptHeader(), tacInput2sim(), tacMultipleSamples(), tacReadModelingData(), tacReadModelingInput(), tacReadReference(), tacSetWeights(), tacSetX(), and tacSetXContiguous().
|
extern |
Check if any of TAC sets has VOI size (volume).
| d | Pointer to TAC structure. |
Definition at line 335 of file tac.c.
Referenced by tacWriteCSV().
|
extern |
Check if TAC contains weights as indicated by the 'weighting' field.
| tac | Pointer to TAC structure. |
Definition at line 24 of file tacw.c.
Referenced by parAllocateWithTAC(), tacDecayCorrection(), tacSampleXRange(), tacSetWeights(), tacWeightModerate(), tacWeightNorm(), tacWMove(), tacWriteCSV(), tacWriteDFT(), tacWritePMOD(), tacWriteSheetIntoXML(), and tacWriteXML().
|
extern |
Verify if TAC structure contains reasonable x values (times).
Data is not modified. Data does not need to be sorted. Data can contain NaNs, as long as some x values are available. Note that x values are considered not to exist even when there is only one sample with x=0.
| d | Pointer to TAC structure; not modified. |
Definition at line 226 of file tacx.c.
Referenced by tacInterpolateToEqualLengthFrames(), tacMultipleSamples(), tacReadReference(), tacSetWeights(), and tacSetX().
|
extern |
Check that PET TAC frame times are contiguous, without even tiny overlap or gaps in between.
| d | Pointer to TAC data which is sorted by increasing sample time. |
Definition at line 1130 of file tacx.c.
Referenced by tacFramesToSteps(), and tacSetXContiguous().
|
extern |
Get the minimum x value in TAC structure.
Data does not need to be sorted, and it can contain missing x and y values (NaNs).
| d | Pointer to the TAC structure; not modified. |
Definition at line 201 of file tacx.c.
Referenced by tacMultipleSamples().
|
extern |
Move TACC from one position to another inside TAC structure, moving the positions of other TACCs accordingly.
| d | Pointer to TAC data. Main header and tacNr are not changed. |
| from | TACC index [0.._tacNr-1] |
| to | TACC index [0.._tacNr-1] |
Definition at line 250 of file tacorder.c.
Referenced by tacDeleteTACC().
Check TAC data for multiple samples with the same sample time. Optionally replace the multiple samples with their mean.
Data does no need to be sorted before calling this. Output is not necessarily sorted either.
| d1 | Pointer to the input TAC structure; optionally modified. |
| fixMode | Just inspect for multiple samples (0), or replace those with mean (1). |
| d2 | Pointer to the output TAC structure; enter NULL if just inspecting. To replace the contents of input TAC, enter the same pointer here. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 336 of file tacorder.c.
|
extern |
Split TAC name into 1-3 subparts of given max length.
| rname | TAC name to split |
| name1 | Pointer to 1st subname (usually anatomical region); NULL if not needed |
| name2 | Pointer to 2nd subname (usually hemisphere); NULL if not needed |
| name3 | Pointer to 3rd subname (usually image plane); NULL if not needed |
| max_name_len | Max length of subnames, excluding terminal null |
Definition at line 26 of file dftio.c.
Referenced by tacWriteDFT().
|
extern |
Check TAC structure for missing sample times and values.
| tac | Pointer to TAC structure. |
Definition at line 71 of file tacnan.c.
Referenced by tacFramesToSteps(), tacInterpolate(), tacInterpolateInto(), tacReadModelingData(), and tacReadModelingInput().
|
extern |
Check TAC structure for missing sample times and values.
Definition at line 84 of file tacnan.c.
|
extern |
Search the Nth sample (1..n) in TAC structure which does not contain missing x or y values. Use tacNotNaNs to get the number of existing samples in TAC.
| tac | Pointer to TAC structure. |
| sn | Number (1..n) of sample to search for; 1 to search for the first one, tacNotNaNs(&tac, -1) to search for the last one. |
| i | Index of TAC to test; <0 to test all TACs |
Definition at line 173 of file tacnan.c.
Read TAC file contents into TAC data structure.
This function reads simple data format (time + data columns), DFT format, PMOD format, Hammersmith formats (IDWC and IF), and some CSV formats.
| d | Pointer to initiated TAC struct where TAC data will be written; any old content is deleted. |
| fname | Pointer to the filename; this string is not modified. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 413 of file tacio.c.
Referenced by imgReadNifti(), imgWriteNifti(), tacReadModelingData(), tacReadModelingInput(), and tacReadReference().
Read 4DM CSV format from CSV structure into TAC structure.
| tac | Pointer to TAC structure, contents of which are to be written. |
| csv | Pointer to CSV from which data is read. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 26 of file 4dmio.c.
Read Allogg #2 ABSS data from IFT struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| hdr | Pointer to IFT to read data from. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 26 of file tacabss.c.
Referenced by tacRead().
Read Carimas TXT TAC format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read; if it contains only one column, then it is assumed to represent the first y column and x column is not filled. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 631 of file taccsv.c.
Referenced by tacRead().
Read CSV TAC format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read; if it contains only one column, then it is assumed to represent the first y column and x column is not filled. |
| hdr | Pointer to possible header data, which, if available, if processed and copied to TAC too; enter NULL if not available. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 212 of file taccsv.c.
Referenced by tacRead().
Read DFT format from CSV structure into TAC structure.
| tac | Pointer to TAC structure, into which are to be written; any previous contents are deleted. |
| csv | Pointer to CSV from which data is read; it must contain at least one or two x columns and one y column. |
| hdr | Pointer to possible header data, which, if available, is copied to TAC as a processed version; enter NULL if not available |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 300 of file dftio.c.
Referenced by tacRead().
Read GEMS ABSS data from IFT struct into TAC struct.
Two date-time strings will be written in header, scan_start_time containing the time of the first sample, and sampler_start_time containing the time given in ABSS file header.
GEMS ABSS format is almost identical to Scanditronics, but the headers and times are processed differently, hence separate functions. If function finds that provided data is actually from Scanditronics, it calls tacReadScanditronics.
| tac | Pointer to TAC struct, contents of which are to be written. |
| hdr | Pointer to IFT to read data from. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 516 of file tacabss.c.
Referenced by tacRead(), and tacReadScanditronics().
Read HR+ head curve (.r) format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read; if it contains only one column, then it is assumed to represent the first y column and x column is not filled. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 114 of file hcio.c.
Referenced by tacRead().
Read HRRT head curve (.hc) format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read; if it contains only one column, then it is assumed to represent the first y column and x column is not filled. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 25 of file hcio.c.
Referenced by tacRead().
Read Inveon TAC format from CSV struct into TAC struct.
Note that there are several Inveon TAC formats, and not all are supported.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to Inveon CSV from which data is read. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 405 of file taccsv.c.
Referenced by tacRead().
Read Mat format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 25 of file matio.c.
Referenced by tacRead().
Read Allogg #1 ABSS data from IFT struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| hdr | Pointer to IFT to read data from. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 173 of file tacabss.c.
Referenced by tacRead().
Read PMOD format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read; if it contains only one column, then it is assumed to represent the first y column and x column is not filled. |
| hdr | Pointer to possible header data, which, if available, is processed and copied to TAC too; enter NULL if not available. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 146 of file pmodio.c.
Referenced by tacRead().
Read QView format from CSV struct into TAC struct.
Note that QView TAC format does not contain frame times.
| tac | Pointer to TAC structure, contents of which are to be written. |
| csv | Pointer to CSV from which data is read. |
| grouponly | Read TACs of all ROIs (0), or only group means (1). |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 27 of file qviewio.c.
Referenced by tacRead().
Read Scanditronics ABSS data from IFT struct into TAC struct.
Two date-time strings will be written in header, scan_start_time containing the time of the first sample, and sampler_start_time containing the time given in ABSS file header.
Scanditronics ABSS format is almost identical to GEMS, but the headers and times are processed differently, hence separate functions. If function finds that provided data is actually from GEMS, it calls tacReadGEMS.
| tac | Pointer to TAC struct, contents of which are to be written. |
| hdr | Pointer to IFT to read data from. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 326 of file tacabss.c.
Referenced by tacRead(), and tacReadGEMS().
Read SIF from CSV structure into TAC structure.
| tac | Pointer to TAC structure, contents of which are to be filled here. tacNr will always be set to 2, even if count data is not available. Trues will be saved or computed into a non-standard 3rd column, which is not included in tacNr, even if column is found in CSV. |
| csv | Pointer to CSV from which SIF data is read. |
| hdr | Pointer to possible header data, which, if available, if processed and copied to TAC too; enter NULL if not available. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 129 of file sifio.c.
Referenced by tacRead().
Read simple format from CSV struct into TAC struct.
| tac | Pointer to TAC struct, contents of which are to be written. |
| csv | Pointer to CSV from which data is read; if it contains only one column, then it is assumed to represent the first y column and x column is not filled. |
| hdr | Pointer to possible header data, which, if available, is processed and copied to TAC too; enter NULL if not available. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 97 of file simpleio.c.
Referenced by tacRead().
|
extern |
Get the range of x values (times) in TAC structure.
Data is not modified. Data does not need to be sorted. Data can contain NaNs, and x values are omitted if no finite y values exist for that x. If data contains sample weights, samples with zero weight are not included.
| d | Pointer to TAC structure; not modified. |
| xmin | Pointer to variable for min x value (NULL if not needed). |
| xmax | Pointer to variable for max x value (NULL if not needed). |
Definition at line 162 of file tacx.c.
Referenced by mtgaPlotSVG(), tacPlotFitSVG(), tacPlotHistogramSVG(), and tacPlotLineSVG().
|
extern |
Select the best guess of reference region in case that several TACs were matching with tacSelectTACs().
| d | Pointer to TAC structure, after using tacSelectTACs(). |
Definition at line 139 of file tacselect.c.
Referenced by tacReadReference().
|
extern |
Get the number of selected TACs (sw!=0) in TAC structure.
| d | Pointer to TAC data. |
Definition at line 103 of file tacselect.c.
Referenced by tacSelectBestReference().
Select the TAC(s) that have matching ID name or number.
| d | Pointer to TAC structure. |
| region_name | Name or TAC number (as string, starting from 1) which is searched; string can be inside quotation marks. Enter NULL to select all TACs, or empty string to select TACs with empty name (which really should not exist). |
| reset | 1=Non-matching VOIs are deselected, 0=Old selections are preserved. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 24 of file tacselect.c.
Referenced by tacReadReference().
| int tacSetHeaderDecayCorrection | ( | IFT * | h, |
| decaycorrection | dc ) |
Set the status of decay correction in TAC structure header. Any previous status is deleted.
| h | Pointer to TAC header structure. |
| dc | Status of decay correction: DECAY_UNKNOWN, DECAY_NOTCORRECTED, or DECAY_CORRECTED. |
Definition at line 578 of file tacift.c.
Referenced by tacDecayCorrection().
|
extern |
Set injection time in TAC structure header. Any previous injection time items are deleted.
| h | Pointer to TAC header structure. |
| s | Pointer to string containing the injection time in international format YYYY-MM-DD hh:mm:ss ; enter NULL or "" if you only want to delete it in header. |
Definition at line 515 of file tacift.c.
|
extern |
Set isotope in TAC structure header. Any previous isotope items are deleted.
| h | Pointer to TAC header structure. |
| s | Pointer to string containing the isotope; enter NULL or "" if you only want to delete isotope in header. |
Definition at line 341 of file tacift.c.
Referenced by tacReadSIF(), and tacSetIsotope().
|
extern |
Set scan start time in TAC structure header. Any previous scan start items are deleted.
| h | Pointer to TAC header structure. |
| s | Pointer to string containing the scan start time in international format YYYY-MM-DD hh:mm:ss ; enter NULL or "" if you only want to delete it in header. |
Definition at line 427 of file tacift.c.
Referenced by imgToSIF(), tacReadAllogg(), tacReadGEMS(), tacReadOldAllogg(), tacReadScanditronics(), and tacReadSIF().
|
extern |
Set study number in TAC struct header. Any previous studynr items are deleted.
| h | Pointer to TAC header struct |
| s | Pointer to string containing the study number; enter NULL or "" if you only want to delete studynr in header |
Definition at line 79 of file tacift.c.
Referenced by imgToSIF(), tacRead(), tacReadAllogg(), tacReadCSV(), tacReadDFT(), tacReadGEMS(), tacReadMat(), tacReadScanditronics(), tacReadSIF(), and tacWriteDFT().
|
extern |
Set time (x) unit in TAC struct header. Any previous x units are deleted.
| h | Pointer to TAC header struct |
| u | Unit enum |
Definition at line 201 of file tacift.c.
Referenced by tacGetHeaderTimeunit(), tacReadCSV(), tacReadDFT(), and tacReadPMOD().
|
extern |
Set concentration (y) unit in TAC struct header. Any previous y unit items are deleted.
| h | Pointer to TAC header struct |
| u | Unit enum |
Definition at line 112 of file tacift.c.
Referenced by tacGetHeaderUnit(), tacReadCSV(), tacReadDFT(), tacReadPMOD(), and tacWriteDFT().
|
extern |
Write isotope code into TAC header, overwriting any previous field.
| tac | Pointer to target TAC structure. |
| isotope | Isotope code. |
Definition at line 41 of file tacdc.c.
Referenced by imgToSIF(), tacRead4DM(), tacReadModelingData(), tacReadReference(), and tacSetWeights().
Set TAC sample weights, based on given weighting scheme.
Weights are normalized to have average weight 1.0, with the sum of weights equals the weightNr or number of frames, whichever is smaller.
| tac | Pointer to TAC structure. Data must be sorted by increasing sample times. |
| weightMethod | Weighting scheme: WEIGHTING_ON_COUNTS, WEIGHTING_ON_F, WEIGHTING_ON_FD, WEIGHTING_OFF. With WEIGHTING_UNKNOWN weightNr (below) is applied to weights and remaining weights are re-normalized. |
| weightNr | Number of samples (frames) to weight; if TAC contains more samples than this, then those are set to have zero weight. Enter a large number to give weight to all available samples. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 462 of file tacw.c.
Set TAC x values based on x1 and x2 values, or guess x1 and x2 values based on x values.
This is not an idiot proof method, but works reasonably well in common cases.
| d | Pointer to the TAC structure. TAC samples must be sorted for increasing x, if x1 and x2 are to be estimated from x values. TAC tunit should be specified as a time unit that can be internally converted to seconds to get most reliable results. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 653 of file tacx.c.
Referenced by tacInput2sim().
|
extern |
Set PET TAC frame times contiguous, without even tiny overlap or gaps in between.
Tiny overlaps and gaps are fixed by modifying frame times. Large gaps are filled with new frames based on linear interpolation between adjacent frames. Error is returned in case of larger frame overlaps.
| d | Pointer to TAC data which is sorted by increasing sample time. |
Definition at line 1166 of file tacx.c.
Sort TACs in decreasing order by their area-under-curve (AUC).
| d | Pointer to TAC structure. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 205 of file tacorder.c.
Sort samples (frames) in TAC structure by decreasing sample value.
| d | Pointer to TAC structure. |
| i | Index of y column which the sorting is based on. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 122 of file tacorder.c.
Sort TACs in alphabetical order by their TAC name.
| d | Pointer to TAC structure. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 178 of file tacorder.c.
Sort samples (frames) in TAC structure by increasing sample time.
| d | Pointer to TAC structure. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 74 of file tacorder.c.
Referenced by tacInput2sim(), tacReadModelingData(), tacReadModelingInput(), and tacSetXContiguous().
|
extern |
Change places between two TACCs inside TAC structure.
| d | Pointer to TAC data. Main header and tacNr are not changed. |
| i1 | TACC index 1 [0.._tacNr-1] |
| i2 | TACC index 2 [0.._tacNr-1] |
Definition at line 282 of file tacorder.c.
Referenced by tacSortByAUC().
Transform TAC data with frame start and end times into suitable form for plotting with frames as bars.
| tac1 | Pointer to input TAC structure; not modified. Must be sorted by increasing x. |
| tac2 | Pointer to output TAC structure; must be initiated; any previous content is destroyed. |
Definition at line 888 of file tacx.c.
Verify that x values (sample or frame times) in TAC structure are ordered by increasing x. Overlapping samples are ok here.
| d | Pointer to TAC structure; not modified. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 25 of file tacorder.c.
Referenced by tacCorrectFrameOverlap(), and tacIsXContiguous().
Add weight to TAC data based on sample frequency or time frame length.
Weights are scaled so that weight sum = sample number. Any existing weighting is overwritten.
| tac | Pointer to TAC struct where weights will be added. |
| isot | Isotope code, in case the weights are calculated for decay corrected data. Enter ISOTOPE_UNKNOWN if calculating weights for non-corrected data, or when decay correction is ignored. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 134 of file tacw.c.
Referenced by tacSetWeights().
Copy weights from one TAC structure to another.
| tac1 | Pointer to source TAC structure. |
| tac2 | Pointer to target TAC structure. |
| i1 | Index of the first sample to copy. |
| i2 | Index of the last sample to copy. |
Definition at line 41 of file tacw.c.
Referenced by tacDuplicate(), and tacExtract().
|
extern |
Moderate weights so that the min weight is not less than given proportion of the maximum weight.
After moderation, all weights are normalized to have and average of one.
| tac | Pointer to TAC structure (which can contain SIF or TAC data). |
| minprop | The minimum proportion of frame weight to maximum frame weight. Must be less than one. If proportion is lower than this limit, then weight is set to proportion times maximum. Setting minimum proportion to zero or less does not change any weights, but weights are still normalized. By default, zero weights or NaNs are not changed. |
| doZeroes | Set zero weights, too, to the minimum proportion of maximum frame weight. |
| doNaNs | Set NaN weights, too, to the minimum proportion of maximum frame weight. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 277 of file tacw.c.
Referenced by tacSetWeights().
Scale weights so that average weight is 1.0, and the sum of weights equals the nr of frames.
| tac | Pointer to TAC structure (which can contain SIF or TAC data). |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 237 of file tacw.c.
Referenced by sifWeight(), tacDecayCorrection(), tacSetWeights(), and tacWeightModerate().
Identify column containing weights in TAC structure, and move weights to the correct place.
TAC name starting with string 'weight' is identified as weight column.
Sets tac->weighting to WEIGHTING_ON or WEIGHTING_OFF, depending on whether weight column was found or not.
| tac | Pointer to TAC structure. |
| ow | Overwrite (1) or do not overwrite (0) existing weights. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 75 of file tacw.c.
Referenced by tacReadCarimasTxt(), tacReadCSV(), tacReadDFT(), and tacReadPMOD().
Write TAC data into specified file in specified format.
| tac | Pointer to TAC structure, contents of which are to be written. |
| fp | Output file pointer. |
| format | File format code; enter TAC_FORMAT_UNKNOWN to write data in the format specified inside TAC structure. |
| extra | Write (1) or do not write (0) also extra header fields found in IFT; not effective with SIF. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 332 of file tacio.c.
Referenced by imgWriteNifti().
Write TAC data into specified file pointer in CSV TAC format.
| tac | Pointer to TAC struct, contents of which are to be written |
| fp | File pointer |
| extra | Write (1) or do not write (0) also extra header fields found in IFT; note that these are not supported by other than TPC SW. |
| format | File format code; accepted values are TAC_FORMAT_CSV_UK, TAC_FORMAT_CSV_INT, TAC_FORMAT_TSV_UK, TAC_FORMAT_TSV_INT, and TAC_FORMAT_UNKNOWN (0); this last one uses format inside TAC struct, or if that is invalid, then the default format TAC_FORMAT_CSV_UK |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 26 of file taccsv.c.
Referenced by tacWrite().
Write TAC data into specified file pointer in DFT format.
| tac | Pointer to TAC struct, contents of which are to be written |
| fp | File pointer |
| extra | Write (1) or do not write (0) also extra header fields found in IFT |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 119 of file dftio.c.
Referenced by tacWrite().
Write TAC data into specified file pointer in PMOD.
| tac | Pointer to TAC structure, contents of which are to be written. |
| fp | File pointer to write to. |
| extra | Write (1) or do not write (0) also extra header fields found in IFT; note that these are not supported by other than TPC SW. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 26 of file pmodio.c.
Referenced by tacWrite().
Write SIF data stored in TAC struct in SIF format.
| tac | Pointer to TAC struct, contents of which are to be written; tacNr can be set to 0 to write only frame times. |
| fp | File pointer. |
| extra | Write (1) or do not write (0) also extra header fields found in tac->h; set this to 0, because extra header lines do not follow SIF format. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 26 of file sifio.c.
Referenced by tacWrite().
Write TAC data into specified file pointer in Simple format.
| tac | Pointer to TAC struct, contents of which are to be written. |
| fp | File pointer. |
| extra | Write (1) or do not write (0) also extra header fields found in IFT. |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 26 of file simpleio.c.
Referenced by tacWrite().
Write TAC data into specified file pointer in Excel compatible XML format.
| tac | Pointer to TAC struct, contents of which are to be written. |
| fp | File pointer |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 26 of file tacxmlio.c.
Referenced by tacWrite().
|
extern |
Get the number of samples in TAC that have weight > 0. Missing (NaN) sample values are included as long as weight is not missing. If weights are not set, then nr of all samples is returned.
| tac | Pointer to the TAC struct. |
Definition at line 219 of file tacw.c.
Copy x values (frame times) from one TAC structure to another.
| tac1 | Pointer to source TAC structure. |
| tac2 | Pointer to target TAC structure. |
| i1 | Index of the first sample time to copy. |
| i2 | Index of the last sample time to copy. |
Definition at line 24 of file tacx.c.
Referenced by bfm1TCM(), tacAllocateMoreSamples(), tacDuplicate(), tacExtract(), tacInterpolate(), tacReadReference(), tacSetWeights(), and tacSetX().
Check whether sample (frame) times are the same (or very close to) in two TAC structures.
Data is not modified. Sort by sample time before calling this. The order of TAC structures is not important. If sampleNr is different, then only common number of samples are compared.
| d1 | Pointer to the first TAC structure; not modified. |
| d2 | Pointer to the second TAC structure; time unit does not matter if conversion can be done. Sample nr may be different than in tac1. Contents not modified. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 249 of file tacx.c.
Referenced by tacInterpolate(), tacInterpolateInto(), and tacReadReference().
|
extern |
Check TAC structure for missing sample times (x, or x1 and x2).
| tac | Pointer to TAC structure. |
Definition at line 23 of file tacnan.c.
Referenced by tacDelay(), tacFixNaNs(), tacInterpolate(), tacInterpolateInto(), tacIsXContiguous(), tacNaNs(), tacSetXContiguous(), tacSortByTime(), and tacVerifyTimeOrder().
|
extern |
Get the range of x values (times) in TAC structure.
Data is not modified. Data does not need to be sorted. Data can contain NaNs, but x values are not omitted if y is NaN and x is not. Samples with zero weight are included.
| d | Pointer to TAC struct |
| xmin | Pointer to variable for min x value (NULL if not needed). |
| xmax | Pointer to variable for max x value (NULL if not needed). |
Definition at line 124 of file tacx.c.
Referenced by sifWeight(), tacAUC(), tacDelay(), tacDelayFit(), tacFittime(), tacInterpolate(), tacInterpolateInto(), tacInterpolateToEqualLengthFrames(), tacIsX(), tacReadModelingData(), and tacXMatch().
Convert X values (sample times) in TAC struct to the specified unit.
| tac | Pointer to TAC struct |
| u | Enum unit |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 23 of file tacunits.c.
Referenced by tacInput2sim(), tacReadModelingData(), tacReadModelingInput(), tacReadReference(), tacSetWeights(), tacSetX(), and tacWriteSIF().
|
extern |
Check TAC structure for missing sample values (y).
Definition at line 47 of file tacnan.c.
Referenced by tacDelay(), tacFixNaNs(), and tacNaNs().
|
extern |
Get the range of y values (concentrations) in TAC struct.
Data is not modified. Data does not need to be sorted. Data can contain NaNs, but y values omitted if corresponding x is NaN.
| d | Pointer to TAC structure. |
| i | Index of TAC, [0, ..., tacNr-1] ; enter <0 to search for max and/or min from all TACs. |
| ymin | Pointer to variable for min y value (NULL if not needed). |
| ymax | Pointer to variable for max y value (NULL if not needed). |
| smin | Pointer to variable where sample index of min y value will be stored (NULL if not needed). |
| smax | Pointer to variable where sample index of max y value will be stored (NULL if not needed). |
| imin | Pointer to variable where tac index of min y value will be stored (NULL if not needed). |
| imax | Pointer to variable where tac index of max y value will be stored (NULL if not needed). |
Definition at line 26 of file tacy.c.
Referenced by mtgaPlotSVG().
|
extern |
Get the range of y values (concentrations) in TAC struct, including only samples with x (times) inside given range.
Data is not modified. Data does not need to be sorted. Data can contain NaNs, but y values omitted if corresponding x is NaN.
| d | Pointer to TAC structure. |
| i | Index of TAC, [0, ..., tacNr-1] ; enter <0 to search for max and/or min from all TACs. |
| xmin | Min x value. |
| xmax | Max x value. |
| ymin | Pointer to variable for min y value (NULL if not needed). |
| ymax | Pointer to variable for max y value (NULL if not needed). |
| smin | Pointer to variable where sample index of min y value will be stored (NULL if not needed). |
| smax | Pointer to variable where sample index of max y value will be stored (NULL if not needed). |
| imin | Pointer to variable where tac index of min y value will be stored (NULL if not needed). |
| imax | Pointer to variable where tac index of max y value will be stored (NULL if not needed). |
Definition at line 99 of file tacy.c.
Referenced by tacPlotFitSVG(), tacPlotHistogramSVG(), and tacPlotLineSVG().
Convert Y values (concentrations) in TAC struct to the specified unit.
| tac | Pointer to TAC struct |
| u | Enum unit |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 72 of file tacunits.c.
Referenced by tacReadModelingData(), tacReadModelingInput(), tacReadReference(), and tacSetWeights().
Convert Y values (per mass concentrations) in TAC struct to the corresponding per volume concentrations.
| tac | Pointer to TAC struct. |
| density | Density (g/mL). |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 169 of file tacunits.c.
Convert Y values (per volume concentrations) in TAC struct to the corresponding per mass concentrations.
| tac | Pointer to TAC struct. |
| density | Density (g/mL). |
| status | Pointer to status data; enter NULL if not needed. |
Definition at line 121 of file tacunits.c.