My Project
libtpcimgiov.c
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Copyright (c) 2005-2011 by Turku PET Centre
4 
5  File: libtpcimgiov.c
6  Description: This file contains function for printing the date and time when
7  this library is compiled.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17  See the GNU Lesser General Public License for more details:
18  http://www.gnu.org/copyleft/lesser.html
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with this library/program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 
24  Turku PET Centre, Turku, Finland, http://www.turkupetcentre.fi
25 
26  Modification history:
27  2004-11-07 Vesa Oikonen
28  2005-01-20 Calle Laakkonen
29  2005-04-26 Jarkko Johansson
30  Functions libtpcimgio_print_readme(), libtpcimgio_print_history(),
31  libtpcimgio_print_dreadme() and libtpcimgio_print_dhistory()
32  are used for getting the Readme and History messages for the libtpcimgio,
33  with and without Doxygen style tags. Remember to update the
34  functions to get correct Readme and History messages!
35 
36  Function libtpcimgio_print_build(), is used for getting the build
37  information.
38 
39  2005-08-01 1.1.1 CL/JJ
40  Changed image loading/writing functions fname to const,
41  and extern int VOL_TEST to int VOL_TEST.
42 
43  2005-10-10 1.1.2 CL
44  See function libtpcimgio_print_history().
45 
46  2005-11-21 1.1.3 VO
47  See halflife.c.
48 
49  2005-12-12 1.1.4 VO
50  See imgfile.c.
51 
52  2006-10-31 1.1.5 VO
53  Created imgunit.c; moved a few functions into it.
54  Fixed a timezone bug in imgfile.c.
55 
56  2006-12-28 1.1.6 VO
57  Changes in halflife.c.
58 
59  2007-02-02 1.2.0 VO
60  Changes in IMG structure.
61  Halflife.c, *.h, and related functions moved into libtpcmisc 1.2.0.
62  Not more dependent from libtpcimgp: min and max search moved to this library.
63  Lots of changes in imgunit.c.
64 
65  2007-02-11 1.2.1 VO
66  Changes and additions regarding statmsg processing and storing.
67  Deleted imgmsg.h.
68  Added errstatus in IMG struct.
69 
70  2007-02-27 1.2.2 VO
71  Bug corrections.
72  ECAT7 related functions separated from imgfile.c to img_e7.c.
73  Added functions for Analyze, Ecat 6.3 and Ecat 7 formats.
74 
75  2007-03-12 1.2.3 VO
76  ECAT 6.3 header print functions changed.
77  Added functions for ECAT matrix lists.
78  Added IMG error messages.
79 
80  2007-03-21 1.2.4 VO
81  Changes to make easier to save ECAT7 2D data.
82  ECAT7 main header scan start time printed correctly when compiled with Mingw.
83  Bug correction in ecat7ReadImageheader() in extra data contents.
84 
85  2007-03-25 1.2.5 VO
86 
87  2007-04-03 1.3.0 VO
88  Added support for ECAT7 polar map.
89 
90  2007-07-17 Harri Merisaari
91  Modified for optional ANSI compatibility
92 
93  2007-09-10 1.3.2 VO
94  Bug corrections in img.c and img_e7.c.
95 
96  2007-09-10 1.3.3 VO
97  Return value of localtime() is checked.
98 
99  2007-09-11 1.3.4 VO
100  Bug correction in analyze.c.
101 
102  2007-09-12 1.3.5 VO
103  Bug correction in img_e7.c.
104 
105  2008-07-07 1.3.6 VO
106  Changes in imgdecay.c and img_ana.c.
107 
108  2008-07-11 1.3.7 VO
109  Addition in weight.c and sif.h.
110 
111  2008-07-14 1.3.8 VO
112  See history below.
113 
114  From this on, see history below.
115 
116 ******************************************************************************/
117 #include <stdio.h>
118 #include "libtpcimgiov.h"
119 /*****************************************************************************/
121 #define LIB_NAME "libtpcimgio"
122 
124 #define LIB_VERSION "1.5.10"
125 
127 #define COPYRIGHT "(c) 2005-2011 by Turku PET Centre"
128 
129 /*****************************************************************************/
136  fputs("\n"
138  "\n"
139  "Build "__DATE__" "__TIME__"\n"
140  "\n"
141  "\n"
142  "PET Image IO library\n"
143  "-------------------------------------------------------------------------------\n"
144  "\n"
145  "2007-03-21\n"
146  "Turku PET Centre\n"
147  "\n",fp);
148  fputs("Libtpcimgio is distributed under the GNU Lesser General Public Licence\n"
149  "http://www.gnu.org/licenses/lgpl.html\n"
150  "More information on open source licences: http://www.opensource.org/\n"
151  "\n"
152  "Description\n"
153  "-------------------------------------------------------------------------------\n"
154  "\n"
155  "The libtpcimgio library is a collection of commonly used C files in Turku PET Centre\n"
156  "for image file input and output procedures. Libtpcimgio library supports Analyze 7.5,\n"
157  "Ecat 6.x, Ecat 7.x and partly interfile formats.\n"
158  "\n",fp);
159  fputs("List of files\n"
160  "-------------------------------------------------------------------------------\n"
161  "\n"
162  "include/ - Includes all the header files for the .c files\n"
163  "\n"
164  "Makefile - The makefile\n"
165  "\n"
166  "** .c files **\n"
167  "\n"
168  "analyze.c - reading and writing Analyze 7.5 image files.\n"
169  "\n"
170  "ecat63ml.c - Procedures for ECAT 6.3 matrix list.\n"
171  "\n",fp);
172  fputs("ecat63p.c - Printing ECAT 6.3 headers.\n"
173  "\n"
174  "ecat63r.c - Reading ECAT 6.3 files.\n"
175  "\n"
176  "ecat63w.c - Writing ECAT 6.3 files.\n"
177  "\n"
178  "ecat7ml.c - Procedures for ECAT 7.x matrix list.\n"
179  "\n"
180  "ecat7p.c - Printing ECAT 7.x headers.\n"
181  "\n"
182  "ecat7h.c - Edit ECAT 7.x headers.\n"
183  "\n"
184  "ecat7r.c - Reading ECAT 7.x files.\n"
185  "\n",fp);
186  fputs("ecat7w.c - Writing ECAT 7.x files.\n"
187  "\n"
188  "img.c - Procedures for 4D image data (common to all image file formats).\n"
189  "\n"
190  "img_ana.c - Subprocedures for reading/writing Analyze 7.5 files to/from IMG.\n"
191  "\n"
192  "img_e63.c - Subprocedures for reading/writing ECAT 6.3 files to/from IMG.\n"
193  "\n"
194  "img_e7.c - Subprocedures for reading/writing ECAT 7 files to/from IMG.\n"
195  "\n"
196  "imgdecay.c - Decay correction, isotope codes, and half-lives.\n"
197  "\n"
198  "imgfile.c - Main procedures for IMG read/write.\n"
199  "\n",fp);
200  fputs("imgmax.c - Procedures for searching IMG min and max value.\n"
201  "\n"
202  "imgunit.c - Procedures for working with IMG calibration unit.\n"
203  "\n"
204  "interfile.c - Reading Interfile headers.\n"
205  "\n"
206  "micropet.c - Reading Inveon images.\n"
207  "\n"
208  "sif.c - Routines for Scan Information Files (SIF).\n"
209  "\n"
210  "sifio.c - Functions for reading and writing SIF format files.\n"
211  "\n"
212  "vol.c - Procedures for 3D image volume data (no time information).\n"
213  "\n"
214  "weight.c - Functions for setting weight factors based on SIF.\n"
215  "\n",fp);
216  fputs("libtpcimgio.c - Program for printing Readme and History information, and for\n"
217  " testing the library functions.\n"
218  "\n"
219  "libtpcimgiov.c- Version information for this library.\n"
220  "\n"
221  "\n"
222  "Using the library\n"
223  "-------------------------------------------------------------------------------\n"
224  "\n"
225  "The program that uses the library should include the .h file it needs.\n"
226  "Example:\n"
227  " \\#include <img.h>\n"
228  "\n"
229  "libtpcimgio depends on libtpcmisc.\n"
230  "Example:\n"
231  " gcc myprog.c -ltpcimgio -ltpcmisc\n"
232  "\n",fp);
233  fflush(fp);
234 }
235 
243  fputs("2005-01-04 1.0.0 Vesa Oikonen, Calle Laakkonen, Riku Klén, Jarkko Johansson\n"
244  " Former libpet, the common PET C library, has been divided up in smaller\n"
245  " sublibraries that each handle a specific task. This library includes functions\n"
246  " utilised in image file input and output procedures. \n"
247  "\n"
248  "2005-03-03 1.0.0 Jarkko Johansson \n"
249  " imgproc.[c/h] moved to libtpcimgp library\n"
250  "\n"
251  "2005-04-05 1.0.1 (krs) Roman Krais\n"
252  " interfile.c added (for reading interfile headers)\n"
253  "\n"
254  "2005-04-25 1.1.0 Jarkko Johansson\n",fp);
255  fputs(" History and Readme files included in new print functions:\n"
256  " libtpcimgio_print_readme(FILE *fp);\n"
257  " libtpcimgio_print_history(FILE *fp);\n"
258  " libtpcimgio_print_dreadme(FILE *fp);\n"
259  " libtpcimgio_print_dhistory(FILE *fp);\n"
260  " libtpcimgio_print_build(FILE *fp);\n"
261  " in file libtpcimgio.c. Update the the Readme and History\n"
262  " there.\n"
263  "\n"
264  " Compiled in Windows with MinGW.\n"
265  "\n"
266  "2005-05-04 1.1.0 JJ\n"
267  " Minor changes in file sifio.c.\n"
268  "\n"
269  "2005-08-01 1.1.1 CL/JJ\n",fp);
270  fputs(" Changed image loading/writing functions fname to const,\n"
271  " and extern int VOL_TEST to int VOL_TEST.\n"
272  "\n"
273  "2005-10-10 1.1.2 CL\n"
274  " imgWriteAnalyze() now writes only 1 frame at a time,\n"
275  " conserving memory.\n"
276  "\n"
277  "2005-11-21 1.1.3 VO\n"
278  " lambda2factor() now calculates correctly when removing\n"
279  " decay correction considering frame lengths.\n"
280  "\n"
281  "2005-12-12 1.1.4 VO\n"
282  " imgReadAnalyze() sets img.isotopeHalflife,\n"
283  " if isotope is found in SIF.\n"
284  "\n",fp);
285  fputs("2006-10-31 1.1.5 VO\n"
286  " Added function imgUnitId().\n"
287  " Fixed a timezone bug with ECAT7 files.\n"
288  "\n"
289  "2006-12-28 1.1.6 VO\n"
290  " Changes in identification of isotope codes.\n"
291  "\n"
292  "2007-02-02 1.2.0 VO\n"
293  " Additions in IMG structure, and subsequent changes in i/o functions.\n"
294  " Isotope and halflife related functions are relocated into libtpcmisc.\n"
295  " This library is now independent of libtpcimgp.\n",fp);
296  fputs(" IMG min and max search functions are relocated here.\n"
297  " User_process_code is read/written with ECAT7 and ECAT6.3 files.\n"
298  " Patient_id is read/written with ECAT7 and ECAT6.3 files.\n"
299  " Study_description is read/written with ECAT7 and ECAT6.3 files.\n"
300  " X, y and z resolution is read/written with ECAT7 images.\n"
301  " Prompts and randoms (delayed) are read/written with ECAT7 and\n"
302  " ECAT6.3 sinograms and read from SIF with Analyze 7.5.\n",fp);
303  fputs(" Changes in identifying and processing calibration units.\n"
304  "\n"
305  "2007-02-11 1.2.1 VO\n"
306  " Addition in IMG structure.\n"
307  " Deleted imgmsg.h. Set IMG.statmsg using imgSetStatus().\n"
308  "\n"
309  "2007-02-27 1.2.2 VO\n"
310  " Bug corrections.\n"
311  "\n"
312  "2007-03-13 1.2.3 VO\n"
313  " Added ECAT matrix list functions and error messages.\n"
314  " ECAT 6.3 header print format changed.\n"
315  "\n",fp);
316  fputs("2007-03-21 1.2.4 VO\n"
317  " Changes to make easier to write ECAT7 2D files.\n"
318  "\n"
319  "2007-03-25 1.2.5 VO\n"
320  " Addition of functions for reading and writing ECAT and Analyze\n"
321  " format one frame at a time.\n"
322  "\n"
323  "2007-04-03 1.3.0 VO\n"
324  " Added support for ECAT7 polar maps.\n"
325  " Information for polar map added to IMG struct.\n"
326  "\n"
327  "2007-07-17 1.3.1 Harri Merisaari\n"
328  " Modified for optional ANSI compatibility.\n"
329  "\n"
330  "2007-09-10 1.3.2 VO\n"
331  " Bug correction in setting error messages.\n"
332  " Bug correction in reading some too long header text fields.\n"
333  "\n"
334  "2007-09-10 1.3.3 VO\n"
335  " Return value of localtime() is always checked.\n"
336  "\n",fp);
337  fputs("2007-09-11 1.3.4 VO\n"
338  " Corrected a bug affecting versions 1.3.1 -1.3.3:\n"
339  " Analyze and ECAT files could have been mixed if in same folder.\n"
340  "\n"
341  "2007-09-12 1.3.5 VO\n"
342  " Corrected a bug affecting frame-by-frame reading of\n"
343  " ECAT7 2D image files.\n"
344  "\n"
345  "2008-07-07 1.3.6 VO\n"
346  " Image decay correction functions return error if frame times\n"
347  " are missing.\n"
348  " Assumes that Analyze 7.5 images are corrected for decay when\n"
349  " that information is not found in header file.\n"
350  "\n"
351  "2008-07-11 1.3.7 VO\n"
352  " Added function sifModerate().\n"
353  "\n"
354  "2008-07-14 1.3.8 VO\n"
355  " Added function imgAllocateWithHeader().\n"
356  "\n"
357  "2008-07-24 1.3.9 VO\n"
358  " Added functions ecat7EditMHeader(), ecat7EditSHeader(),\n"
359  " ecat7EditVHeader(), imgSetUnit(), and ecat7PrintSubheader().\n"
360  "\n"
361  "2008-09-02 1.4.0 VO\n"
362  " Default ECAT backup extension changed to .bak.\n"
363  "\n"
364  "2008-10-03 1.4.1 VO\n"
365  " Accepts certain Analyze formats with 32 bit pixel values.\n"
366  "\n"
367  "2008-10-09 1.4.2 VO\n"
368  " Accepts more Analyze formats with 32 bit pixel values (PVElab).\n"
369  "\n",fp);
370  fputs("2008-11-06 1.4.3 VO\n"
371  " Bug correction in reading ECAT 6.3 files.\n"
372  "\n"
373  "2009-02-17 1.5.0 VO\n"
374  " Added definitions for Siemens Inveon in img.h.\n"
375  " Added micropet.c and .h for reading Siemens Inveon images.\n"
376  "\n"
377  "2009-02-25 1.5.1 VO\n"
378  " Changes in micropet.c and .h to allow reading CT images.\n"
379  "\n"
380  "2009-04-06 1.5.2 VO\n"
381  " Changes in sif.c to allow SIF without prompts and randoms.\n"
382  "\n"
383  "2009-09-28 1.5.3 VO\n"
384  " Change in micropet.c reading pixel z size.\n"
385  "\n"
386  "2009-12-01 1.5.4 VO\n"
387  " Added function imgSmoothMax().\n"
388  "\n"
389  "2009-12-10 1.5.5 VO\n"
390  " Tiny update in img_ana.c.\n"
391  "\n"
392  "2010-02-12 1.5.6 VO\n"
393  " Time zone is corrected in imgSetEcat7MHeader().\n"
394  "\n"
395  "2010-05-11 1.5.7 VO\n"
396  " imgUnitFromEcat7() tries more to identify units.\n"
397  "\n"
398  "2010-08-19 1.5.8 VO\n"
399  " ECAT7 main header field patient_birth_date is read correctly\n"
400  " whether is is in documented YYYYMMDD format or as seconds from\n"
401  " start of years 1970.\n"
402  "\n"
403  "2011-01-11 1.5.9 VO\n"
404  " Bug fixes in reading micropet images.\n"
405  "\n"
406  "2011-02-04 1.5.10 VO\n"
407  " Label unitless was previously not written in main header\n"
408  " when IMG data is written in ECAT7 format.\n"
409  "\n",fp);
410  fflush(fp);
411 }
412 
420  fprintf(fp,"/**\n\\mainpage %s %s %s\n\\section readme Readme\n<PRE>\n",LIB_NAME,LIB_VERSION,COPYRIGHT);
422  fprintf(fp,"\n</PRE> \n */\n");
423 }
424 
432  fprintf(fp,"/**\n\\page History\n\\section history History\n<PRE>\n");
434  fprintf(fp,"\n</PRE> \n */\n");
435 }
436 
442 void libtpcimgio_print_build(FILE *fp) {
443  fprintf(fp,"\n %s %s %s\n",LIB_NAME,LIB_VERSION,COPYRIGHT);
444  fprintf(fp,"\n Build %s %s\n",__DATE__,__TIME__);
445 #ifdef __STRICT_ANSI__
446  fprintf(fp,"\nANSI compatible build\n");
447 #endif
448 }
449 
455 void libtpcimgio_printdate(FILE *fp) {
457 }
458 
459 /*****************************************************************************/
460 
461 /*****************************************************************************/
462 
#define LIB_VERSION
Definition: libtpcimgiov.c:124
void libtpcimgio_print_build(FILE *fp)
Definition: libtpcimgiov.c:442
void libtpcimgio_print_readme(FILE *fp)
Definition: libtpcimgiov.c:135
void libtpcimgio_print_dhistory(FILE *fp)
Definition: libtpcimgiov.c:431
#define COPYRIGHT
Definition: libtpcimgiov.c:127
void libtpcimgio_print_history(FILE *fp)
Definition: libtpcimgiov.c:242
void libtpcimgio_printdate(FILE *fp)
Definition: libtpcimgiov.c:455
#define LIB_NAME
Definition: libtpcimgiov.c:121
void libtpcimgio_print_dreadme(FILE *fp)
Definition: libtpcimgiov.c:419