last update 2011-02-08

What is GpetView?

GpetView - Gtk-base Analyze image viewer

GpetView is light-weight image viewer based on Gtk+ library. The supported image format is  ANALYZE(TM) format (Mayo Foundation ). GpetView can run on Unix-systems, such as Linux, Solaris, IRIX, Mac OS-X etc. From Version 2.0, GpetView can also run on Win32 system, if you have installed Glib and Gtk+(2.x). Glib andGtk+ can be found at
For Windows users, you can find Gtk+ libraries at

GpetView has the following features;
* very light-weight
* view images as transverse, coronal, or sagittal
* change color-map (support Analyze lkup file)
* zoom images
* ROI (Region-Of-Interest) with shapes of circle, ellipse, rectangle, polygon and automatic edge detection
* Image histogram and profile


GpetView is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option) any later version.
GpetView is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANT ABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.


Version of GpetView is currently 3.5. From 3.0, GpetView use Gtk2 instead of old Gtk1 library.


You can download source files of GpetView by clicking here.
This file is tar+gz, so you can extract files by "tar xvzf gpetview-3.5.tar.gz" or "gzip -c gpetview-3.5.tar.gz | tar xvf -"
Before compiling GpetView, you must install Glib2.x and Gtk2.x. I also recommend you to install GNU gcc and GNU make to compile GpetView.
Then you can compile and install by
cd gpetview-3.5
make install
Please check configure option, by ./configure --help if you get error during the compilation. If you fail to compile GpetView, please let me know. 

For Windows user, at first you must install gtk+ runtime library from need only gtk+-win32-runtime). And you download zip file and extract all files into a certain folder.



You can start GpetView by typing 'gpetview'. You can also specify image file as first argument of gpetview as 'gpetview image'.
Alternatively if you put '-p' option, gpetview try to read from standard input.  ' cat image.hdr image.img | gpetview -p' to display image.img. '-p' option is useful if you make a filter program.  For example, I wrote a program 'ecat2ana' which converts from CTI ECAT image to Analyze image. I can see ecat image 'image.v'  in gpetview by 'ecat2ana image.v -p| gpetview -p'.
The default window size of gpetview is 750x550 and canvas size is 1000x1000. If you want to change these sizes, you can use option -w and -c respectively. For example 'gpetview -w 300 300 image', make gpetview window with 300 pixel  by 300 pixel size.
Another options are as follows;
-a: absolute max, min
-b: title
-c: canvas size width=canvasx,height=canvasy
-d: temporary directory for ROI
-e: max for each slice
-h: this message
-g: specify ROI name
-i: 1 for interpolation on
-l: color lookup table 0-rainbow 1-hot 2-gray 3-invgray 4-comb 5-lkup
-n: 1 for numbering on
-o: output stdout
-p: get image from pipe
-q: slice selection
-r: relative max,min
-s: 0-trans 1-coronal 2-sagittal
-t: timestamp
-u: lookup file
-w: window size width=winx,height=winy
-y: 1 for reverse Y on
-z: zoom

If you give -h with gpetview, you will see help of starting options

When GpetView display PET images

Default file

GpetView reads the default setting file at start. The file is placed at your home directory as .gpetviewrc  (For Win user, use gpetviewrc in the folder as same as gpetview).
The format of the default file is
keyword value
The following keywords are recognized by GpetView

View image

You can select image file from Menu 'File' ->'Image File..' or (just type control+o), then you type the file name you want to see in the entry 'File name:'. After selecting the file, push 'Load' button.
Once you load the image file, you can see the image by pushing 'VIEW' button at the left corner of GpetView.
By typing control + c, you will be asked to clear the screen. You can load a new image file.
By typing control+v, GpetView clears screen and display images


Setting panel can be found  under menu, 'Edit'.  Or just type 's' on the canvas of GpetVIew.
Setting Panel

Adjust colorbar

If you click a left button  of mouse on colorbar (left side of gpetview window), you will see colorbar window.
You can choose color model either rainbow (default), hot metal, grayscale, inverse grayscale, combination (between rainbow and grayscale, this color model is useful to display PET-MRI coregistration image), lookup (user defined lookup color model)
You  are also able to adjust color scale using this colorbar window.
If you toggle 'Redraw image' on, colormap of your current image will be updated when you click 'OK' button. 'Reset' button makes color scale as a straight line.
You can save your defined color lookup table by clicking Save button or you can load previously defined lookup table file by Load button. Lookup table file has '.lkup' extension.

Colobar window

Analyze Images with ROI (Region-Of-Interest) etc.

ROI panel can be found under menu, 'Edit'
ROI panel
Once you select ROI type, you see the ROI on one image.
You can manipulate ROI by mouse
Left-button - move ROI
middle-button - change size of ROI
right button -  rotate ROI
When you select ROI type 'Circle', 'Ellipse', or 'Rectangle', Entries Diameter1 (diameter of circle), Diameter2 (diameter of ellipse) and Deg (degree)  are effective.
Push Button 'ROI Calc' when you set ROI (alt + R can do this).
If you want to change the image which you want to make ROI, push button'F ->' (Forward) or '<-B' (Backward).
Alternatively you can specify the plane number in the box  under the buttons F-> and <-B.
You can see results of ROI by Menu 'MISC' -> 'ROI Info...'

Another buttons are


2011-02-08    Version 3.5    Use Pango for displaying numbers
2011-01-07    Version 3.4     ROI move in four directions. Delete multiple ROIs. Label colorbar. show ROI area in mm2. Some bugs are fixed
2010-08-28   Version 3.3    Bug fix for mask ROI. -d option to specify directory for temporary ROI
2010-07-02   Version 3.2    circular and rectangular ROI with mm size. -g option for ROI name
2008-06-27   Version 3.1    Bug fix for find edge. forec for foreground color.
2007-01-05    Version 3.0    GpetView for Gtk2
2006-08-14    Version 2.9    enable to display 8bit image which maximum value is less than 255. line width for ROI primitives by lwidth in .gpetviewrc
2005-07-14    Version 2.8    mark ':' is used instead of ';' to make sequential numbers in slice selection. Maximum sequence number is now 50000 to read big images. gpetview can now handle negative absolute value properly.
2005-01-20    Version 2.7    bug fix for color lookup table. Add roi_calc menu (shortcut alt+R) to do ROI calculation
2004-03-05    Version 2.6    color lookup table can be saved and loaded. -u option. bug fix
2003-06-28    Version 2.5    add -e -b options. several bug fix
2003-05-20    Version 2.4    internally use 256 colors. File browser for all places.
2003-04-10    Version 2.3    Histogram Window and Profile Window are improved. Setting Window is now not modal.
2003-03-31    Version 2.2    minor bug fix. temp file for win32. file open bug for win32.
2002-10-24    Version 2.1    minor bug fix. change Colormap of rainbow. gpetviewrc for Win32. Change numbering ROI file for saving
2002-08-28    Version 2.0    Porting to Win32
2002-08-22    Version 1.14beta    color setting in colorbar_window. introduce "redraw image" to update colormap of current image. bug fix for pipe arguments. bug fix for inv gray color.
2002-08-19    Version 1.13beta    colorbar window for adjusting colorbar.add new starting options. thresholding if you start gpetview with -a. bug fix for header edit.
2002-05-09    Version 1.12beta    change layout of ROI panel. show header name in header info. change default colormap
2002-01-28    Version 1.11beta    take account of time information. deal with ROI with different zooming.
2001-11-14    Version 1.10beta    modify header info. add inverse gray color scale. swap toggle for header save. add clear&view to make shortcut
2001-09-17    Version 1.09beta    Add zooming option, absolute and relative maximum values option. Selected image for ROI is determined by mouse. window title reflects image name.
2001-09-04    Version 1.08beta    clean up ROI file routine, bug fix for image numbering, rearrange header info and save routine, add window size setting
2001-05-21    Version 1.07beta    Add ROI number entry box. Bug fix in ROI calculation
2001-05-08    Version 1.06beta     Cleanup ROI routines. Add overwrite confirmation and bug fix in save_hdr, save roi_info
2001-04-09    Version 1.05beta    fix bug in img_lib.c. Add reverse Yaxis. Fix bug for find_edge and roi_calc and pick_p if you use zooming.
2001-01-22    Version 1.04beta    Version control by CVS
2000-12-17    Version 1.03beta
2000-12-12    Version 1.02beta
2000-11-24    Version 1.01beta



Mail comments and bug reports to
watabe at


Hiroshi Watabe