00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 #include <stdio.h>
00118 #include "libtpcimgiov.h"
00119
00121 #define LIB_NAME "libtpcimgio"
00122
00124 #define LIB_VERSION "1.5.10"
00125
00127 #define COPYRIGHT "(c) 2005-2011 by Turku PET Centre"
00128
00129
00135 void libtpcimgio_print_readme(FILE *fp){
00136 fputs("\n"
00137 LIB_NAME" "LIB_VERSION" "COPYRIGHT"\n"
00138 "\n"
00139 "Build "__DATE__" "__TIME__"\n"
00140 "\n"
00141 "\n"
00142 "PET Image IO library\n"
00143 "-------------------------------------------------------------------------------\n"
00144 "\n"
00145 "2007-03-21\n"
00146 "Turku PET Centre\n"
00147 "\n",fp);
00148 fputs("Libtpcimgio is distributed under the GNU Lesser General Public Licence\n"
00149 "http://www.gnu.org/licenses/lgpl.html\n"
00150 "More information on open source licences: http://www.opensource.org/\n"
00151 "\n"
00152 "Description\n"
00153 "-------------------------------------------------------------------------------\n"
00154 "\n"
00155 "The libtpcimgio library is a collection of commonly used C files in Turku PET Centre\n"
00156 "for image file input and output procedures. Libtpcimgio library supports Analyze 7.5,\n"
00157 "Ecat 6.x, Ecat 7.x and partly interfile formats.\n"
00158 "\n",fp);
00159 fputs("List of files\n"
00160 "-------------------------------------------------------------------------------\n"
00161 "\n"
00162 "include/ - Includes all the header files for the .c files\n"
00163 "\n"
00164 "Makefile - The makefile\n"
00165 "\n"
00166 "** .c files **\n"
00167 "\n"
00168 "analyze.c - reading and writing Analyze 7.5 image files.\n"
00169 "\n"
00170 "ecat63ml.c - Procedures for ECAT 6.3 matrix list.\n"
00171 "\n",fp);
00172 fputs("ecat63p.c - Printing ECAT 6.3 headers.\n"
00173 "\n"
00174 "ecat63r.c - Reading ECAT 6.3 files.\n"
00175 "\n"
00176 "ecat63w.c - Writing ECAT 6.3 files.\n"
00177 "\n"
00178 "ecat7ml.c - Procedures for ECAT 7.x matrix list.\n"
00179 "\n"
00180 "ecat7p.c - Printing ECAT 7.x headers.\n"
00181 "\n"
00182 "ecat7h.c - Edit ECAT 7.x headers.\n"
00183 "\n"
00184 "ecat7r.c - Reading ECAT 7.x files.\n"
00185 "\n",fp);
00186 fputs("ecat7w.c - Writing ECAT 7.x files.\n"
00187 "\n"
00188 "img.c - Procedures for 4D image data (common to all image file formats).\n"
00189 "\n"
00190 "img_ana.c - Subprocedures for reading/writing Analyze 7.5 files to/from IMG.\n"
00191 "\n"
00192 "img_e63.c - Subprocedures for reading/writing ECAT 6.3 files to/from IMG.\n"
00193 "\n"
00194 "img_e7.c - Subprocedures for reading/writing ECAT 7 files to/from IMG.\n"
00195 "\n"
00196 "imgdecay.c - Decay correction, isotope codes, and half-lives.\n"
00197 "\n"
00198 "imgfile.c - Main procedures for IMG read/write.\n"
00199 "\n",fp);
00200 fputs("imgmax.c - Procedures for searching IMG min and max value.\n"
00201 "\n"
00202 "imgunit.c - Procedures for working with IMG calibration unit.\n"
00203 "\n"
00204 "interfile.c - Reading Interfile headers.\n"
00205 "\n"
00206 "micropet.c - Reading Inveon images.\n"
00207 "\n"
00208 "sif.c - Routines for Scan Information Files (SIF).\n"
00209 "\n"
00210 "sifio.c - Functions for reading and writing SIF format files.\n"
00211 "\n"
00212 "vol.c - Procedures for 3D image volume data (no time information).\n"
00213 "\n"
00214 "weight.c - Functions for setting weight factors based on SIF.\n"
00215 "\n",fp);
00216 fputs("libtpcimgio.c - Program for printing Readme and History information, and for\n"
00217 " testing the library functions.\n"
00218 "\n"
00219 "libtpcimgiov.c- Version information for this library.\n"
00220 "\n"
00221 "\n"
00222 "Using the library\n"
00223 "-------------------------------------------------------------------------------\n"
00224 "\n"
00225 "The program that uses the library should include the .h file it needs.\n"
00226 "Example:\n"
00227 " \\#include <img.h>\n"
00228 "\n"
00229 "libtpcimgio depends on libtpcmisc.\n"
00230 "Example:\n"
00231 " gcc myprog.c -ltpcimgio -ltpcmisc\n"
00232 "\n",fp);
00233 fflush(fp);
00234 }
00235
00242 void libtpcimgio_print_history(FILE *fp) {
00243 fputs("2005-01-04 1.0.0 Vesa Oikonen, Calle Laakkonen, Riku Klén, Jarkko Johansson\n"
00244 " Former libpet, the common PET C library, has been divided up in smaller\n"
00245 " sublibraries that each handle a specific task. This library includes functions\n"
00246 " utilised in image file input and output procedures. \n"
00247 "\n"
00248 "2005-03-03 1.0.0 Jarkko Johansson \n"
00249 " imgproc.[c/h] moved to libtpcimgp library\n"
00250 "\n"
00251 "2005-04-05 1.0.1 (krs) Roman Krais\n"
00252 " interfile.c added (for reading interfile headers)\n"
00253 "\n"
00254 "2005-04-25 1.1.0 Jarkko Johansson\n",fp);
00255 fputs(" History and Readme files included in new print functions:\n"
00256 " libtpcimgio_print_readme(FILE *fp);\n"
00257 " libtpcimgio_print_history(FILE *fp);\n"
00258 " libtpcimgio_print_dreadme(FILE *fp);\n"
00259 " libtpcimgio_print_dhistory(FILE *fp);\n"
00260 " libtpcimgio_print_build(FILE *fp);\n"
00261 " in file libtpcimgio.c. Update the the Readme and History\n"
00262 " there.\n"
00263 "\n"
00264 " Compiled in Windows with MinGW.\n"
00265 "\n"
00266 "2005-05-04 1.1.0 JJ\n"
00267 " Minor changes in file sifio.c.\n"
00268 "\n"
00269 "2005-08-01 1.1.1 CL/JJ\n",fp);
00270 fputs(" Changed image loading/writing functions fname to const,\n"
00271 " and extern int VOL_TEST to int VOL_TEST.\n"
00272 "\n"
00273 "2005-10-10 1.1.2 CL\n"
00274 " imgWriteAnalyze() now writes only 1 frame at a time,\n"
00275 " conserving memory.\n"
00276 "\n"
00277 "2005-11-21 1.1.3 VO\n"
00278 " lambda2factor() now calculates correctly when removing\n"
00279 " decay correction considering frame lengths.\n"
00280 "\n"
00281 "2005-12-12 1.1.4 VO\n"
00282 " imgReadAnalyze() sets img.isotopeHalflife,\n"
00283 " if isotope is found in SIF.\n"
00284 "\n",fp);
00285 fputs("2006-10-31 1.1.5 VO\n"
00286 " Added function imgUnitId().\n"
00287 " Fixed a timezone bug with ECAT7 files.\n"
00288 "\n"
00289 "2006-12-28 1.1.6 VO\n"
00290 " Changes in identification of isotope codes.\n"
00291 "\n"
00292 "2007-02-02 1.2.0 VO\n"
00293 " Additions in IMG structure, and subsequent changes in i/o functions.\n"
00294 " Isotope and halflife related functions are relocated into libtpcmisc.\n"
00295 " This library is now independent of libtpcimgp.\n",fp);
00296 fputs(" IMG min and max search functions are relocated here.\n"
00297 " User_process_code is read/written with ECAT7 and ECAT6.3 files.\n"
00298 " Patient_id is read/written with ECAT7 and ECAT6.3 files.\n"
00299 " Study_description is read/written with ECAT7 and ECAT6.3 files.\n"
00300 " X, y and z resolution is read/written with ECAT7 images.\n"
00301 " Prompts and randoms (delayed) are read/written with ECAT7 and\n"
00302 " ECAT6.3 sinograms and read from SIF with Analyze 7.5.\n",fp);
00303 fputs(" Changes in identifying and processing calibration units.\n"
00304 "\n"
00305 "2007-02-11 1.2.1 VO\n"
00306 " Addition in IMG structure.\n"
00307 " Deleted imgmsg.h. Set IMG.statmsg using imgSetStatus().\n"
00308 "\n"
00309 "2007-02-27 1.2.2 VO\n"
00310 " Bug corrections.\n"
00311 "\n"
00312 "2007-03-13 1.2.3 VO\n"
00313 " Added ECAT matrix list functions and error messages.\n"
00314 " ECAT 6.3 header print format changed.\n"
00315 "\n",fp);
00316 fputs("2007-03-21 1.2.4 VO\n"
00317 " Changes to make easier to write ECAT7 2D files.\n"
00318 "\n"
00319 "2007-03-25 1.2.5 VO\n"
00320 " Addition of functions for reading and writing ECAT and Analyze\n"
00321 " format one frame at a time.\n"
00322 "\n"
00323 "2007-04-03 1.3.0 VO\n"
00324 " Added support for ECAT7 polar maps.\n"
00325 " Information for polar map added to IMG struct.\n"
00326 "\n"
00327 "2007-07-17 1.3.1 Harri Merisaari\n"
00328 " Modified for optional ANSI compatibility.\n"
00329 "\n"
00330 "2007-09-10 1.3.2 VO\n"
00331 " Bug correction in setting error messages.\n"
00332 " Bug correction in reading some too long header text fields.\n"
00333 "\n"
00334 "2007-09-10 1.3.3 VO\n"
00335 " Return value of localtime() is always checked.\n"
00336 "\n",fp);
00337 fputs("2007-09-11 1.3.4 VO\n"
00338 " Corrected a bug affecting versions 1.3.1 -1.3.3:\n"
00339 " Analyze and ECAT files could have been mixed if in same folder.\n"
00340 "\n"
00341 "2007-09-12 1.3.5 VO\n"
00342 " Corrected a bug affecting frame-by-frame reading of\n"
00343 " ECAT7 2D image files.\n"
00344 "\n"
00345 "2008-07-07 1.3.6 VO\n"
00346 " Image decay correction functions return error if frame times\n"
00347 " are missing.\n"
00348 " Assumes that Analyze 7.5 images are corrected for decay when\n"
00349 " that information is not found in header file.\n"
00350 "\n"
00351 "2008-07-11 1.3.7 VO\n"
00352 " Added function sifModerate().\n"
00353 "\n"
00354 "2008-07-14 1.3.8 VO\n"
00355 " Added function imgAllocateWithHeader().\n"
00356 "\n"
00357 "2008-07-24 1.3.9 VO\n"
00358 " Added functions ecat7EditMHeader(), ecat7EditSHeader(),\n"
00359 " ecat7EditVHeader(), imgSetUnit(), and ecat7PrintSubheader().\n"
00360 "\n"
00361 "2008-09-02 1.4.0 VO\n"
00362 " Default ECAT backup extension changed to .bak.\n"
00363 "\n"
00364 "2008-10-03 1.4.1 VO\n"
00365 " Accepts certain Analyze formats with 32 bit pixel values.\n"
00366 "\n"
00367 "2008-10-09 1.4.2 VO\n"
00368 " Accepts more Analyze formats with 32 bit pixel values (PVElab).\n"
00369 "\n",fp);
00370 fputs("2008-11-06 1.4.3 VO\n"
00371 " Bug correction in reading ECAT 6.3 files.\n"
00372 "\n"
00373 "2009-02-17 1.5.0 VO\n"
00374 " Added definitions for Siemens Inveon in img.h.\n"
00375 " Added micropet.c and .h for reading Siemens Inveon images.\n"
00376 "\n"
00377 "2009-02-25 1.5.1 VO\n"
00378 " Changes in micropet.c and .h to allow reading CT images.\n"
00379 "\n"
00380 "2009-04-06 1.5.2 VO\n"
00381 " Changes in sif.c to allow SIF without prompts and randoms.\n"
00382 "\n"
00383 "2009-09-28 1.5.3 VO\n"
00384 " Change in micropet.c reading pixel z size.\n"
00385 "\n"
00386 "2009-12-01 1.5.4 VO\n"
00387 " Added function imgSmoothMax().\n"
00388 "\n"
00389 "2009-12-10 1.5.5 VO\n"
00390 " Tiny update in img_ana.c.\n"
00391 "\n"
00392 "2010-02-12 1.5.6 VO\n"
00393 " Time zone is corrected in imgSetEcat7MHeader().\n"
00394 "\n"
00395 "2010-05-11 1.5.7 VO\n"
00396 " imgUnitFromEcat7() tries more to identify units.\n"
00397 "\n"
00398 "2010-08-19 1.5.8 VO\n"
00399 " ECAT7 main header field patient_birth_date is read correctly\n"
00400 " whether is is in documented YYYYMMDD format or as seconds from\n"
00401 " start of years 1970.\n"
00402 "\n"
00403 "2011-01-11 1.5.9 VO\n"
00404 " Bug fixes in reading micropet images.\n"
00405 "\n"
00406 "2011-02-04 1.5.10 VO\n"
00407 " Label unitless was previously not written in main header\n"
00408 " when IMG data is written in ECAT7 format.\n"
00409 "\n",fp);
00410 fflush(fp);
00411 }
00412
00419 void libtpcimgio_print_dreadme(FILE *fp) {
00420 fprintf(fp,"/**\n\\mainpage %s %s %s\n\\section readme Readme\n<PRE>\n",LIB_NAME,LIB_VERSION,COPYRIGHT);
00421 libtpcimgio_print_readme(fp);
00422 fprintf(fp,"\n</PRE> \n */\n");
00423 }
00424
00431 void libtpcimgio_print_dhistory(FILE *fp) {
00432 fprintf(fp,"/**\n\\page History\n\\section history History\n<PRE>\n");
00433 libtpcimgio_print_history(fp);
00434 fprintf(fp,"\n</PRE> \n */\n");
00435 }
00436
00442 void libtpcimgio_print_build(FILE *fp) {
00443 fprintf(fp,"\n %s %s %s\n",LIB_NAME,LIB_VERSION,COPYRIGHT);
00444 fprintf(fp,"\n Build %s %s\n",__DATE__,__TIME__);
00445 #ifdef __STRICT_ANSI__
00446 fprintf(fp,"\nANSI compatible build\n");
00447 #endif
00448 }
00449
00455 void libtpcimgio_printdate(FILE *fp) {
00456 libtpcimgio_print_build(fp);
00457 }
00458
00459
00460
00461
00462