pyirt requires numpy and PIL to run. It’s only been tested on python 2.6, but 2.7 should also work. Should be a lot easier to get working on Linux, but you can use Windows if you wish.
Run setup.py as so:
python setup.py install
This should compile and put the package in the correct place for your system. Some parts are written in C and compiled with f2py during the installation, which may cause issues on Windows. Easiest way to ensure it works is to install the correct version of Visual Studio Express for your python installation.
Extract over your python directory.
Installation includes a script called run_irt.py that will enable the transform to be easily run on many images. Assuming that it is on your path.:
run_irt.py [options] FILEDIR [FILEDIR ...]
where FILEDIR is an image file or a directory containing image files. If it’s a directory all image files within it will be added (although not other directories). Most previously published results can be repeated from the command line. For example:
run_irt.py --maxrays N 10000 -multiple 2 circle.png
will reproduce the transform used in “Circle Detection Using the Image Ray Transform”, setting the number of rays to 10000 and the number of transforms to 2, one with a target intensity of 0, one with a target of 255. The depth and refractive index parameters are already set as defaults. The transform used in “A Novel Ray Analogy for Enrolment of Ear Biometrics” can be reproduced with the command:
run_irt.py --rmscease 1 ear.png
that is, setting the transform to stop when the root mean squared difference per pixel between accumulator normalisations every 1000 rays is less than 1. As a final exmaple, the final results of “Retinal Vessel Extraction with the Image Ray Transform” cannot be produced from the command line, but the individual transforms that were combined can be:
run_irt.py --rmscease 1 --target 0 retina.png run_irt.py --rmscease 1 --target 0 -k -r 7 retina.png
which sets the first one to use linear refractive indices with the maximum being 40 (as they are the default parameters) and sets the second to use exponential calculations with k=7. They can then be combined with irt.combine_transform_results() in a simple python script. Other important options are shown in this example:
run_irt.py --outdir ~/test/out/ --paramfile ~/params.csv --multiprocessing 2 example.png
outdir sets where all output goes, otherwise it is saved to the current working directory. paramfile gives a csv defining the parameters to load and override the defaults, although any parameters set on the command line will override them as well. The current parameters will be saved in the output directory as params.csv. multiprocessing will allow multiple processes to be spawned to transform the list of files quicker. This is done on a file basis, rather than a ray basis, so is only worthwhile on multiple files.
All command line options:
--version show program's version number and exit -h, --help show this help message and exit -v, --verbose verbose mode -o OUTDIR, --outdir=OUTDIR Directory to output to -p PARAMFILE, --paramfile=PARAMFILE File defining the ray transform parameters. -P PARAMOUT, --paramout=PARAMOUT Filename of file recording these parameters -i, --progressim Output the state of the accumulators every STEPSIZE rays. -M PROCESSES, --multiprocessing=PROCESSES Use multiple processes. 0 sets to the number of cpus, if possible. -N MAXRAYS, --maxrays=MAXRAYS maximum number of rays to trace -s STEPSIZE, --stepsize=STEPSIZE number of rays to trace at once -D DS, --rmscease=DS Stopping condition -n, --linear, --nmax Use linear refractive indices: set n_max with -r -k, --exponential controls growth of exponential refractive indices -r VAL, --refractval=VAL Value of the parameter that controls refractive indices, selected by -n and -k --hightolow Refraction policy: only high to low --lowtohigh Refraction policy: only low to high --both Refraction policy: always refract -d MAXDEPTH, --maxdepth=MAXDEPTH maximum depth for rays -l MAXLENGTH, --maxlength=MAXLENGTH maximum length of rays -E, --edges use edges rather than intensity -t TARGET, --target=TARGET set a target intensity -m PASSES, --multiple=PASSES perform a number of transforms, and combine results
The pyirt.irt modules provides a number of functions to aid the use of it in python. Some example scripts are also there.