~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina5/tina-tools/README

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 TINA 5 README
  2 =============
  3 
  4 paul.bromiley@manchester.ac.uk 20/4/2005
  5 
  6 
  7 Contents
  8 --------
  9 
 10 
 11 1) What is TINA?
 12         1a) History
 13         1b) Authors
 14         1c) What does TINA stand for?
 15         1d) How do I know it works?
 16 2) Where do I get TINA?
 17 3) How do I compile the libraries?
 18         3a) Compatibility issues
 19                 3a.i) Backup Build System
 20         3b) Widget sets
 21         3c) Compiler warning messages
 22 4) How do I compile the toolkits?
 23         4a) Toolkits with different widget sets
 24 5) How do I write my own TINA code?
 25         5a) Writing new algorithmic functionality
 26         5b) Porting old TINA 4 code to TINA 5
 27 
 28 
 29 1) What is TINA?
 30 ----------------
 31 
 32 
 33 TINA (TINA Is No Acronym) provides a set of libraries for machine vision and
 34 image analysis research.  It is written in C primarily for use on GNU/Linux
 35 platforms, although it can also be compiled on MacOSX, Solaris, and (with some
 36 effort) MS Windows.  The code is split into two areas:
 37 
 38 tina-libs:      back-end code for memory management, image structure handling 
 39                 etc.
 40 
 41 tina-tools:     high-level algorithms, interface etc.
 42 
 43 Each of these areas contains a number of libraries with specific purposes:
 44 
 45 tina-libs:
 46 
 47 file:           input/output file handling
 48 geometry:       basic geometry functions
 49 image:          basic image processing functions
 50 math:           basic mathematical functions
 51 medical:        back-end functions for medical image analysis
 52 sys:            basic memory allocation functions
 53 vision:         back-end functions for machine vision
 54 
 55 tina-tools:
 56 
 57 draw:           basic display drawing
 58 gphx:           low-level interface to widget sets
 59 wdgts:          high-level interface to widget sets
 60 tlbase:         basic tools (image loading etc.)
 61 tlvision:       machine vision tools
 62 tlmedical:      medical tools.
 63 
 64 In order to use TINA, you must download both the tina-libs and tina-tools areas
 65 from our website, and compile both. This will produce a set of libraries in the
 66 libs subdirectories of both tina-libs and tina-tools. 
 67 
 68 The TINA libraries can be used in one of two ways.  They have been designed to
 69 be highly modular, allowing users to strip out parts of the functionality to
 70 use in their own code (under the terms of the licence).  However, they also
 71 include code for interfaces to the algorithms.  This code is in the form of a
 72 set of "tools", each of which appears as a window on the screen, and which
 73 collect together related functionality applicable to a certain task (loading
 74 single images, stereo image pairs, temporal sequences or medical image
 75 volumes; stereo vision; medical image segmentation; registration; blood flow
 76 analysis etc. etc. ).  In order to use this interface, you must build a
 77 "toolkit", a program that includes the tools you want to access.
 78 
 79 TINA is research software, continuously updated by a small group of core
 80 programmers at the University of Manchester, primarily for their own
 81 use. There is no "stable" release as such: the code in both the CVS repository
 82 and the tarballs is the latest version.  However, it is written with numerical
 83 stability and statistical validity in mind, and all new additions are
 84 thoroughly tested.
 85 
 86 
 87 1a) History
 88 -----------
 89 
 90 
 91 Development of the original X11 based versions of TINA started in 1989 at the
 92 Artificial Intelligence & Vision Research Unit (AIVRU) at the University of
 93 Sheffield (www.shef.ac.uk).  It was designed using experience gained in two
 94 previous versions with an aim to minimise the process of software maintenance
 95 and maximise code reuse.  Later versions of TINA were developed there and also
 96 at the Electronic Engineering Department of the University of Sheffield.  TINA
 97 became Open Source whilst being maintained by Electronic Engineering.  Since
 98 1997 TINA maintenance has been switched to Imaging Science and Biomedical
 99 Engineering (ISBE) (www.isbe.man.ac.uk) at the University of Manchester
100 (www.manchester.ac.uk).
101 
102 Until 2002 TINA was never explicitly funded as a project in its own
103 right. Rather it has been developed under numerous research grants and
104 collaborations as a framework to facilitate an ongoing co-ordinated research
105 effort into artificial vision.  TINA was originally conceived by AIVRU
106 researcher Stephen Pollard as a library of functions necessary for
107 stereo-based 3D machine vision.  John Porrill and Neil Thacker where also
108 involved at these early stages.  After this team broke up Neil Thacker
109 continued vision research within TINA at Electronic Engineering, and together
110 with Tony Lacey released TINA as Open Source.  In 1997 both Neil Thacker and
111 Tony Lacey moved to ISBE, from where TINA is now maintained.  Tony left for a
112 career in industry in 2004: today, Neil Thacker is the project leader for
113 TINA, and Paul Bromiley performs most of the day-to-day maintenance of the
114 code and website.
115 
116 
117 1b) Authors
118 -----------
119 
120 
121 Along the way a large number of people have contributed to TINA both at the
122 University of Sheffield and the University of Manchester. Their contributions
123 are never forgotten (and their code never lost). A full list can be found at
124 www.tina-vision.net/people.php.
125 
126 
127 1c) What does TINA stand for?
128 -----------------------------
129 
130 
131 Originally the acronym TINA stood for "there is no alternative", which was
132 true at the time.  Since then, several alternative meanings have been
133 suggested ("Thacker is not acceptable", "TINA is nearly accurate" etc.: most
134 of these were the result of a bad day at work). Today however, in a similar
135 style to acronym GNU, TINA stands for "TINA is no acronym". All previous
136 definitions have now been superseded!
137 
138 
139 1d) How do I know it works?
140 ---------------------------
141 
142 
143 For most software, the question of accuracy is non-existent: your word
144 processor either lets you prepare and print a document, or does not.  However,
145 for scientific software the question becomes more problematic because the
146 requirements are more extensive.  The results of any machine vision algorithm
147 will be dependent on the statistical validity and numerical stability (or what
148 might be called the "theoretical" and "implementation" aspects) of the
149 algorithm, and any failure to meet these two goals might not be obvious to the
150 user without extensive validation work.  Any attempt to justify the algorithms
151 used in TINA here would be largely pointless, since such justification can
152 only be meaningful after a suitable "negotiation of trust".  Therefore, I will
153 commence that process with three simple observations:
154 
155 a) All of the algorithms in TINA have been derived strictly within a context
156 of statistical validity: you won't find any active contour methods with
157 arbitrary image potential terms here! Therefore, the results of any algorithm
158 can be linked directly to the probability theoretic interpretation of the data
159 generation process.  This is not a guarantee that a specific algorithm will
160 work for your data. However, it is a guarantee that, if your data obeys the
161 underlying statistical assumptions relevant to the algorithm (as specified in
162 our published papers: see point b), the interpretation of the data provided by
163 the algorithm will be valid. In theory, your results can be linked directly
164 all the way back to the underlying axioms of mathematics.
165 
166 b) All of the algorithms in TINA have been used in our scientific research,
167 and thus subjected to peer-review in conference and journal publications.  We
168 make preprints of these publications available via our website at
169 www.tina-vision.net/docs/memos.php.  These papers contain details of our
170 in-house validation work.
171 
172 c) All of the algorithms in TINA are available as open-source software.
173 Through a combination of reading the memos, documentation, and code, you can
174 see exactly how a given algorithm works.  This facility is rarely afforded to
175 users of commercial machine vision or medical image analysis software. If you
176 think you have spotted a mistake in our work, get in touch! You will either
177 gain (admittedly limited) fame as an external contributor named on the TINA
178 website, or a very lengthy tutorial on statistics (e.g. if you mention the
179 words "Bayes Theory" within earshot of one of the core programmers).
180 
181 
182 2) Where do I get TINA?
183 -----------------------
184 
185 
186 The tina-libs and tina-tools code can be downloaded from our website
187 (www.tina-vision.net), either in the form of tarballs, or from the CVS
188 repository.  Go to the website and click on the "software" link. Then, either
189 download the two tarballs or use the CVS instructions given there.
190 
191 Tarballs: 
192 
193 Create a directory in /usr/local called "Tina5", and download both tarballs to
194 this directory. Then unzip (using gunzip tarball_name) and untar (using tar
195 -xvf tarball_name) both tarballs: this will create the two directories
196 tina-libs and tina-tools in the /usr/local/Tina5 directory
197 
198 CVS:
199 
200 Create a directory in /usr/local called "Tina5", then from within this
201 directory follow the instructions given on the website for anonymous access to
202 the CVS repository.
203 
204 At the end of this step, you should have two directories, called tina-libs and
205 tina-tools, in the /usr/local/Tina5 directory.
206 
207 
208 3) How do I compile the libraries?
209 ----------------------------------
210 
211 
212 Before you start, you must have
213 
214 autoconf 2.54   (or later)
215 automake 1.6.3  (or later)
216 libtool  1.4.2  (or later)
217 
218 installed on your system in order to build TINA: all reasonably recent Linux
219 distro's should install these by default.
220 
221 The basic approach is to cd into tina-libs, then type
222 
223 ./bootstrap.sh
224 ./configure
225 make
226 make install
227 
228 Then cd into tina-tools, and do the same.  If these steps complete without 
229 errors, you should end up with the compiled libraries in 
230 /usr/local/Tina5/tina-libs/libs and /usr/local/Tina5/tina-tools/libs.
231 
232 The full set of options provided by configure can be seen using;
233 
234 ./configure --help
235 
236 There are currently no specific tina-libs options (as of version 5.0rc0).
237 
238 There are a couple of other concerns though...
239 
240 
241 3a) Compatibility Issues
242 ------------------------
243 
244 
245 If the above instructions fail to work for your system, your first port of
246 call should be the WikiWiki page on our website.  Go to www.tina-vision.net,
247 click on "wiki" in the menu, and then click on "Tina5CompileGuide".  If your
248 system is listed, then it will provide work-arounds or full solutions for
249 known problems.  If not, pipe the outputs of ./configure and make to files and
250 e-mail them to me (paul.bromiley@man.ac.uk) and I will do my best to help you
251 out.  I would appreciate feedback on compilation for systems not listed on the
252 wiki page: it allows us to keep the instructions up-to-date.
253 
254 
255 3a.i) Backup Build System
256 -------------------------
257 
258 
259 As well as the main, automake and autoconf based build system, TINA has a
260 backup system of hand-written Makefiles (a legacy from the TINA4 days).  In
261 extremis, this can be used to work around serious compatibility issues.  It
262 still requires that you run autoconf, since it needs access to config.h, but
263 bypasses the automake-based makefiles entirely.  Read the inline documentation
264 in Tina5/tina-libs/tina-simple-build.sh for further information.
265 
266 
267 3b) Widgets
268 -----------
269 
270 
271 The tina-tools area contains interface code, arranged as a set of "tools" that
272 collect together related functionality for solving particular tasks (loading
273 single images, stereo image pairs, temporal sequences or medical image
274 volumes; stereo vision; medical image segmentation; registration; blood flow
275 analysis etc. etc.).  This interface code is dependent on external widget and
276 graphics libraries.  The tina-tools area contains wrappers for these libraries
277 (in the wdgts and gphx libraries), and is currently capable of using five
278 different widget sets:
279 
280 NULL:   (NULL widgets and NULL graphics) for testing or wrapping TINA code for
281         use in other programs: provides no interface.
282 
283 Tcl/Tk: pronounced "tickle-tk" (Tcl widgets and Tk graphics) for text-based
284         interfaces and client/server operation).
285 
286 Xview:  sometimes called openwindows, (Xv widgets and X11 graphics), which is
287         our usual mode of operation. However, the external xview libraries 
288         themselves do not work on 64-bit systems.
289 
290 Motif:  (Xm widgets and X11 graphics): an early replacement for xview, written
291         at a point when it looked like xview would be deprecated. Xview was 
292         revived due to popular demand, but it looks like the end of xview has 
293         finally arrived with the jump to 64-bit systems.
294 
295 Gdk/Gtk:stands for "the GIMP (Graphical Image Manipulation Program) toolkit",
296         since it was originally written exclusively for the GIMP, and is the
297         widget set of choice for modern linux software. It is anticipated that
298         this will become the default for TINA in the next few years, with the
299         motif widgets as a backup for older systems, and xview deprecated. Two
300         versions of Gtk (1.2 and 2.0) are currently in use: TINA compiles with
301         1.2, but there are a few issues with 2.0. We are working on fixing
302         this (by the time you read this, there may be experimental GTK 2
303         widgets in a directory next to the existing GTK 1.2 widgets).
304 
305 At the library compilation stage, you can compile as many of these as you
306 want. NULL widgets and graphics are always compiled.  If you want a graphical
307 interface to TINA, you must compile at least one of xview, Motif or Gtk.
308 
309 In order to compile the TINA widgets and graphics libraries you want to use,
310 you must ensure that the external libraries they depend on are installed.  A
311 complete list of such packages for SuSE 9.2 is:
312 
313 For gtk1.2 and gtk2
314 
315 fontconfig-2.2.96.20040728-9.i586.rpm
316 fontconfig-devel-2.2.96.20040728-9.i586.rpm
317 pkgconfig-0.15.0-199.i586.rpm
318 atk-1.6.0-4.1.i586.rpm
319 atk-devel-1.6.0-4.1.i586.rpm
320 atk-doc-1.6.0-4.1.i586.rpm
321 pango-1.4.1-3.1.i586.rpm
322 pango-devel-1.4.1-3.1.i586.rpm
323 pango-doc-1.4.1-3.1.i586.rpm
324 glib-1.2.10-589.i586.rpm
325 glib-devel-1.2.10-589.i586.rpm
326 glib2-2.4.6-5.1.i586.rpm
327 glib2-devel-2.4.6-5.1.i586.rpm
328 glib2-doc-2.4.6-5.1.i586.rpm
329 gtk-1.2.10-882.1.i586.rpm
330 gtk-devel-1.2.10-882.1.i586.rpm
331 gtk-engines-0.12-960.1.i586.rpm
332 gtk2-2.4.9-10.1.i586.rpm
333 gtk2-devel-2.4.9-10.1.i586.rpm
334 gtk2-doc-2.4.9-10.1.i586.rpm
335 gtk2-engines-2.2.0-400.1.i586.rpm
336 
337 For motif:
338 
339 openmotif-2.2.3-6.1.i586.rpm
340 openmotif-demo-2.2.3-6.1.i586.rpm
341 openmotif-devel-2.2.3-6.1.i586.rpm
342 openmotif-libs-2.2.3-6.1.i586.rpm
343 openmotif21-libs-2.1.30MLI4-123.1.i586.rpm
344 
345 For xview:
346 
347 xorg-x11-devel-6.8.1-15.4.i586.rpm
348 xview-3.2p1.4-706.1.i586.rpm
349 xview-devel-3.2p1.4-706.1.i586.rpm
350 xview-devel-examples-3.2p1.4-706.1.i586.rpm
351 
352 To get the textsw package (optional for xview):
353 
354 olvwm-4.1-706.1.i586.rpm
355 
356 Version numbers may be different for your own distro.
357 
358 Then, at the stage when you type ./configure in the tina-tools area, the 
359 last part of the output will be a list of which external widget libraries
360 autoconf was able to find.  This search is run by m4 scripts, and targets
361 particular locations, so may not find the external widget libraries.
362 Typical output will look like this:
363 
364 >tinatool configuration complete for i686-pc-linux-gnu.
365 >
366 > Source directory:        .
367 > Installation directory:     /usr/local/Tina5/tina-tools
368 > C compiler:           gcc
369 >
370 > tina-libs headers:       /usr/local/Tina5/tina-tools/../tina-libs
371 > tina-libs libraries:      /usr/local/Tina5/tina-tools/../tina-libs/lib
372 >
373 > X11 headers:          -I/usr/X11R6/include
374 > X11 libraries:         -L/usr/X11R6/lib
375 
376 > GTK flags:          -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2
377 > -I/usr/lib/glib/include -I/usr/X11R6/include
378 > GTK libraries:        -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk
379 > -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm
380 >
381 > Xview headers:         -I/usr/openwin/include
382 > Xview libraries:        -L/usr/openwin/lib -lxview -lolgx
383 >
384 > Motif headers:
385 > Motif libraries:        -lXm -lXp -lXext
386 >
387 > Tcl (>= Version 8) NOT FOUND  Warning
388 >
389 > Configuration successful! Now type 'make' to build the libraries and then
390 > 'make install' to install the libraries into the prefix location.
391 
392 In this example, the X11, xview and Gtk libraries and includes are
393 found. The Motif lines show that the libraries are found but not the
394 headers: watch out for this situation, as it means that the Motif widgets
395 will not be compiled. The Tcl libraries and headers are not found at all,
396 and so again will not be compiled.
397 
398 If the external widget libraries you want to use are not found, and you 
399 know that they are installed on your system (this will probably be the case 
400 for 64 bit systems) then you have to specify the location on the ./configure 
401 line. Possible arguments are (these should be typed on one line: they have
402 been split up here for clarity):
403 
404 ./configure
405 --with-gtk-prefix=              (location of the gtk installation)
406 --with-motif-includes=          (location of the motif headers)
407 --with-motif-libraries=         (location of the motif libraries)
408 --with-tcl=                     (location of the tcl installation)
409 --with-tk=                      (location of the tk installation)
410 --with-xview-includes=          (location of the xview headers)
411 --with-xview-libraries=         (location of the xview libraries)
412 
413 You can find these by browsing through the inlined documentation in the m4 
414 scripts (in tina-tools/m4). Typical locations on a 64-bit system will be:
415 
416 ./configure
417 --with-xview-libraries=/usr/openwin/lib64
418 --with-xview-includes=/usr/openwin/include
419 --with-gtk-prefix=/opt/gnome
420 --with-tk=/usr/lib64
421 --with-tcl=/usr/lib64
422 --with-motif-libraries=/usr/X11/lib64/Xm
423 --with-motif-includes=/usr/X11/lib64/Xm
424 
425 They may be different on your machine.  The two xview lines are the lib64 and 
426 include directories in the openwin directory (search for openwin). The motif 
427 paths can be found by searching for Xm.h. The Tcl and Tk paths can be found 
428 by searching for tclconfig.sh and tkconfig.sh. The gtk prefix can be found 
429 by searching for gtkConfig.sh
430 
431 Add these to the configure line, and check the report: as long as full paths
432 are given for both the includes and headers for the widgets and graphics you
433 want to compile, you will be OK. Then "make" and "make install": now you
434 should find that the tina-tools/lib directory contains libraries called e.g.
435 libtinatoolGphxGdk.a and libtinatoolWdgtsGtk.a (for gtk widgets and gdk
436 graphics).
437 
438 
439 3c) Compiler warning messages
440 -----------------------------
441 
442 
443 When you compile TINA you will notice a large number of compiler warnings.
444 They are the legacy of the 20-year development history of TINA: old coding
445 practices that are now considered unacceptable.  One example is the 
446 assumption that a pointer and an integer occupy the same amount of memory:
447 this is true on 32-bit systems, but not in general on 64-bit systems.
448 We are currently fixing these warnings: however, none of them have been 
449 found to affect the algorithmic functionality.
450 
451   
452 4) How do I compile the toolkits?
453 ---------------------------------
454 
455 
456 At the end of step 3 you should have built the TINA libraries in both 
457 tina-libs and tina-tools.  The algorithmic functionality they provide could,
458 in theory, be used in your own code.  However, 99% of users will want to use
459 the interface included with the libraries.  These interfaces are called 
460 "toolkits", and must be built independently of the libraries.  Three examples
461 are included in the Tina5/toolkits area: they are called example, example2, 
462 and mri_analysis.  
463 
464 The toolkit of interest to most users will be example2: this includes all 
465 tools available at the time of writing i.e. all of the TINA functionality.
466 If you don't intend to do any programming, this is the one you should build.
467 Automatic building and installation is not included (yet) for historical 
468 reasons: out scientific users expect to be able to build the libraries 
469 independently, and so toolkit building must be performed after the library 
470 build.  To build this toolkit, follow the instructions below.  You can then 
471 make a link to the example2 executable in /usr/local/bin, allowing you to 
472 run tinaTool from the command line.  An icon is included in the example2 
473 directory, should you wish to set up a desktop icon.
474 
475 To compile one of the example toolkits, cd into example, example2, or
476 mri_analysis, and type make: this will build the tinaTool program, which you
477 can then run.  The example toolkit is very basic, but can be used as a
478 starting point for building your own toolkit.  The example2 toolkit include
479 all available TINA functionality. The mri_analysis toolkit contains the basic
480 medical images analysis functions: download the MRI image sequences from the
481 image library on our website, read the TINA 5 User's Guide (also on the
482 website) to find out how the tools work, and start experimenting with the
483 algorithms!
484 
485 Since TINA is research software, it has been designed to allow users to build
486 their own toolkit for their current project, including only the tools
487 required.  Most users will therefore eventually want to write their own
488 toolkit.  This is relatively simple: you just have to copy one of the example
489 toolkits to a project area (e.g. /home/my_user_name/my_tina_project), open
490 tinaTool.c in an editor, and add a button for the tool you want to main(), and
491 a button procedure function to call the tool.  For example, if you wanted to
492 access the coreg tool, you would add a button to main() using:
493 
494 tw_button("Coreg", coreg_tool_proc, NULL);
495 
496 and then the button procedure coreg_tool_proc anywhere above main
497 
498 static void coreg_tool_proc()
499 {
500     coreg_tool(250, 250);
501 }
502 
503 Finally, you have to add the header files that contain the prototypes for the 
504 tools you want to include. Prototypes for all tool functions are contained in
505 
506 #include <tinatool/tlbase/tlbaseDef.h>
507 #include <tinatool/tlbase/tlbasePro.h>
508 
509 for the basic tools (input/output etc),
510 
511 #include <tinatool/tlbase/tlvisDef.h>
512 #include <tinatool/tlbase/tlvisPro.h>
513 
514 for the machine vision tools, and
515 
516 #include <tinatool/tlbase/tlmedDef.h>
517 #include <tinatool/tlbase/tlmedPro.h>
518 
519 for the medical image analysis tools.  Since the coregistration tool is in the
520 medical tools library, you would add the last two lines to the top of your
521 tinaTool.c file (alongside the other header file include statements), or you
522 could just add all six.  The TINA Users guide on the website
523 (www.tina-vision.net/software.php) contains a complete list of available
524 tools.
525 
526 After building and running tinaTool, you will see a new button in the main
527 tool called "coreg".  Pressing this calls the button procedure, which in turn
528 calls the coreg_tool function from the libraries.
529 
530 
531 4a) Toolkits with different widget sets
532 ---------------------------------------
533 
534 
535 In order to compile toolkits with various widget sets, I recommend that you
536 use a simple Makefile.  The example2 toolkit directory in tina-tools/example
537 contains an example: it allows you to switch simply between the different 
538 available widget sets, although you have to set some paths here by hand.  The
539 Makefile is called Makefile_tina: rename it to Makefile (after backing-up the 
540 existing Makefile) to begin this process.
541 
542 In general, a simple Tina5 makefile should look something like the following
543 (the filename should be "Makefile"):
544 
545 ##
546 # Makefile for Tina5
547 #
548 
549 TINALIBS     = -ltinaMedical -ltinaVision -ltinaImage -ltinaFile -ltinaGeom 
550                -ltinaMath -ltinaSys 
551 TINATOOLLIBS = -ltinatoolTlMed -ltinatoolTlvision -ltinatoolTlBase 
552                -ltinatoolDraw -ltinatoolWdgtsGtk -ltinatoolGphxGdk 
553 XLIBS        = -lgtk -lgdk
554 SYSLIBS      = -lm 
555 CFLAGS       = -g -pipe -DHAVE_CONFIG_H -DOWTOOLKIT_WARNING_DISABLED
556 INCLUDES     = -I./ -I/usr/local/Tina5/tina-tools 
557                -I/usr/local/Tina5/tina-libs -I/usr/openwin/include
558 LDFLAGS      = -L/usr/local/Tina5/tina-libs/lib -L/usr/local/Tina5/tina-tools/lib 
559                $(TINATOOLLIBS) $(TINALIBS) -L/opt/gnome/lib  $(XLIBS) $(SYSLIBS) 
560 OFILES = 
561 
562 .c.o:
563              gcc $(CFLAGS) $(INCLUDES) -c -o $@ $*.c
564 
565 tinaTool: tinaTool.o $(OFILES)
566              gcc -o $@ $(CFLAGS) tinaTool.o $(OFILES) $(LDFLAGS)
567 
568 # ---------
569 # Household
570 # ---------
571 
572 clean : 
573           \rm *.o
574 
575 
576 There are eight lines that set up various locations.  TINALIBS and TINATOOLS
577 list the libraries to be included from the tina-liabs and tina-tools lib 
578 directories.  These must be in order, and the only changes you should need
579 to make to the above are to the Wdgts and Gphx libraries: these choose the 
580 widget set you will use, and there are three possible combinations of interest 
581 to the majority of users:
582 
583 -ltinatoolWdgtsXm -ltinatoolGphxX11  :  Motif widgets
584 -ltinatoolWdgtsXv -ltinatoolGphxX11  :  Xview widgets
585 -ltinatoolWdgtsGtk -ltinatoolGphxGdk :  Gtk widgets
586 
587 The XLIBS line selects the external widget set libraries used: again there are 
588 three possible selections:
589 
590 XLIBS = -lXm -lX11             : Motif widgets
591 XLIBS = -lxview -lolgx -lX11   : Xview widgets
592 XLIBS = -lgtk -lgdk            : Gtk widgets
593 
594 I always call this line XLIBS, although it should be named for the libraries
595 you want to install. 
596 
597 The CFLAGS line passes arguments to the compiler: for most Linux systems, only
598 the first is of interest: -g adds debugging information, making your executable
599 larger, but providing the information necessary for using GDB or DDD for 
600 debugging.  Add -0, -02 or -03 for various levels of optimisation, making the 
601 executable run faster, but making debugging more difficult.
602 
603 Finally, the INCLUDES and LDFLAGS lines set paths for the libraries you have 
604 specified above.  These should look something like:
605 
606 INCLUDES = -I./ -I/usr/local/Tina5/tina-tools -I/usr/local/Tina5/tina-libs
607 -I/usr/openwin/include
608 LDFLAGS = -L/usr/local/Tina5/tina-libs/lib -L/usr/local/Tina5/tina-tools/lib
609 $(TINATOOLLIBS) $(TINALIBS) -L/usr/include/gtk-1.2 $(XLIBS) $(SYSLIBS)
610 
611 for gtk, 
612 
613 INCLUDES = -I./ -I/usr/local/Tina5/tina-tools -I/usr/local/Tina5/tina-libs
614 -I/usr/openwin/include
615 LDFLAGS = -L/usr/local/Tina5/tina-libs/lib -L/usr/local/Tina5/tina-tools/lib
616 $(TINATOOLLIBS) $(TINALIBS) -L/usr/openwin/lib -L/usr/X11/lib $(XLIBS)
617 $(SYSLIBS)
618 
619 for xview, and 
620 
621 INCLUDES = -I./ -I/usr/local/Tina5/tina-tools -I/usr/local/Tina5/tina-libs 
622 -I/usr/openwin/include
623 LDFLAGS = -L/usr/local/Tina5/tina-libs/lib -L/usr/local/Tina5/tina-tools/lib 
624 $(TINATOOLLIBS) $(TINALIBS) -L/usr/X11/lib $(XLIBS) $(SYSLIBS) 
625 
626 for Motif.  
627 
628 The library and include locations will have to be set for your machine, but 
629 should be fairly standard. Just two points to be aware of: the locations will 
630 be .../lib64 rather than .../lib on 64-bit systems, and notice that you refer 
631 to libraries in shorthand, so libxview.so becomes lxview (suffix stripped, 
632 and l replacing lib).
633 
634 The OFILES line refers to object files you wish to compile.  If you are 
635 compiling one of the example toolkits i.e. the only .c file in the current
636 directory is tinaTool.c, then leave it empty.  If you start writing or adapting
637 your own Tina code (see below) and have a directory with other c files in it, 
638 add my_c_file.o to this line for every my_c_file.c you want to compile.
639 
640 Finally, type "make" in the directory containing the tinaTool.c file and the 
641 Makefile: if all goes well, you should end up with a "tinaTool" executable that
642 you can run.
643 
644 
645 5) How do I write my own TINA code?
646 -----------------------------------
647 
648 
649 TINA provides the ideal environment for machine vision or medical image
650 analysis researchers to develop their own code.  All of the basic functionality
651 (memory allocation, image representation, basic image processing, geometry, 
652 maths etc. etc.) is already present, allowing for rapid code development.  In
653 addition, the long development history has resulted in highly stable code.
654 
655 
656 5a) Writing new algorithmic functionality
657 -----------------------------------------
658 
659 
660 In order to start developing new algorithmic functionality, set up a project
661 area with a simple Makefile and a tinaTool.c file (you can use the example
662 one provided in the tina-tools area).  Then, there are two possible options:
663 writing new files, or adapting those already present in the libraries.
664 
665 If you are adapting files from the libraries, copy the C files plus their
666 file-level H files to your project area. Then build a copy of the header
667 file directory structure in your project area: put the inctw script
668 in your project area, and run it. The script can be found in the 
669 tina-tools/toolkits/example2 directory. This sets up a copy of the
670 header directory system, and soft-links from the relevant directories to the
671 header files in your project area, ensuring that when you compile TINA it
672 links in the local header files in place of the ones in the libraries. Then
673 you can get on with your coding: remember to add prototypes to your project
674 area header files if you add new functions.
675 
676 Secondly, if you are writing new C files, you can just work in a project area
677 as usual: the libraries won't be linking to your code, so the header file
678 system doesn't affect you. However, if in the future you will be putting
679 your code back into the libraries, you should think about where it would go
680 and divide up your code accordingly.
681 
682 
683 
684 5b) Porting old TINA 4 code to TINA 5
685 -------------------------------------
686 
687 
688 Several major changes were made to the TINA libraries in the move from
689 version 4 to version 5. In particular, we have a new header file system, and 
690 a new version of the sequence tool. The header file structure for TINA4 was 
691 a complete mess (and one of the common criticisms of TINA), so everyone ended 
692 up including tina_all.h and thus completely bypassing the whole point of header
693 files. Therefore, we have put a formal structure in place, which makes the 
694 code much cleaner, easier to write, and easier to understand.
695 
696 The code is divided into three layers: library, group, and file. For example,
697 the function coreg_auto (which performs coregistration) is in the file 
698 tlmedCoreg_auto.c, so the group is tlmedCoreg (the group for coregistration 
699 functions) and the library is tlmed (the library for medical functions).  
700 The tl tells you that it is in the tina-tools area, rather than tina-libs.
701 Every C file has its own H file for prototypes of all non-static functions in 
702 that C file. The file level H file must be in the same directory as its C
703 file. Other C files in the same group should include that "file level" H file 
704 when needed. Every group has its own "group level" header files: in this
705 example tlmed_CoregPro.h and tlmed_coregDef.h. The Pro file includes all of 
706 the file level H files for that group, and the Def file contains all 
707 definitions (structures etc) for that group. C files in other groups should 
708 include the group level header files when needed. Finally, there are library 
709 level header files tlmedPro.h and tlmedDef.h: these include all of the group 
710 level Pro and Def files for that library. C files in other libraries should 
711 include the library-level header files when needed. Finally, the whole of 
712 TINA is split into the tina-tools, which is front end and algorithmic code,
713 and tina-libs, which is lower-level code (memory allocation, handling 
714 structures etc.). It may seem a bit complicated, but when you get used to it 
715 this system allows you to know immediately which H files you should be 
716 including in your own C files, making coding much faster without the need for 
717 a tina-all.h file.
718 
719 The changes in terms of locations of functions are mostly limited to the 
720 sequence tool: some functions (such as get_seq_ptr) have changed their names. 
721 The easiest way to port your code is to put it into a project area, strip out 
722 all include statements, and compile. Then, start the lxr code browser web 
723 page, and search for each function that generates "function not defined" 
724 errors: once you know which C file the function is in, you can work out which 
725 H file to include. These will be only library-level header files if you 
726 never intend to put your code back into the libraries.
727 
728 Finally, if there are any functions whose names have changed, search through 
729 the libraries that correspond to the relevant area in TINA4. For example, if 
730 you are including get_seq_ptr, you know it comes from the sequence tool: 
731 search the sequence tool code (group tlbaseSeq for the tina-tools level stuff 
732 and imgSeq for the tina-libs level stuff) for a function that does the same 
733 job (in this case get_seq_ptr). It seems long-winded at first, but don't 
734 despair: after a couple of hours of this, you can do it from memory without 
735 using the code browser.
736 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.