Developer's Manual
PicSearch -- Interactive Picture Searcher
http://
Last modified
.
Contents
1. Introduction
2. Environment and setting up the system
3. Files
4. Maintenance of PicSearch
This document explains how to install PicSearch application and how
to maintain and develop the system. This document covers the
version 1.0 of the system. PicSearch is designed to work in environments
such as Linux, UNIX and MS Windows 95.
PicSearch is freely available under the
GNU General Public License.
2.1. Operating systems
So far we have been able to run the system using Linux, Digital UNIX,
Windows95 and Windows NT. In the following, we specifically point out which
actions apply only to Linux and other Unix systems and which apply only
to Windows.
2.2. Software components
To run PicSearch you need a set of external software components not
part of PicSearch itself. In Windows to develop the system you will
also need a decent C++ compiler and the source files of PicSearch.
In Unix systems the PicSearch system has to be compiled in any case.
To run PicSearch your system must have the Tcl/Tk package,
versions 7.5 and 4.1 respectively. There should be no reason why any
more recent versions would not work, but we can not guarantee it.
In Unix systems after you have compiled Tcl/Tk libraries, you will
probably need to edit the makefiles of PicSearch so that the directories
of library and include files are correct. In Windows, you need not
compile (or even have) the Tcl/Tk source files, but to link PicSearch
two extra files are required: tcl75.lib and tk41.lib
(plus, of course, the DLLs). These are provided (for Microsoft Visual C++)
within PicSearch package.
Since Unix systems do not have built-in threads, we have used
(POSIX standard) pthread-package. This needs to be installed and
compiled like Tcl/Tk. Edit the main Makefile of PicSearch to include the
library in linking, check also that the Makefile in subdirectory 'common'
has proper path to find the include file 'pthread.h'. If you run into
difficulties in compiling our files 'common/src/pthread.hxx' and
'common/src/pthread.cxx', try to hack those files yourself (the pthread-
package does not seem to be as standard as it claims). In Windows none
of the this is required.
In Unix systems one more external component is needed: xgrabsc.
Since Tcl/Tk does not provide a proper way to implement a drawing window,
we use a screen grabber to snatch the image from the screen. Xgrabsc is not
linked with PicSearch and needs only be separately compiled into
executable and put into the main directory of PicSearch. Once again,
in Windows this is not needed since the screen grabber is implemented
as part of PicSearch (and is thus much faster).
2.3. Compiling the system
In Unix systems we have used GNU's C++ compiler (gcc) and in Windows
Microsoft's Visual C++ (version 2.0 or higher). Below is a step-by-step
list of how to set up PicSearch. We refer to the directory where the
executable file of PicSearch is to be located as
the main directory of PicSearch or just by $PICSEARCHDIR
In Unix systems:
- Create a directory for PicSearch.
This directory is to be the main directory of the system.
mkdir <dirname>
cd <dirname>
- Set environment variable:
setenv PICSEARCHDIR <pathname>
(the actual
command depends on the shell you are using).
- Download PicSearch, e.g. from http://www.cs.helsinki.fi/~klemstro/picsearch.html
- Unpack PicSearch package:
gunzip pics10.tar.gz
tar -xf pics10.tar
- Update your Tcl/Tk to at least versions 7.5 and 4.1:
- Download the package for example from:
http://www.NeoSoft.com/tcl
- Unpack the package
- Compile
- Test with some small test programs included with the package
- Set up the pthread-package
- Download the package for example from:
http://www.mit.edu:8001/people/proven/pthreads.html
- Unpack the package
- Compile
- Compile xgrabsc:
- Change directory from main directory of PicSearch:
cd $PICSEARCHDIR/source/xgrabsc
- Compile:
make
- Compile PicSearch:
- Update makefiles: pathnames of
- XWindows library
- Tcl/Tk library
- pthread library
cd $PICSEARCHDIR/source
make
- Test the system:
cd $PICSEARCHDIR
picsearch
- You are now free to modify the code.
See 4. Maintenance of PicSearch
for more instructions.
For Windows we provide no makefile.
Please build a makefile of your own by following the instructions below.
We have used no Microsoft-specific code in our implementation so the code
should compile e.g. under Borland C++.
- Create a directory for PicSearch.
This directory is to be the main directory of the system.
mkdir <dirname>
cd <dirname>
- Download PicSearch, e.g. from http://...
- Unpack PicSearch package:
install.exe
- Test the system by running 'run.bat' in the main directory of PicSearch.
- Create your own makefile and note the following:
- The application must be compiled as 'Console Application'
- Files you need to compile are listed in 3. Files;
basically all the files with extension '.cxx' and most of
the '.c' -files in directory 'source/formats/Jpeg-6a'.
- The working directory for debugging sessions should be the
main directory of PicSearch.
- Use multithreaded version of run-time library
- Additional include directories under main directory of PicSearch:
source\alg\inc, source\common\inc, source\db\inc, source\gui\inc,
source\main\inc, source\formats\Jpeg-6a, source\tcl\include
- Additional libraries under main directory of PicSearch:
source\tcl\lib\tcl75.lib source\tcl\lib\tk41.lib (for MSVisual C++)
- You may keep the dynamic link libraries tcl75.dll and tk41.dll in
the main directory of PicSearch or copy them elsewhere as long as they
are found along the system path.
- You are now free to modify the code.
See 4. Maintenance of PicSearch
for more instructions.
Below is a list and short description of all the files that are
part of PicSearch.
- Directory: documents
Index: index.html Documentation of PicSearch
- ka.html User's manual
- yo.html Developer's manual (this document)
- te.html Technical specification
- pics (directory) -- Image files in documentation of PicSearch
- Directory: source
Source files and documentation of classes.
- Makefile -- Main makefile of PicSearch, builds the whole system
- alg (directory) -- PicAlg subsystem
- common (directory) -- PicLib subsystem
- db (directory) -- PicDb subsystem
- formats (directory) -- Jpeg library routines by Independent JPEG Group
- gui (directory) -- PicGUI subsystem
- main (directory) -- PicCore subsystem
Each of the directories listed above has a Makefile of its own and
four directories (except 'formats') named 'doc', 'inc', 'src' and 'obj'.
Corresponding to each header file in directory 'inc' there is a
HTML file containing documentation of the classes defined in the header.
- Directory: source/alg
PicAlg source and documentation files
- Directory: source/common
PicLib source and documentation files
- doc/index.html -- List of links to header file documentations
- doc/classes.html -- List of classes
- doc/basics.html -- PicLib basics
- doc/*.htm -- Documentation files named after the header files
- Makefile -- Makefile of PicLib subsystem
- inc/bcollect.hxx -- BaseCollection, simple collection class
- inc/bdate.hxx -- BaseDate, date handling
- inc/bdatetim.hxx -- BaseDateTime, time+date
- inc/breal.hxx -- BaseReal, floating point number class
- inc/bstrarr.hxx -- BaseStringArray, array of BaseStrings
- inc/bstring.hxx -- BaseString, string handling
- inc/btime.hxx -- BaseTime, time handling
- inc/genarr1.hgn -- used by classes derived from BaseCollection
- inc/genarr2.hgn -- used by classes derived from BaseCollection
- inc/genarray.cgn -- used by classes derived from BaseCollection
- inc/palloc.hxx -- Memory allocation routines
- inc/parray.hxx -- PicArray etc., array classes
- inc/passarr.hxx -- PicAssocArray, array of pointers to PicObjects
- inc/passoc.hxx -- Used by PicAssocArray
- inc/pchar.hxx -- Some character classification methods
- inc/pcollect.hxx -- Collection class bases: PicCollect, PicIxCollect, PicNmCollect etc.
- inc/pdate.hxx -- PicDate, BaseDate + PicObject
- inc/pdatetim.hxx -- PicDateTime, BaseDateTime + PicObject
- inc/pdefault.hxx -- Some default values
- inc/penviron.hxx -- PicEnvironment, access for environment variables
- inc/perrctxt.hxx -- PicErrorContext, for holding error information
- inc/perrlog.hxx -- PicErrorLog, error logging
- inc/perrmgr.hxx -- PicErrorManager etc., base class for managing error information
- inc/perrmgr1.hxx -- PicL1ErrorManager, for actual error manager implementation
- inc/pfile.hxx -- PicFile, file name handling
- inc/pfilestm.hxx -- PicFileStream, file I/O
- inc/picbase.erh -- Some constants defined
- inc/picbase.hxx -- Simple basic types
- inc/picerror.erh -- Some constants defined
- inc/picerror.hxx -- Macros for error handling,
PicError, class for containing error information
- inc/pintarr.hxx -- PicIntArray, array of integers
- inc/pinteger.hxx -- PicInteger, integer handling
- inc/pintset.hxx -- PicIntSet, set of integers
- inc/piterate.hxx -- Collection class iteration macros
- inc/piterimp.hxx -- Used by iterator classes
- inc/pixmap.hxx -- PicIxMap etc., collection of PicObjects indexed by integer
- inc/plogic.hxx -- PicLogic, logical operations
- inc/pnassarr.hxx -- PicNamAssocArray, array of string + object associations
- inc/pnmmap.hxx -- PicNmMap etc, collection of PicObjects indexed by string
- inc/pobjarr.hxx -- Used by collection classes
- inc/pobject.hxx -- Macros, PicObject, 'mother of all classes'
- inc/psemaph.hxx -- PicSemaphore, a binary semaphore for syncronization
- inc/pstream.hxx -- PicStream etc., base class for stream classes
- inc/pstring.hxx -- PicString, BaseString + PicObject
- inc/pstrstm.hxx -- PicStringStream etc., stream I/O with strings
- inc/ptext.hxx -- PicText etc., more power than in basic string classes
- inc/pthread.hxx -- PicThread, thread handling
- inc/ptime.hxx -- PicTime, BaseTime + PicObject
- inc/pvirtobj.hxx -- Macros, PicVirtObject, 'grandmother of all classes'
- src/*.cxx -- Implementation files named after the header files
- Directory: source/db
PicDb source and documentation files
- doc/index.html -- List of links to header file documentations
- doc/classes.html -- List of classes
- doc/*.htm -- Documentation files named after the header files
- Makefile -- Makefile of PicDb subsystem
- PicDb.hxx -- API of PicDb, used by PicCore
- PicDbEngine.hxx -- Simple database handler
- src/*.cxx -- Implementation files named after the header files
- Directory: source/gui
PicGui source and documentation files
- Directory: source/formats
- Makefile -- Makefile of compiling Jpeg-functions
- Jpeg-6a (directory) -- Package provided by Independent JPEG Group,
files that are to be compiled into PicSearch:
- jmemwin32.c (Windows only)
- jmemnobs.c (Unix only)
- jcapimin.c, jcapistd.c, jccoefct.c, jccolor.c, jcdctmgr.c, jchuff.c,
jcinit.c, jcmainct.c, jcmarker.c, jcmaster.c, jcomapi.c, jcparam.c,
jcphuff.c, jcprepct.c, jcsample.c, jctrans.c
- jdapimin.c, jdapistd.c, jdatadst.c, jdatasrc.c, jdcoefct.c, jdcolor.c,
jddctmgr.c, jdhuff.c, jdinput.c, jdmainct.c, jdmarker.c, jdmaster.c,
jdmerge.c, jdphuff.c, jdpostct.c, jdsample.c, jdtrans.c
- jerror.c, jfdctflt.c, jfdctfst.c, jfdctint.c, jidctflt.c, jidctfst.c,
jidctint.c, jidctred.c, jquant1.c, jquant2.c, jutils.c, jmemmgr.c
- Directory: source/main
PicCore source and documentation files
- Directory: DataBase
Database files created by PicDb
- *.db -- Database table files
- *.idx -- Index files
- ImageInfo.* -- Basic information of images
- ImageData.* -- Data of images
- ScaledImageData.* -- Small scaled versions of images
- SearchAlgorithm.* -- Search algorithms listed
- Signature.* -- Signatures of images
- SegmSignature.* -- Signatures of image segments
- SegmAlgorithm.* -- Segmentation algorithms listed
- Segmentation.* -- Segmentations of images
- Segmentation.* -- Segmentations of images
- Segment.* -- Segments of segmentations
- Parameter.* -- Various parameters
For more information on the technical issues of PicSearch, refer to
technical specification and
documentation of the C++ classes.
4.1 Database management
The simple database implementation now used in PicSearch saves all
its data into the directory 'DataBase'. We urge you to regularly
make backup copies of all the database files (*.db, *.idx)
in the directory.
Since the database implementation is not as
robust one would like, if PicSearch crashes, the database may be left
into incoherent state. If that happens, restore the files from
your backup or just delete all the files in the directory.
NOTE: connecting to database is guarded by file $PICSEARCHDIR/DBLOCK.LCK;
this file is left undeleted if PicSearch did not shutdown properly.
In that case you may delete the file manually (but don't use this
to start up more than one copy of the system since our database
implementation can not handle multiple connection to the database).
4.2 Programming new algorithms and image formats
Once you have successfully installed and compiled PicSearch, you
are free to modify the system as you please. Before starting to
program, spend some time browsing through the
documentation of the C++ classes
we have provided. Also you need to understand basics of the
common class library (PicLib) that we have used throughout the
system: see PicLib basics.
If you only want to program some algorithms of your own, all you need
is to save copies of the following files under new names
and fill in the code as instructed by the templates.
Remember to update makefiles source/alg/Makefile and source/Makefile.
For search algorithms you also need to update the function
'algorithmParams' in script file
source/gui/src/subwins.tk
to create a window for parameters of your algorithm (if none,
you may skip this). Equivalently for segmentation algorithms
the function is 'segmentParams' and for image processing algorithms
'imageProcess' in
source/gui/src/editor.tk.
You may program PicSearch without much knowledge about the inner
workings of the system or PicLib. However, since we have used
extensively the classes provided by PicLib, many of the parameters
of the functions use classes of PicLib. That's why we suggest
that you use some of your time getting to know the most important
classes. Take a look at the documentation of PicLib, especially
the PicLib basics.
Furthermore, browse through the main code of PicSearch to get a hang
of how to use the classes provided. And if your C++ needs a brush-up,
now is the time. Make sure you understand how inheritance and
virtual functions work.
4.3 Further development of the system
If you want to make functional changes to PicSearch, you'll have to
spend much more time getting used to the programming environment. Read
carefully through the technical specification
and check out our code until you approximately know how different
parts of the system interact and function.
When making bigger funcional changes, try to keep the APIs
unchanged if possible. That way you'll be able to narrow down the
problem areas you may be creating. For example, if you decide to
re-implement the database engine, keep the functions of class
PicDbConnection as they are, so there should be little need to
touch any code within PicCore and certainly not within PicAlg or
PicGui.
It may be a good idea to contact the development team of PicSearch
before starting to make any major changes. We will be able to give
a rough estimate on what needs to be changed and how much effort it
will take. If the job is small, we might even do it ourselves :-).
Our contact information you will find below (up-to-date on May 1997).
4.4 Reporting errors
The development team of PicSearch can be reached by e-mail using the
addresses given below. If outdated, try locating us using some search
engine on the Web. Each of the developers mentioned here has his own
field of expertise as indicated. Since this system was an outcome
of a course project, you will probably benefit most by contacting
our client for the project, who should be developing this system
further.
You are free to develop the software any way you want under
General Public License. If you detect any bugs in the original code,
please send the following information about the case:
- Your name and e-mail address or other contact information
- The source from which you acquired your copy of PicSearch
- Operating system
- Your hardware set-up (memory, processor, etc.)
- The version of the program
- ERROR.LOG file (located in the main directory of PicSearch)
- Any available debug information you may be able to generate
(set debug flags on from the Options, see User's manual
3.1.1. Setting general options)
- Short but complete description of the error, try to be as
specific as possible, list also the actions before the error
- Any other information which seems to be important