TPCCLIB
Loading...
Searching...
No Matches
tac.c File Reference

TAC structure processing. More...

#include "tpcclibConfig.h"
#include "tpcift.h"
#include "tpcisotope.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "tpctac.h"

Go to the source code of this file.

Functions

void tacInit (TAC *tac)
 
void taccInit (TACC *tacc)
 
void taccFree (TACC *tacc)
 
void tacFreeExceptHeader (TAC *tac)
 
void tacFree (TAC *tac)
 
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.
 

Detailed Description

TAC structure processing.

Definition in file tac.c.

Function Documentation

◆ tacAllocate()

int tacAllocate ( TAC * tac,
int sampleNr,
int tacNr )

Allocate memory for TAC data (and set data pointers inside the structure). Any previous contents are deleted. Contents are set to NaN.

See also
tacAllocateMore, tacDuplicate, tacInit, tacFree
Returns
Returns TPCERROR status.
Parameters
tacPointer to initiated TAC structure data; any old contents are deleted. tacNr and sampleNr inside the structure are set to or kept at zero.
sampleNrNr of samples to allocate.
tacNrNr of concentration arrays (regional TACs) to allocate.

Definition at line 130 of file tac.c.

138 {
139 if(tac==NULL) return TPCERROR_FAIL;
140 /* Delete any previous contents */
141 tacFree(tac);
142 /* If no memory is requested, then just return */
143 if(sampleNr<1 && tacNr<1) return TPCERROR_OK;
144 if(sampleNr<1 || tacNr<1) return TPCERROR_FAIL;
145
146 /* Allocate memory for TACC data */
147 tac->c=(TACC*)malloc(tacNr*sizeof(TACC));
148 if(tac->c==NULL) return TPCERROR_OUT_OF_MEMORY;
149 for(int i=0; i<tacNr; i++) taccInit(&tac->c[i]);
150 tac->_tacNr=tacNr;
151
152 /* Allocate memory for all double arrays */
153 int n; n=sampleNr*(4+tacNr);
154 tac->_data=(double*)calloc(n, sizeof(double));
155 if(tac->_data==NULL) return TPCERROR_OUT_OF_MEMORY;
156 for(int i=0; i<n; i++) tac->_data[i]=nan("");
157 tac->_sampleNr=sampleNr;
158
159 /* Set pointers for curve data */
160 double *d=tac->_data;
161 tac->x=d; d+=sampleNr;
162 tac->x1=d; d+=sampleNr;
163 tac->x2=d; d+=sampleNr;
164 tac->w=d; d+=sampleNr;
165 for(int i=0; i<tacNr; i++) {tac->c[i].y=d; d+=sampleNr;}
166
167 return TPCERROR_OK;
168}
Definition tpctac.h:66
double * y
Definition tpctac.h:75
double * x
Definition tpctac.h:97
int _sampleNr
Definition tpctac.h:121
double * _data
Definition tpctac.h:126
double * w
Definition tpctac.h:111
TACC * c
Definition tpctac.h:117
double * x2
Definition tpctac.h:101
int _tacNr
Definition tpctac.h:119
double * x1
Definition tpctac.h:99
void tacFree(TAC *tac)
Definition tac.c:106
void taccInit(TACC *tacc)
Definition tac.c:48
@ TPCERROR_FAIL
General error.
@ TPCERROR_OUT_OF_MEMORY
Cannot allocate memory.
@ TPCERROR_OK
No error.

Referenced by bfm1TCM(), bfmSRTM(), imgToSIF(), tacAllocateMoreSamples(), tacAllocateWithPAR(), 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().

◆ tacAllocateMore()

int tacAllocateMore ( TAC * tac,
int tacNr )

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.

See also
tacAllocate, tacAllocateMoreSamples, tacCopyTacc
Returns
Returns TPCERROR status.
Parameters
tacPointer to initiated and previously allocated TAC structure data; any old contents are preserved, including tacNr.
tacNrNr 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.

185 {
186 if(tac==NULL) return TPCERROR_FAIL;
187 if(tac->_sampleNr<1) return TPCERROR_FAIL;
188 /* Check if there is enough space already */
189 int newNr, addNr;
190 newNr=tac->tacNr+tacNr;
191 addNr=newNr-tac->_tacNr;
192 //printf("newNr := %d\naddNr := %d\n", newNr, addNr);
193 if(addNr<=0) return TPCERROR_OK;
194
195 /* Reallocate memory for TACC data */
196 TACC *taccPtr;
197 taccPtr=realloc(tac->c, sizeof(TACC)*newNr);
198 if(taccPtr==NULL) return TPCERROR_OUT_OF_MEMORY;
199 tac->c=taccPtr;
200 /* Reallocate memory for double arrays */
201 double *dPtr;
202 dPtr=realloc(tac->_data, sizeof(double)*(4+newNr)*tac->_sampleNr);
203 if(dPtr==NULL) return TPCERROR_OUT_OF_MEMORY;
204 tac->_data=dPtr;
205 /* If both ok, then update the nr of allocated TACs and initiate new TTACs */
206 for(int i=tac->_tacNr; i<newNr; i++) taccInit(&tac->c[i]);
207 tac->_tacNr=newNr;
208
209 /* Reset pointers for curve data */
210 double *d=tac->_data;
211 tac->x=d; d+=tac->_sampleNr;
212 tac->x1=d; d+=tac->_sampleNr;
213 tac->x2=d; d+=tac->_sampleNr;
214 tac->w=d; d+=tac->_sampleNr;
215 for(int i=0; i<tac->_tacNr; i++) {tac->c[i].y=d; d+=tac->_sampleNr;}
216
217 /* Set new y values to NaN */
218 for(int i=tac->_tacNr-addNr; i<tac->_tacNr; i++)
219 for(int j=0; j<tac->_sampleNr; j++) tac->c[i].y[j]=nan("");
220
221 return TPCERROR_OK;
222}
int tacNr
Definition tpctac.h:91

Referenced by imgToSIF(), tacInterpolateInto(), tacReadReference(), and tacSetX().

◆ tacAllocateMoreSamples()

int tacAllocateMoreSamples ( TAC * tac,
int addNr )

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).

See also
tacAllocateMore, tacAddZeroSample, tacDuplicate
Returns
Returns TPCERROR status (0 when successful).
Parameters
tacPointer to initiated and previously allocated TAC structure data; any old contents are preserved, including tacNr and sampleNr.
addNrNr 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.

442 {
443 if(addNr<1) return TPCERROR_OK;
444 if(tac==NULL) return TPCERROR_FAIL;
445 if(tac->_sampleNr<1 || tac->_tacNr<1) return TPCERROR_FAIL;
446
447 /* Check if there is enough space already */
448 int newNr;
449 newNr=tac->sampleNr+addNr;
450 addNr=newNr-tac->_sampleNr;
451 if(addNr<=0) return TPCERROR_OK;
452
453 /* Make a temporary copy of the original data */
454 int ret;
455 TAC temp; tacInit(&temp);
456 ret=tacDuplicate(tac, &temp); if(ret!=TPCERROR_OK) return(ret);
457
458 /* Delete and reallocate the original TAC */
459 tacFree(tac);
460 ret=tacAllocate(tac, newNr, temp.tacNr);
461 if(ret!=TPCERROR_OK) {tacFree(&temp); return(ret);}
462 tac->sampleNr=temp.sampleNr;
463 tac->tacNr=temp.tacNr;
464
465 /* Copy the contents */
466 ret=tacCopyHdr(&temp, tac);
467 if(ret!=TPCERROR_OK) {tacFree(&temp); return(ret);}
468 for(int i=0, ret=0; i<temp.tacNr && ret==0; i++)
469 ret=tacCopyTacc(&temp.c[i], &tac->c[i], temp.sampleNr);
470 if(ret!=0) {tacFree(&temp); return TPCERROR_FAIL;}
471 ret=tacXCopy(&temp, tac, 0, temp.sampleNr-1);
472 if(ret!=0) {tacFree(&temp); return TPCERROR_FAIL;}
473
474 tacFree(&temp);
475 return TPCERROR_OK;
476}
Definition tpctac.h:87
int sampleNr
Definition tpctac.h:89
int tacDuplicate(TAC *tac1, TAC *tac2)
Make a duplicate of TAC structure.
Definition tac.c:356
int tacAllocate(TAC *tac, int sampleNr, int tacNr)
Definition tac.c:130
void tacInit(TAC *tac)
Definition tac.c:24
int tacCopyTacc(TACC *d1, TACC *d2, int sampleNr)
Definition tac.c:233
int tacCopyHdr(TAC *tac1, TAC *tac2)
Copy TAC header data from tac1 to tac2.
Definition tac.c:310
int tacXCopy(TAC *tac1, TAC *tac2, int i1, int i2)
Definition tacx.c:24

Referenced by imgToSIF(), tacAddZeroSample(), tacFramesToSteps(), tacInput2sim(), tacSetXContiguous(), and tacToBars().

◆ taccFree()

void taccFree ( TACC * tacc)

Free memory allocated for TACC data. All contents are destroyed.

Precondition
Before first use initialize the TACC structure with taccInit().
See also
tacFree, taccInit, tacInit, tacAllocate
Author
Vesa Oikonen
Parameters
taccPointer to TACC

Definition at line 68 of file tac.c.

71 {
72 // TACC does not actually contain mallocated or callocated memory,
73 // therefore we can just clear the values
74 taccInit(tacc);
75}

Referenced by tacFree(), and tacFreeExceptHeader().

◆ taccInit()

void taccInit ( TACC * tacc)

Initiate the TACC structure before any use.

See also
tacInit, taccFreeExceptHeader, tacInit
Author
Vesa Oikonen
Parameters
taccPointer to TACC

Definition at line 48 of file tac.c.

51 {
52 if(tacc==NULL) return;
54 tacc->size=0.0;
55 tacc->sunit=UNIT_UNKNOWN;
56 tacc->y=NULL;
57 tacc->sw=tacc->sw2=0;
58 tacc->name[0]='\0';
59}
tactype type
Definition tpctac.h:69
char sw
Definition tpctac.h:77
char name[MAX_TACNAME_LEN+1]
Definition tpctac.h:81
unit sunit
Definition tpctac.h:73
char sw2
Definition tpctac.h:79
double size
Definition tpctac.h:71
@ UNIT_UNKNOWN
Unknown unit.
@ TACTYPE_UNKNOWN
Content type not known.

Referenced by tacAllocate(), tacAllocateMore(), and taccFree().

◆ tacCopyHdr()

int tacCopyHdr ( TAC * tac1,
TAC * tac2 )

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.

See also
tacCopyTacchdr, tacIsWeighted, tacWCopy
Returns
Returns TPCERROR status.
Parameters
tac1Pointer to source TAC structure.
tac2Pointer to target TAC structure.

Definition at line 310 of file tac.c.

315 {
316 /* Check that required data exists */
317 if(tac1==NULL || tac2==NULL) return TPCERROR_FAIL;
318 /* Copy TAC header fields */
319 tac2->format=tac1->format;
320 tac2->isframe=tac1->isframe;
321 tac2->cunit=tac1->cunit;
322 tac2->tunit=tac1->tunit;
323 //tac2->weighting=tac1->weighting;
324 /* Copy IFT */
325 iftFree(&tac2->h); iftDuplicate(&tac1->h, &tac2->h);
326 return TPCERROR_OK;
327}
void iftFree(IFT *ift)
Definition ift.c:37
int iftDuplicate(IFT *ift1, IFT *ift2)
Definition ift.c:236
tacformat format
Definition tpctac.h:93
IFT h
Optional (but often useful) header information.
Definition tpctac.h:141
int cunit
Definition tpctac.h:105
int isframe
Definition tpctac.h:95
int tunit
Definition tpctac.h:109

Referenced by tacAllocateMoreSamples(), tacDuplicate(), tacExtract(), tacExtractRange(), tacExtractSamples(), tacInterpolate(), tacInterpolateToEqualLengthFrames(), and tacMultipleSamples().

◆ tacCopyTacc()

int tacCopyTacc ( TACC * d1,
TACC * d2,
int sampleNr )

Copy TACC contents (y data and its header) from tacc1 to tacc2.

These may be inside different TAC structures, therefore sampleNr is needed.

See also
tacCopyTacchdr, tacCopyTaccdata, tacXCopy, tacWCopy, tacDuplicate, tacCopyHdr, tacAllocateMore, tacDeleteTACC, tacSwapTACCs
Returns
Returns TPCERROR status.
Parameters
d1Pointer to source TACC structure.
d2Pointer to target TACC structure.
sampleNrSample (frame) number.

Definition at line 233 of file tac.c.

240 {
241 int ret;
242
243 /* Check that required data exists */
244 if(d1==NULL || d2==NULL) return TPCERROR_FAIL;
245 /* Copy TACC header */
246 ret=tacCopyTacchdr(d1, d2); if(ret!=TPCERROR_OK) return ret;
247 /* Copy TACC data */
248 ret=tacCopyTaccdata(d1, d2, sampleNr); if(ret!=TPCERROR_OK) return ret;
249 return TPCERROR_OK;
250}
int tacCopyTaccdata(TACC *d1, TACC *d2, int sampleNr)
Definition tac.c:260
int tacCopyTacchdr(TACC *d1, TACC *d2)
Definition tac.c:282

Referenced by tacAllocateMoreSamples(), tacDuplicate(), tacExtract(), and tacReadReference().

◆ tacCopyTaccdata()

int tacCopyTaccdata ( TACC * d1,
TACC * d2,
int sampleNr )

Copy TACC y data from tacc1 to tacc2.

These may be inside different TAC structures, therefore sampleNr is needed.

See also
tacCopyTacchdr, tacXCopy, tacWCopy
Returns
Returns TPCERROR status.
Parameters
d1Pointer to source TACC structure.
d2Pointer to target TACC structure.
sampleNrSample (frame) nr.

Definition at line 260 of file tac.c.

267 {
268 /* Check that required data exists */
269 if(d1==NULL || d2==NULL) return TPCERROR_FAIL;
270 if(sampleNr<1) return TPCERROR_OK;
271 /* Copy data array contents */
272 for(int i=0; i<sampleNr; i++) d2->y[i]=d1->y[i];
273 return TPCERROR_OK;
274}

Referenced by tacCopyTacc().

◆ tacCopyTacchdr()

int tacCopyTacchdr ( TACC * d1,
TACC * d2 )

Copy TACC header data from tacc1 to tacc2.

See also
tacCopyHdr, tacCopyTaccdata, tacCopyTacc
Returns
Returns TPCERROR status.
Parameters
d1Pointer to source TACVOI structure.
d2Pointer to target TACVOI structure.

Definition at line 282 of file tac.c.

287 {
288 /* Check that required data exists */
289 if(d1==NULL || d2==NULL) return TPCERROR_FAIL;
290 /* Copy TACC header fields */
291 d2->type=d1->type;
292 d2->size=d1->size;
293 d2->sunit=d1->sunit;
294 d2->sw=d1->sw;
295 d2->sw2=d1->sw2;
296 strcpy(d2->name, d1->name);
297 return TPCERROR_OK;
298}

Referenced by tacCopyTacc(), tacExtractRange(), tacExtractSamples(), tacInterpolate(), tacInterpolateInto(), tacInterpolateToEqualLengthFrames(), and tacMultipleSamples().

◆ tacDuplicate()

int tacDuplicate ( TAC * tac1,
TAC * tac2 )

Make a duplicate of TAC structure.

In the duplicate, space is allocated only for the tacNr and sampleNr specified in the original TAC.

See also
tacExtract, tacAllocate, tacCopyHdr, tacCopyTacc, tacXCopy, tacDeleteTACC
Returns
Returns TPCERROR status (0 when successful).
Parameters
tac1Pointer to the source TAC.
tac2Pointer to the target TAC; must be initiated; any old contents are deleted.

Definition at line 356 of file tac.c.

361 {
362 if(tac1==NULL || tac2==NULL) return TPCERROR_FAIL;
363 if(tac1->sampleNr<1 || tac1->tacNr<1) return TPCERROR_FAIL;
364
365 /* Empty the duplicate */
366 tacFree(tac2);
367
368 int ret;
369
370 /* Allocate memory for tac2 */
371 ret=tacAllocate(tac2, tac1->sampleNr, tac1->tacNr);
372 if(ret!=TPCERROR_OK) return(ret);
373 tac2->sampleNr=tac1->sampleNr;
374 tac2->tacNr=tac1->tacNr;
375
376 /* Copy the contents */
377 ret=tacCopyHdr(tac1, tac2);
378 if(ret!=TPCERROR_OK) return(ret);
379 for(int i=0, ret=0; i<tac1->tacNr && ret==0; i++)
380 ret=tacCopyTacc(&tac1->c[i], &tac2->c[i], tac1->sampleNr);
381 if(ret!=0) return TPCERROR_FAIL;
382 ret=tacXCopy(tac1, tac2, 0, tac1->sampleNr-1);
383 if(ret!=0) return TPCERROR_FAIL;
384 ret=tacWCopy(tac1, tac2, 0, tac1->sampleNr-1);
385 if(ret!=0) return TPCERROR_FAIL;
386
387 return TPCERROR_OK;
388}
int tacWCopy(TAC *tac1, TAC *tac2, int i1, int i2)
Definition tacw.c:41

Referenced by mtacAddTAC(), tacAllocateMoreSamples(), tacExtractRange(), tacExtractSamples(), tacFramesToSteps(), tacInput2sim(), tacIntegrate(), tacMultipleSamples(), tacReadReference(), tacSetX(), tacSetXContiguous(), and tacToBars().

◆ tacExtract()

int tacExtract ( TAC * d1,
TAC * d2,
const int i )

Extract the specified TAC from existing TAC structure into a new TAC.

See also
tacDuplicate, tacDeleteTACC, tacCopyTacc, tacExtractSamples
Returns
Returns TPCERROR status (0 if ok).
Parameters
d1Pointer to the source TAC structure. Not modified.
d2Pointer to the target TAC structure; any previous contents are deleted.
See also
tacInit, tacFree
Parameters
iIndex of the TAC to extract [0..tacNr-1].

Definition at line 396 of file tac.c.

404 {
405 if(d1==NULL || d2==NULL) return TPCERROR_FAIL;
406 if(d1->sampleNr<1 || d1->tacNr<1) return TPCERROR_NO_DATA;
407 if(i<0 || i>=d1->tacNr) return TPCERROR_INVALID_VALUE;
408
409 /* Remove any old contents in target structure */
410 tacFree(d2);
411
412 /* Allocate space for the new TAC */
413 int ret=tacAllocate(d2, d1->sampleNr, 1); if(ret!=TPCERROR_OK) return(ret);
414 d2->sampleNr=d1->sampleNr;
415 d2->tacNr=1;
416
417 /* Copy contents */
418 ret=tacCopyHdr(d1, d2); if(ret!=TPCERROR_OK) {tacFree(d2); return(ret);}
419 ret=tacXCopy(d1, d2, 0, d1->sampleNr-1); if(ret!=TPCERROR_OK) {tacFree(d2); return(ret);}
420 ret=tacCopyTacc(d1->c+i, d2->c, d1->sampleNr); if(ret!=TPCERROR_OK) {tacFree(d2); return(ret);}
421 ret=tacWCopy(d1, d2, 0, d1->sampleNr-1); if(ret!=TPCERROR_OK) {tacFree(d2); return(ret);}
422
423 return(TPCERROR_OK);
424}
@ TPCERROR_INVALID_VALUE
Invalid value.
@ TPCERROR_NO_DATA
File contains no data.

◆ tacFree()

void tacFree ( TAC * tac)

Free memory allocated for TAC data. All contents are destroyed, including any header data.

Precondition
Before first use initialize the TAC structure with tacInit().
See also
tacFreeExceptHeader, tacInit, tacAllocate, tacDuplicate, tacDeleteTACC
Author
Vesa Oikonen
Parameters
tacPointer to TAC

Definition at line 106 of file tac.c.

109 {
110 if(tac==NULL) return;
111 free(tac->_data);
112 // Free allocated TACC contents; actually not necessary, but lets do it
113 // for consistency */
114 for(int i=0; i<tac->_tacNr; i++) taccFree(&tac->c[i]);
115 // Free the TACC list
116 free(tac->c);
117 // Free the header data
118 iftFree(&tac->h);
119 // then set everything to zero or NULL again
120 tacInit(tac);
121}
void taccFree(TACC *tacc)
Definition tac.c:68

Referenced by bfm1TCM(), bfmSRTM(), imgReadNifti(), imgWriteNifti(), mtacFree(), tacAllocate(), tacAllocateMoreSamples(), tacAUC(), tacDelay(), tacDuplicate(), tacExtract(), tacExtractRange(), tacExtractSamples(), tacFramesToSteps(), tacInput2sim(), tacIntegrate(), 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().

◆ tacFreeExceptHeader()

void tacFreeExceptHeader ( TAC * tac)

Free memory allocated for TAC data. All contents are destroyed, except the header data in IFT structure.

Precondition
Before first use initialize the TAC structure with tacInit().
See also
tacFree, tacInit, tacAllocate, tacDuplicate
Parameters
tacPointer to TAC

Definition at line 84 of file tac.c.

87 {
88 if(tac==NULL) return;
89 free(tac->_data);
90 // Free allocated TACC contents; actually not necessary, but lets do it
91 // for consistency */
92 for(int i=0; i<tac->_tacNr; i++) taccFree(&tac->c[i]);
93 // Free the TACC list
94 free(tac->c);
95 // then set everything to zero or NULL again
96 tacInit(tac);
97}

◆ tacInit()

void tacInit ( TAC * tac)

Initiate the TAC structure before any use.

See also
tacFree, tacFreeExceptHeader, tacAllocate, tacDuplicate
Author
Vesa Oikonen
Parameters
tacPointer to TAC

Definition at line 24 of file tac.c.

27 {
28 if(tac==NULL) return;
29 tac->sampleNr=tac->_sampleNr=0;
30 tac->tacNr=tac->_tacNr=0;
32 tac->isframe=0;
33 tac->x=tac->x1=tac->x2=NULL;
34 tac->cunit=tac->tunit=UNIT_UNKNOWN;
35 tac->w=NULL;
37 tac->c=NULL;
38 tac->_data=NULL;
39 iftInit(&tac->h);
40}
void iftInit(IFT *ift)
Definition ift.c:21
weights weighting
Definition tpctac.h:115
@ WEIGHTING_UNKNOWN
Not known; usually assumed that not weighted.
@ TAC_FORMAT_UNKNOWN
Unknown format.
Definition tpctac.h:28

Referenced by bfm1TCM(), imgReadNifti(), imgWriteNifti(), mtacAllocate(), mtacAllocateMore(), tacAllocateMoreSamples(), tacAUC(), tacDelay(), tacExtractRange(), tacFree(), tacFreeExceptHeader(), tacInput2sim(), tacMultipleSamples(), tacReadModelingData(), tacReadModelingInput(), tacReadReference(), tacSetWeights(), tacSetX(), and tacSetXContiguous().

◆ tacIsSize()

int tacIsSize ( TAC * d)

Check if any of TAC sets has VOI size (volume).

Returns
1 if size(s) exist, and 0 if not (or in case of an error).
See also
tacIsWeighted, tacIsX
Parameters
dPointer to TAC structure.

Definition at line 335 of file tac.c.

338 {
339 if(d==NULL || d->tacNr<1) return(0);
340 for(int ri=0; ri<d->tacNr; ri++) {
341 if(isnan(d->c[ri].size)) continue;
342 if(d->c[ri].size<=0.0) continue;
343 return(1);
344 }
345 return(0);
346}

Referenced by tacWriteCSV().