Rochester Institute of Technology
RIT Scholar Works
Theses
Thesis/Dissertation Collections
6-20-1988
A Window-Oriented User-Interface for Image
Processing Systems on UNIX based workstations.
Sandeep Mehta
Follow this and additional works at:
http://scholarworks.rit.edu/theses
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusion
in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact
Recommended Citation
Approved by:
Rochester Institute of Technology
School of Computer Science and Technology
A
Window-Oriented User-Interface for Image Processing
Systems on UNIX based workstations.
by
Sandeep Mehta
A thesis submitted to the
Faculty of the School of Computer Science
in partial fulfillment of the requirements for the degree of
Master of Science in Computer Science.
Donald L. Kreher
Dr. Donald L.
Kreher (advisor)
Evelyn Rozanski
Prof. Evelyn Rozanski
Peter H. Lutz
Dr. Peter Lutz
Title of Thesis:----!.A
_ _
W_l
'....:..."'-~~
_ _ _
O_y_=__l
·..:::.~..:....:...::..::::::::..:=____\J_~_~'"6.=..
· _t_~
__
:cr-4---.:...l-L
__
f_.=-+-~---I
~ kN'Y~
N
~<f1t--
hereby
(grant/~permission
to the Wallace
Memorial Library, of RIT, to reproduce my thesis in whole or in part. Any reproduction will not
be for commercial use or profit.
or
I
prefer to be contacted each time a request for
reproduction is made
.
I can be reached at the following address
:
Date:_&--+-6/_2
.5-+-/-=-:~=--
I
I
A
Window-Oriented
User
Interface
for
Image
Processing
Systems
on
UNIXf
based
Workstations
Sandeep
Mehta
School
ofComputer
Science,
Rochester Institute
ofTechnology,
Rochester,
New
York.
ABSTRACT
The
advent
ofdigital
image processing has
led
to the
availability
of avery
large
number
ofsoftware
systems
.However
there
is
an absence of a cohesivegeneral-purpose
image
processing
environment
isolated from
hardware
orthe
underlying
operating
system.
The
trend
in
computing
in
science andengineering,
is
towards
distri
buted
workstations,
especially
withthe
availability
ofhigh-performance
microproces
sors.
Hence
there
is
a
needfor
a unifiedsoftware environment
on workstationsfor
usein
scientificapplications.
This
thesis
describes
the
design
andimplementation
ofa
window orienteduser-interface.
The
interface
runs ontop
of aImage
Processing
system,
running
on workstations
underthe
UNIX
t
environment and usesthe
networktransparent
X
windowsys
tem
$.
The
visual shell-like environmentis
targeted
atthe
end-user with a scientificbackground needing
image
processing
capabilities,
but
notnecessarily
witha computerbackground.
The User-Interface
is
primarily
a
tool
for
useby
a singleuser,
althoughthe
underlying
system operatesin
a multiusermultitasking
environment.The
objective
ofthis
exerciseis
aimed atproviding
rapid,
easy
and visualcapability in
processing
images
ata
sessionlevel. It
integrates
graphics capabilities withhigh
speed comput
ing.
All processing
capabilities providedat
the
commandline
level,
are available
viadialog
boxes,
buttons
&
multi-level menus.June
20,
1988
t
UNTXis
atrademark ofBell
Laboratories.Acknowledgements
The
author wishes
to
acknowledge
the
co-operation and
encouragement providedby
his
advisorDr. Donald
Kreher,
during
the course
ofthis work,
as well asProf. Evelyn
Rozanski,
for agreeing
to
be
on
the
committee,
andproviding
constructive criticism
ofthe
proposal andthe thesis
in
its
many
forms
of
completion.
This
work wascarried out
withthe
Optical
Engineering Group
atthe
Laboratory
for
Laser Ener
getics,
University
ofRochester.
I
wouldlike
to thank
Terrance Kessler for offering
me anopportunity
at
the
Lab
andencouraging
meto
pursuemy
thesis
work withthe
Optical
Engineering
group.Without
his
guidance
none ofthis
wouldhave
been
possible.
I have
to thank
Steve Swales for
his
numerousideas,
help
&
suggestions
whichhelped
meout
of somany
tight
cornersthroughout the course
ofthis
project;
withouthis
assistance
alot
ofthis
project could nothave been
designed,
and
Nitin
Sampat
for
keeping
the
"big
picture"
in
focus.
I
alsothank
Denise
Ondishko
ofthe
Image Analysis
Laboratory,
with
the
system support and words ofencouragement
during
many late
programming
blitzes.
Finally
I
wouldlike
to thank
my
family
in India for supporting & encouraging
methrough the
Table
of
Contents
Abstract
1
Acknowledgements
2
Chapter
1:
Introduction
to the
User-Interface
concept3
1.0
The
needfor
anInteractive
Computing
Environment
3
1.1
The
User-Interface
why,
whatand
how
?
3
1.2
Choice
ofprogramming language
andenvironment
6
1.2
X
Network
Transparent
Window System
7
1.3
Design
Philosophy
ofthe
User-Interface
8
Chapter 2:
Design
ofthe
XIP
User-Interface
10
2.1
Global
functionality
ofthe
XIP User-Interface
10
2.2
Functions
Specification
ofModules
12
2.2.1
Error Handler Daemon
(XERRWIN)
12
2.2.2
Command
Window Handler
(XCOMWIN)
14
2.2.3
Button
Handling (XBUTTONS)
15
2.2.4
Displaying
andSaving
Images
(XDISPIMG
&
XSAVEIMG)
15
2.2.5
Region
ofInterest
Processing
(XTRACTROI,XPROCROI,XDISPROI)
16
2.3
Other
functions
performedby
XIP
18
2.4
Screen Organization
andManagement
18
2.5
Limitations
and restrictionsin
the
XIP design
20
Chapter 3:
The Error Window Daemon
23
3.1
Introduction
23
3.2
Design
23
3.3
Implementation
24
3.4
Caveats
andSuggestions
25
Chapter
4:
The Command Window Handler
26
4.1
Introduction
26
4.2
Design
&
Implementation
26
4.3
Caveats
andSuggestions
27
Chapter 5:
The
Button Handler
28
5.1
Introduction
28
5.2
Design
&
Implementation
28
5.3
Caveats
andSuggestions
29
Chapter 6:
Image Conversion
andDisplay
30
6.1
Introduction
30
6.2
Image Format
30
6.3
Image Conversion
in
XIP
34
6.5
Design
and
Implementation
ofImage
Display
program
38
6.6
Caveats
and
Suggestions
38
Chapter 7:
Region
ofInterest
Processing
39
7.1
Introduction
39
7.2
Extraction
39
7.3
Resizing
40
7.4
Insertion
41
7.5
Processing
41
7.6
Caveats
and
Suggestions
42
Chapter
8:
Menu
Building
andGeneration
44
8.1
Introduction
44
8.2
Design
andImplementation
44
8.2.1
Tokens
and
reading
the
default file
45
8.2.2
Menu Generation
and
Command
Building
47
8.3
Caveats
and
Suggestions
47
Chapter 9:
Operation
andResults
49
9.1
Introduction
49
9.2
XIP User Interface
Control
49
9.3
Results
50
9.4
Conclusions
50
Appendix A:
XIP User Interface header
files
A
Appendix
B:
XIPMENU Menu
Structure
Definitions
B
Appendix
C:
Results
C
Appendix
D:
Selected Statistics
D
Chapter
1
Chapter
1:
Introduction
to
the
User
Interface
concept
1. The
need
for
anInteractive
Computing
Environment
The
rapid
advent
ofDigital Image
Processing
in
the
past
few
yearshas led
to
a plethora ofsoftware
systems
being
available
in
the
commercial market
as wellas
in
academia.Each
ofthese
systems
has
almost
the
same
functionality.
Since
digital
image
processing
is
avery
computationally
inten
sive
process,
it has
usually been
the
casethat
portability,
generality,
and ease oflearning
and usehave
been
sacrificed
in
favor
ofspeed and efficiency.
However it is
very
crucialthat
a system of substantialcomplexity
and size
be designed
withthe
factors
whichare
usually
ignored.
A
simple example
will serveto
illustrate
the
level
of computation required.Consider
a grey-level
512
X 512
pixelimage,
with12 bits/pixel
resolution.
If
an operator performs an operation onthe
8
neighbors of each pixel over
the
entire
image,
over32
million operations wouldbe
performed perimage.
Moreover
each operationcould
itself be
quitecomplicated.
Even
though this
magnitude
may
seem
overwhelming,
withthe current
hardware
available,
such computations arerelatively easy
to
perform
.Tne
cost
andsize
offast
memory
is
nolonger
a major restriction.That brings
usto
outlining
the
design
of animage
processing
environment whichaddresses
the
issues
ofsoftware
engineering,
codemodularity, portability,
device
independence, flexibility,
and easeof use.
This
proposed system whilefocusing
onthese
issues does
notnecessarily
compromise speed
andefficiency.
As Kasik
states:"The
roleof interactive computing
has
continually increased
asthe
costof
more powerful
terminals
andcomputing hardware
has
decreased."
J^^2
It is
the
goal ofthis
project
to
demonstrate
the
significance ofinteractive computing
in
the
case
ofDigital Image Processing.
1.1.
The User-Interface
-why,
what andhow
?
There already
exista
variety
ofsystems which claimto
satisfy
the
criteria
ofportability,
general
ity
andease
of use. e.g.PIPS
HAV86
,FTPS
WES85
and
HIPS.
In
the
author's opinion
all ofthese
sys
P
erIntroduction
to the
User
Interface
conceptavoided.
As Addington
ADD84
states
.The
real
challenge
in
software
design has become
the
development
of
userinterfaces
applicable
to
aparticular
application
orscenario.
This is
demonstrated
in
the
system
SDCIPS discussed
by
AddingtonADD84and
Green.GRE85It
is
generally
agreed
uponby
many
authors
ofthese
Image
Processing
softwaresystems, that the
use of personal
workstations
as
ahost
machine
to
provide
animage processing
environment
to the
image
process
ing
expert/analyst
is
highly
efficient as opposed
to
providing
them
witha
programmer'senvironment
onlarger
minicomputers
or
mainframes.
Although portability is
a
primary
design
goal ofthis
project
it is
very
hard
to
completely
isolate
such an
elaborate system
from
the
operating
systemenvironment
ofit's
host. The
host operating
systemin
this
project
is UNIX
whichis
known
by
most usersand
developers
as recluse and"expert
friendly"in
nature.
Although it
offers
tremendous
powerin
the
form
ofpipelining,
multipleoptions,
command
line
macros,
shell-scripts
etc.,
it
canbe
very
inconvenient
to the
user.UNIX
is
also ratherunforgiving
to
die
user's errors.
A
simple
string
ofcommands
to
histogram
equalize
animage
,remap
it
onto
anoutput
image
anddisplay
it,
looks something
like
this.
%
eqlz.run -m neigh -n2
input.img
I
remap. run -tI disp.run
-PcolorA
minor syntactical errorin
the
beginning
requiresthat the
entirecommand
be
re-entered.Com
mand
line
editing
is
primitiveif
not absentThere is
nointeractive
andinterpretive
facility
to
build
up
complicated
commandsfrom
simpler ones.Thus
a novice user remains athis
stage ofignorance
untilhe
canread
the
entiredocumentation
or an expert canprovide
him
the
complexdetails.
One
alternativeis
to
design
aninteractive
menu-system which runs ontop
ofthe
underlying
pro
grams.
In
fact
sucha
menu generatordoes
exist,
whichinteractively
collects
the
command options and
arguments and executes
the
program.SWA86
Of
coursethe
pipelining capability
ofUNIX
is
notavailable
at
the
menu
level.
However
that
does
notentirely
removethe
process ofdealing
withthe
operating
sys
tem,
cryptic commands and error messages.We
have
assumedso
far
that the
programsare
executing
ona single machine
using its
resident
aPter
Introduction
to the
User
Interface
conceptdistributed file
system
like NFS*.
If
a program resides
on ahost
onthe
networkit is
not
feasible
for
the
end-user
to
have
to
remotely login
onto
the
other machine
to
runhis
program.Besides
a remotelogin
willnot provide
transparent
access
to the
user's
data
whichmay be
anywhere onthe
network.Thus
network
transparency
is
also
anissue
to
be
considered
in
this
project.
Keeping
these
issues in
mind a need
has been
envisioned
for
a
userinterface
whichcan providea
single
user with atransparent
image processing
environment,
on a workstation console.The
usershould
have
the
ability
to
performthe
following
kinds
oftasks
at a sessionlevel
asdiscussed
by
Westrup, Kegel,
and
Gras.WES85Access
to
alltypes
ofimages (independent
oftheir
originalformat).
Display/print images independent
ofdevices.
Process/analyze images independent
of whichmachine
the
program resides on.Display
any
errormessages
in
a separate
window.Ability
to
access on-line
documentation.
Means
to
build
more complexoperations out
ofsimple ones.
Means
to
execute
basic
operations asynchronously.
Overall
the
interface
shouldbe
ableto
provide anenvironment
whichis
usableby
the
programmer andthe
end-user withsufficient
flexibility
.An
appropriate
description
of what a userinterface
shoulddo is
also provided
by
AddingtonADD84 :In
the
simplest versionof
a userinterface,
an experiencedimage processing
analyst orsoftware
developer
can execute program modulesdirectly by
transferring
the
appropriate commandsto
the
desired
software modules.A
more complex userinterface may involve
aseparate set
of
application softwarethat
supports afull-screen interactive
menudriven
interface,
keyboard
function
keys,
graphicstablet,
mouseetc.Since
the
userinterface
is
based
on adistributed
systemit
should
be
able
to
provide networktransparency.
To
quoteDensmore
and
RosenthalDEN87 :The
needsfor
portability,
distribution,
and standardization areencouraging
the
implementa
tion
of
window systemsfor UNIX
as network window servers ratherthan
asextensions
to
the
operating
systemkernel.
These
servers are user-leveldaemon
processes;
clients connectto
them
and make what areeffectively
remote procedure callsin
orderto
create/destroy
windows and
draw in
them.
Using
the
X
window systemt
onthe
host machine(s)
provides us withexactly
such anetwork
window system.
The
image processing
userinterface
proposed
is
windoworiented
whichuses client
processes
to
carry
out
variousfunctions
ofthe
interface. These
clientprograms are
interacting
withthe
t
NFS
(Network
File
System)
is
atrademark ofSun Microsystems.
aP
erIntroduction
to the
User Interface
conceptX
server,
and
accessing/utilizing
its
resources
i.e.
screen, mouse,
keyboard
etc.
All
the
options
whichare
available to the
user at
the command
line
are available at
the
user-interface
level
using
a menu system.
Although only
one
usercan access a console at a
given
time,
the
multiprocessing
capability is
nottaken
away.
There is
a
single
userinterface
process
handling
all communicationbetween
the
user(screen)
and
the
system,
whichspawns child processes
to
perform
specific
functions,
orhandle
somesubset
ofthe user-application
interaction
asmentioned above.
The
following
sections address
the
globalissues
in
the
design
ofthe
Image
Processing
User Inter
face further described in Chapter 2. First
the
choice ofa
programming language
and environment
is
explained,
followed
by
abrief
overview
ofX. It
should
be
mentioned
atthis
pointthat
althoughthe
concept
ofdevice/machine independence is
primary
it has
been
observedthat
X
is
portableto
most
UNIX
and
some
non-UNIX
systems,
and
is
becoming
anindustry
windowing
standard.Thus
X
is
chosen
as
the
base
for development for
this
project.
Finally
the
issues
in
the
user-interfaceinternals
design
have
been discussed.
1.2.
Choice
ofprogramming language
andenvironment.
Since
the
user-interfaceinvolves
substantialinteraction
withthe
applicationsthat
lie
underthe
visual
environment
it is
easy
to
narrowdown
the
choice ofprogramming languages
to
a
limited
set
oflanguages
which caninteract
withthese
applications.This discussion
does
not examinethe
relative merits
anddemerits
oflanguages
but
only
cites reasonsfor
the
choicealready
made.
The
language
chosenis C
whichis
general purpose enoughto
develop
rr^stapplications,
and powerful enoughto
usethe
machine with maximum efficiency.
Another factor in
its
favor
is
that the
X
window systemhas
been
mostly implemented in
C,
andso
has
the
image
processing
systemfor
whichthis
userinterface
wasprimarily
designed
andtested on.
C
providestremendous
power whenit
comes
to
dealing
withsystem
software
like
the
UNIX operating
system,
whichhas
itself been mostly
writtenin C.
Having
decided
onC
as
the
language choosing UNIX
asthe
programming
environment
is logical.
As
withC,
UNIX has been
the
host
operating
systemfor
the
evolution ofX,
and
the
image processing
Chapter 1
Introduction
to
the
User Interface
concept1.3.
X
-Network
Transparent
Window System
This
windowsystem
for UNIX
runs oncomputers
withbitmap
terminals.
The X
serverdistributes
user
input
to
and accepts output requests
from
variousclient
programslocated
onany
machine
in
the
Internet
domain.tLEF,TAN81X
supports
overlapping
windows,
fully
recursivesubwindows,
text
and
graphics
operations
withinwindows.
It
also
has
a
capability
to
emulate most
terminals
(xterm).
X
runs
it's
windowmanager as
aclient
program,
whichis
very
convenient as
it lets
the
user writeor
modify
his
own windowmanager.
Since
X
imposes
little
access controlthis
approachis
elegant
andlends
itself
to
using
otherclient software
such asthis
userinterface,
concurrendy.Some
windowsys
tems
such as AndrewMOR86 attemptto
enforce aconsistent
style of userinterface
across allapplications
that
usethem, however
X
provides
only
alow-level
mechanism anddoes
notspecify
any
details
ofappearance
orfunctionality
of an application program's userinterface.
It
is
difficult
to
write each application
from
scratch, thus
an additionallayer
above
the
basic
window systemis
necessary.This
additional
layer
is
provided
in
the
form
of a"toolkit"
which
lets
an application programeasily
andrapidly
construct
items
such aswindows,
menus,
and scroll-barsfrom
the
toolkit
library. X
Version 10 does
have
a
toolkit
but it is
notportableto
allimplementations
ofX Version
10,
hence
the
current
develop
ment
has
been
carriedout
using
the
lower level
C
library
interface.GET86The Version 11
implementa
tion
ofX
comes withmany
toolkits
andporting
the
applications acrossdoes
not pose a problem.1.4.
Design
Philosophy
ofthe User-Interface
The
userinterface is
the
software whichinteracts between
the
user andthe
operating
system aswell
as
the
application software.This indicates
that
the
userinterface
definition
mustactually
define
two
interfaces-the
userinterface:
the
higher level
programs/routinesby
whichthe
user andthe
interface
interact;
plus an applicationinterface
through
whichthe
interface
communicates withthe
operating
system
andthe
application programs.The latter interface
is
transparent
to the
user.The
userinteracts
with
the
system environment via oneprocess, to
be
ableto
maintain sessionlogs
andto
be
able
to
maintain
a
basic level
ofconsistency
across all applicationsbeing
accessed viathe
interface. Such
anChapter
1
Introduction
to the
User
Interface
conceptapproach
has
also
been
suggested
by
Hayes.HAY85In
the
same article
Hayes
suggestsspecifying
the
user-application
interaction
at a
level
more abstract
than the
language
the
application wasimplemented
in.
Let
usthen
agree
that the
interface
should
have
a
higher level
of communication.Then
there
are3
possible ways
ofimplementing
the
userinterface.
as
apackage
ofsubroutines
which canbe
called
from
the
application
code. asa
non-executable
external
description
of anapplication's
interface.
as
anexecutable external
definition
ofthe
interaction
required
by
anapplication
As
mentioned
in
Sec.
1.3,
the
X
windowsystem
protocolhas
alow
level
C
language
interface,
ontop
of which
additional
libraries
canbe built
orapplications
written.This
C
library
canbe
usedby
the
interface
to
interact
withthe
windowsystem
viaa stream connection.
Contrary
to the
idea
that
using
subroutine
libraries
would mean recompilation andrelinking
the
application source
code, the
userinterface described
in
the
next chapteris
designed
to
be
as
indepen
dent
ofthe
image processing
system as possible.There
are
"hooks" providedin
the
interface
to
allowexecution
ofapplications, but
the
applicationinterface
remainsthe
same asfar
aspossible.
Thus
the
inconvenience
of
experimenting
with variationsin
the
userinterface
is
nolonger
critical.The interfer
ence
andinterplay
between
the
various aspects ofthe
interaction (e.g.
mouse andkeyboard
events
versus
events generated
asynchronously
by
otherprocesses)
withinthe
interface
are not adisadvantage
eitheras
the
interface has
been relatively
isolated
from
the
application softwaresystem.
The
advantages
gained
by
using
the
subroutinelibrary
approach are:the
X
window systemis
becoming
anindustry
windowing
standard,
and soit's
subroutinelibrary
willalso
be
standardized muchlike
the
industry
graphics standards were established.low level interaction details
arebetter handled
through
subroutinepackages.
The
non-executable externaldescription
ofthe
applicationinterface
approachis
usefulfor
comparisonsbut
cannotbe
usedfor
simulations ofthe
final
interface. It may
alsohave
trouble
withdealing
withmore
than
onelevel
ofabstraction,
whichdisqualifies
it from
ourdesign
approach.
The
executable externalinterface
does
overcomethe
problemsfaced
by
the
non-executable
description. However
the two
methodsdescribed
by
Hayes,
namely
Form-Based Abstractions
and
Tran
Chapter 1
Introduction
to the
User Interface
conceptsome
key
features
to
make note
of,
as some
ofthem
areincorporated
in
this
userinterface.
A
coarse grained command
interaction
with afiner
grain
whenneeded,
to
obtain
missing
command parameters and arguments etc.
Graphical
representation
ofthe
format in
whichthe
requiredinformation
needs
to
be
entered.
The interface
systeminterpreting
the
userinput keeps
track
ofthe
current value
ofeach
field in
the
windowformat.
Correction
oferroneous
input,
interactively.
Integral
online-help
and
documentation facility.
Command
looping
in
the
interface
using
highlighted icons
andpreviously
stored parameters to
build
up
the
loop.
The Recursive Transition Network based interface
abstraction usesthe
notion ofinterface
modes
between
whichtransitions take
place
as a result of user actions.Hayes, however,
statesthat
since
this
involves distinct
states,
andtransitions
aredetermined
strictly
by
userinput,
their
suitability
to
graphicalinterfaces is
a
gray
area.This is
because
interface feedback
events are not always associated with amode change.
Also enforcing
restrictions
ontransitions
may
rob the
userinterface
ofsome
ofits
flexi
bility.
Having
decided
ona
specific approach subsequent chaptersdiscuss
the
design
andimplementation
of
the
userinterface,
the
data
structuresneeded, the
approachto
achieving independence from
application
programs,
handling
different image
formats,
graphicsdevices
etc.Variations from
the
originaldesign
objectives
asimplementation
proceededis
also addressedto
illustrate
the
difference between
Chapter 2
Chapter
2:
Design
of
the
XIP
User
Interface
This
chapter
covers the
actual
design
of
the
XIP
userinterface
in
accordance withthe
design
criteria
highlighted
in
the
previous chapter.
The
acronym
XIP
stands
for
X Image
Processing
and
willhen
ceforth
be
usedto
referto the
userinterface. Since
the
userinterface
has
a
greatdeal
ofinteraction
withdifferent
parts
ofthe
system
and
its
devices,
the
details
arebroken up
into
appropriate
logical
subsections.
The
software
systemhierarchy
is
shown
in
figure 2.1.
Notice
that
althoughthe
userinterface
sits
ontop
ofthe
X
server
it does
notnecessarily
imply
isolation from
the
underlying
system.
2.1.
Global
functionality
ofthe XIP
User
Interface
All
X
relatedoperations
arehandled
through
the
X
serverrunning
onthat
host
orthe
remotehost
to
whichthe
requestis
made.The
C
library
Xlib
providesthe
capability
to
make requeststo the
serverto
allocate/modify/deallocate
resources underthe
control ofX. Thus
the
first
category
ofoperations
dis
cussed are related
to
userinteraction
withthe
underlying
system,
followed
by
the
functions
ofthe
userinterface
which areoperating
system related.Actually
sincethe
userinterface has
been
modelled
as adistributed
systemthe
differentiation between
the two
is
notclearly defined.
The lower
end ofinterac
tion
is
withthe
image
processing
system.The
hierarchy
ofthe
systemapparently dictates placing
the
image
processing
system abovethe
OS level.
However
the
application programs run underthe
UNIX
operating
system andthey
operate onimage data
whichis
storedin
the
UNIX
file
system.Thus
the
image
processing
software systemlies in
the
same strata asthe
file
system.Another
issue
to
be
addressed
is
the
image data format
conversion scheme adoptedby
the
userinterface
to
support portability.
As
canbe
seenin
figure
2.2
the
XIP
userinterface
has
eight modulesassociated
withit.
At
this
level
ofabstractiona
moduleimplies
eithera
process spawnedby
the
main program or afunction
call.
The
functionality
of each moduleis
summarizedin
figure 2.2.
INPUT
DEVICES
XLIB,
UIF&
OTHER
LIBRARIES
IMAGE
PROCESSING
USER
INTERFACE
&
WINDOW
MANAGER
J
XWINDOWS
SERVER
\
UNIX
OPERATING
SYSTEM
1
I
i
FILE SYSTEM
IMAGES
onDISK
Xlp
i
ENVIRONMENT
1
1
DISPLAY
DEVICE
1
IMAGE
PROCESSING
SYSTEM
I
IMAGE PROCESSING
PROGRAMS/LIBS
ChaPter 2
Design
of
the
XIP User
Interface
2.2.
Functional
Specification
ofModules
At
the prototype
level
of
each
module
the
description
entails
the
moduletype,
its functional
behavior,
and
its
mode
ofcommunication
withthe
main
process
as
shownin figure 2.2.
A
moredetailed
breakdown
ofthe
underlying
module
interaction is
provided
in
figure 2.5
at
the
end ofthe
chapter.
Notice
that
allthe
module names
have been
abbreviated and
have
the
characterX
as a
prefix.This has been done
to
be
compatible
withthe
client program
naming
conventionin
the
X
environment.
2.2.1.
Error
Window Daemon
(XERRWIN)
Since
errormessages
in
UNIX
are asource
of much strifeto
the
end-userit is
criticalto
providea
separate
errorhandling
capability.
This is
providedby
means of adaemon
processcalled
xerrwin.Even
though
weare able
to
keep
track
ofthe
error conditionin
UNIXf
it is important
to
keep
allthe
underlying details
transparent
from
the
user.This is easily
achievedby
using
a separatetext
windowto
display
errormessages
andany
appropriate
diagnostic
messages.Although
this
does
not guaranteeany
extra robustnessit
does
allowthe
end-userto
continue withoutbeing
confused or cause an uncleantermination
ofthe
userinterface.
Since
error conditions can arise anywhere andin many
numbers,
making
the
errorhandler
aseparate process
is
a clean solution.There
is
a problemhowever.
It is very
possiblefor
morethan
oneprocess which
may
have
been
spawnedby
the
XEP
userinterface
to
raise an error condition.A
single
process,
whose communicationis handled using
the
pipe%
system call underUNIX
is
efficient
but
prevents more
than
one
processto
writeto the
pipe.The
first
implementation
of xerrwin wasdone
using
pipes,
but
wasdiscarded for
this
reason.The
alternativeis
to
use sockets.There
are
relevant merits
anddemerits
ofusing
pipes versus sockets.Pipes
aresimply
a
pair of connected streamsockets
LEF
and
hence
arelimited in
comparison.However
they
arein
the author's experience
easierto
progamwith,
and more reliablethan
sockets.t
refertotheerrno(3)manual pagein
theUNTX
ProgrammersReference Manual.
%
refer to themanual pages on the pipe(2), read(2),&
wrile(2) system callsin
theUNTX Programmers
Reference
Manual.
^H^XCOMWIN
E&&*&i%>^^XERRWIN
mm
XBUTTONS
XCOMWIN:
Type:
Function:
Communication:
XERRWIN:
Type:
Function:
Communication:
XBUTTONS:
Type:
Function:
Communication:
XDISPIMG:
Type:
Function:
Communication:
XSAVEIMG:
Type:
Function:
Communication:
XTRACTROI:
Type:
Function:
Communication:
XPROCROI:
Type:
Function:
Communication:
XDISPROI:
Type:
Function:
Communication:
asynchronous
process,
startedby
XIP
process.reads
keyboard
events,
echoes orreturnsformatted line.
duplex
pipes.asynchronous
daemon
process, startedby
XIP
process.displays
appropriate errorcode&
messagein
scrolledtext
windowspooled queue and message
files.
asynchronous
process,
startedby
XIP
process.monitors mouseclickevents
in button
windows and returnsbutton
code.pipe.
asynchronous
process,
startedby
XIP
process.convert,
dither
&
display
aforeign image in Image
window.parameters passed on command
line
subroutinecall made
by
XIP
process.convert
UIF image back
to
aforeign image
andwriteto
disk.
parameters passedviasubroutine call.
subroutine callmade
by
XIP
process.interactively
extractRegion
ofInterest from
currentimage,
returnco-ordinatesparameters passed via subroutine call.
asynchronous
process,
startedby
XIP
process.convert
UIF
image buffer
to
foreign image
,processand returnUIF image buffer
to
be
displayed
in
Region
ofInterest
window.duplex
pipes.asynchronousprocess,started
by
XIP
process.display
current region ofinterest buffer in Region
ofInterest
window. parameters passed on commandline.
ChaPter 2
Design
of
the
XIP
User Interface
Given
the
above
implementation
problem,
the
approachadapted
is
moregeneral.
The
xerrwindaemon
process
is
started
up
at a
high level
and runs
in
the
background.
Error
messages are
spooledto
a
queue,
whichis
ashared
resource
protected
by
asimple semaphore
mechanism.The
windowdaemon
dequeues
them
reads
and
displays
the
error message
files,
which aresubsequently
removed.Thus
the
daemon is
not aware of
how
many
processes
areenqueueing
errormessages,
and whenit has
access
to
the
queue
it
treats
allmessages
in
the
samefashion.
As
afurther
extension ofthe
error windowimplementation it is
also possibleto
scrollthe
errormessages
in
the
error windowand retrieve
old error messagesusing
the
mouse.This is
usefulsince
error message
usually
are queued
in
bursts
whena
number offunctions
fail,
as a
result ofthe
last
oneraising
an errorflag.
2.2.2.
Command
Window Handler
(XCOMWIN)
The
userinterface is
a visualinteractive
environment andhence
there
is
noexplicit
commandline
where commands are executed
from.
A lot
ofprocessing depends
on userinput,
and allinput
cannotbe
acquired
using
visualtools
like
buttons,
and scrollbars without a sophisticatedtoolkit.
Hence
a command
window which promptsthe
userfor
input,
informs him
ofany intermediate
action,
andcollects
input from
the
useris
vital.This
functionality
is
providedby
the
command windowhandler
calledxcomwin.
Under X
the
keyboard
is
adevice,
which generates unique eventsfor
eachkeystroke (under
allsupported
terminal
emulators).These
events are queuedin
the
X
server,
and
the
application programcan
take
appropriate action.It
is
the
application program whichhas
to
dequeue
and parsethe
input
These
collectedkeyboard
events canbe formatted
into
a commandline,
and passedalong
to the
calling
program/subroutine, while
the
same canbe
echoedin
the
command window.This implementation
also
provides
the
application programthe
choice ofignoring
any keyboard
inputThe
command
windowis
scrolled
like
the
errorwindow,
but
sincethe
implementation
of xcomwinis
a
slaveterminal!
the
scrollcapability
is
a
function
ofthe
terminal
emulator xterm(l).%
seepty(4)in
theUNIX
ReferenceManual.
ChaPter 2
Design
of
the
XIP User
Interface
The
command
window
is
also a
separate
process
whichcommunicates
withthe
parent processthrough
pipes.
Since
full-duplex
communication
is
being
provided,
two
pipes areused,
onefor
eachdirection. The
command
window
handler
suffers
from
a similar problem asthe
earlierimplementation
of
the
errorwindow
handler. When
achild
ofthe
main userinterface
processspawns
the
commandwindow
handler it
causes
the
parent
to
hang
up
whilereading
orwriting
to the
pipe.This
problemhow
ever
does
not
directly
affect
the
execution
ofthe
XIP
userinterface.
2.2.3.
Button
Handling
(XBUTTONS)
The
primary
actions
that the
XIP User
Interface
performs
arethose
providedin
the
form
ofbut
tons.
In
the
current
implementation
eight
buttons
aresupported,
each ofthose
having
a unique actionassociated
withthem.
Management
ofthese
buttons
is handed
down
to
a separateprocess
calledxbut-tons.i Associated
with eachbutton
is
a code.When
abutton
is
clickedit indicates
a response andreturns
the
code
to the
parent process via a pipe.The
parent process can examinethe
code andtake
any
necessary
action.Thus
the
button handler
provides a cleaninterface between
the
userandthe
controlling
process.The
task
ofadding
buttons
needsthe
creation of anicon using
a
bitmap
editorlike bitmap(l). The
icon
files
are
readin
by
the
button
manager whichhas
to
createthe
window and manageinput from
it.
Though
this
processis
simpleit
does
requirethe
recompilation ofthe
userinterface
software.2.2.4.
Displaying
andSaving
Images (XDISPIMG
&
XSAVEIMG)
The primary functions
ofthe
userinterface
are:the
ability
to
display
animage
in
a
variablegeometrytt
windowindependent
ofthe
foreign image format
orthe
type
of monitor(monochrome,
grey-scale or
color)
available,
andthe
ability
to
savethe
image
after allprocessing has
been
completed.
The
modulesxdispimg
andxsaveimg carry
out these
functions.
t
refer tothe xbutlons(lX)manual pagein theXIP User Interface Reference Manual.
ft
theterm geometryin
theX
environment refersto theco-ordinatesof the origin of thewindow, andthe sizeofthewindow.
All
co-ordinates areinpixels andhencearelimited
tothesizeofdisplay
device.
ChaPter
2
Design of
the
XIP User Interface
The image
conversion
details
arehidden
underthe
image
display
routine.Note
that
these
routinesoperate
onentire
images,
as opposed
to
regions ofinterest
which are subsets ofimages.
The
routinesthat
operate on a subset of
the
image
are
discussed in
the
following
section.After
retrieving
animage
from disk
the
image is kept in
a
UIF
image buffer. The
buffer
is
the
data-structure
whichis
mostfre
quently
accessed and modified and
hence its
structureis
important!
The image
windowhas
a variablegeometry
and
it
takes
the size
ofthe
image.
This
is
done
to
preventvisualdistortion
ofthe
actualimage
data
as wellas
limiting
the
region ofinterest
co-ordinates
to the
image dimensions. Selected
regions ofinterest
are,
however,
enlarged
to
exposethe
features
ofthe
image
sub-sectionbeing
studied.The
scaling
operation
is
examined
in
the
next section.After
allprocessing has
been
completedthe current
image
buffer
canbe
savedto
disk. The image
conversion
is
now reversed and once againthe
implementation is
taken
care ofby
lower level
library
routines.
In
this
version ofthe
userinterface
the
cross-conversionbetween foreign image
formats has
not
been
consideredbut it is
afeature
that
couldbe easily
added.2.2.5.
Region
ofInterest
Processing
(XTRACTROI, XDISPROI,
&
XPROCROI)
This
section examinesthe
three
region ofinterest
operations performedin
the
user-interface
namely:
extraction,
display,
andprocessing,
which are performedby
the
xtractroi, xdisproi,
andxpro-croi modules respectively.
A
region ofinterest
is
defined
as a contiguousblock
ofimage data
whichis
a subset ofthe
entireimage.
Once
the
entireimage has been
retrievedfrom disk
anddisplayed in
the
image
window a section
ofdisplayed image
canbe
interactively
extractedby
xtractroifrom
the
image
window and storedin
a
separatebuffer
similarto
the
image buffer. This buffer
couldvery
wellbe
the
entire
image itself
ora small section of
it.
Having
extractedthe
region ofinterest,
it is
displayed in
a separateregion- of-interest
window,
whichhas
a
fixed
rectangulargeometry,
by
xdisproi.The
window sizeis
usually
fixed
at512x512
and
the
%
see AppendixA
for details
on theimage data
structuresChapter 2
Design
of
the
XIP User
Interface
extracted
image
data is
resized to
approximately
that
size.!
The
row and columnfactors
are storedin
the
image
header
so
that the
image
can
be
reduced
whenit is inserted
back
into
the
originalimage
after
processing.
The resizing
algorithm
used
is very
simple
for
reasons
of efficiency: pixel replicationfor
zooming
and pixel
sub-sampling
for
reduction.
Finally
weconsider
the
image processing
operations
to
be
performed onthe
displayed
region ofinterest, by
xprocroi.
In
accordance
with ourdesign philosophy
oftransparency,
modularity,
and portability
all
image processing
operations are carried
out externalto the
userinterface
by
the
underlying
image processing
system.
This
definitely
causes
the
overall performanceto
be
sloweddown,
but
the
benefits
ofisolating
the
system
are moresignificant
in
this
design.
Every
image processing
operationrequires
the
conversion
ofa
region ofinterest
to
a
foreign image
format,
andthe reverse
operation afterthe
programhas
completed.
A
black-box
application,
xconvert performsthis taskt.
The pipelining feature
ofthe
UNIX
operating
systemis
taken
advantageof,
by
specifying
concurrent operations
to
be
performed
in
a pipelineusing
the
same syntax asUNIX
tools.
To
the
underly
ing
image processing
programsin
the pipeline
the
incoming
data
appearsto
be
in
their resident
format
whichafter
being
processedis fed
to
apipe,
oblivious of what willhappen
to
it
afterwards.The
conversion program returns
the
processeddata in
the
userinterface image format
to the
calling
function.
The
calling function displays
the
newbuffer back
on screen.The
obvious advantage ofadapting
such ascheme
is
that
the
userinterface
can nowbe
used withany
otherimage
processing
systemjust
by
adopting its
syntax andby
porting
the
conversion program andthe
image
conversionlibrary.
Displaying
the
region ofinterest
buffer
is
exactly
the
sameas
displaying
animage,
asthe
image
is
converted and writtento
disk,
the
display
is
program executed onthat
data
file. The
loss
in
efficiency
due
to
conversionis
evidentbut
is
forsaken
in
favor
of modularity.The
issue
ofdealing
with colorimages,
colorand
RGB
dithering,
look-up
tables
willbe
addressedin
the
following
chapters.
t
Due
round-off andtruncationerror whilecomputingtheresizedimage dimensions.
t
referto xconverl(lX)manual pagein
theXIP User
Interface Reference Manual.
ChaPter 2
Design
of
the
XIP User Interface
23.
Other
functions
performed
by
XIP
The
major
functions
outlined above
do
broadly
covermost
of whatis
neededfrom
the
userinter
face. However
there
are
afew
other
features
whichmay be
performed
just
as
easily
by
the
main process.
One
suchfeature is
the
ability
to
undo anoperation.
Since
the
region ofinterest
buffer
is
converted
to the
foreign image format before
being
processed,
a
copy
ofthe
buffer
canbe easily
savedin
ahistory
buffer.
Undoing
the
last
operation
thus
implies
displaying
the
history
buffer
in
the
region ofinterest
window.
This is
a
vitalfeature
to
iterative processing
wherehuman
judgement is
being
appliedcontinuously.
The
ability
to
repeat an operationis
also
provided,
andit
involves
storing
the
previouscommand
pipeline which canbe
subsequendy
re-executed onthe
current region ofinterest
buffer.
2.4.
Screen Organization
and
Management
Along
withthe
underlying
functions
performed adescription
ofthe
screen organizationand
its
management
is
necessary.It
has
been decided
that the
userinterface
use variablegeometry
windowswithin
fixed limits
andto
disallow overlapping
image
windows .This may
seema
very
restrictive
approach,
but
it
shouldbe
notedthat this
userinterface
is
gearedtowards
providing
a specific
kind
ofenvironment which should appear
the
same
every
time
the
programis
invoked. An
escapefrom
this
limiting
feature
is
providedto the
expertuser.f
The
userinterface is
running
underthe
X
environment
and
thus
usesthe
resident window manageruwm(l),
for
window reorganization and managementThis
is
elegant and separatesthe
task
ofimage processing from
window/interface managementThe
majorwindows
are
the
image
and region ofinterest
windows as well asthe
error and command windowswhich
are
text
windows.Other accessory
tools
can alsobe
used asthey
arealready
apart
ofX. How
ever
the
moretools the
user startsthe
slowerthe
performance ofthe
userinterface
willbecome.
The
present screen configuration
is
shownin figure
2.3.
All
outputdata
goesto the
image
windows,
all errors are redirectedto the
errorwindows,
and
alluser-input
is
acquiredfrom
the
command window.According
to
figure 2.3 processing capability is
t
referto thexip(J)manual pagein theXIP User Interface Reference Manual.
^
IMAGE
PROCESSING
USER INTERFACE
MjMtMMlHliMMima-WORKSTATION
^~
|
REGIONOF INTEREST
:|::::::::::::;::::::::;:
o
o
O
I
o
o
^o
!
GET
8S
.';: PUT:
ii
FILTER**-<*** .*****i**ii;
**22*22HZ112
INSERT "mm*mtmm*f
tsmmussiiM
quit
;:;:
;
undo;
atmtsi
j
REPEAT ? XTRACT:
BSaSSaaaSa
COMMAND WINDOW
ERROR
WINDOWChapter 2
Design
of
the
XIP User Interface
provided
using
small
button
windows
whichtake
action when selected.The
scenario ofa
button
selec
tion
where
the
userinteractively
selects
andenters
options
is
outlinedin
figure
2.4
and
willbe
dis
cussed
in detail in
the
following
chapter.
2.5.
Limitations
and restrictions
in
the
XIP design
The limitations
andrestrictions
ofthe current
design,
are now summarizedbelow. The list may
grow or shrink
depending
onfuture
design
changes.
Image format
conversion
is
performed
continuously
and slowsdown
the
system.Error
recovery
with pipecommunication
has
notbeen
addressed,
but
the
user
interface is
robust enoughto
be
aborted and restarted.Limiting
windowgeometry
seemsinconvenient
but
is
important
to
screen organization.Entire image
cannot
be
implicitly
processed,
instead
the
region ofinterest is
stretched overthe
entireimage
window.There
is
somedependency
onUNIX
utilities.Only
oneimage
canbe
processed ata
time,
whichis
overcomeby
switching
from
noviceto
expertlevel.
The
following
chapters outlinein
greaterdetail
the
underlying
data-structures,
algorithms,
routines andimplementation details
of each module ofthe
XIP User Interface
.
^
raio
?H
'iWs/wmmmmmwyMAmm'woj
This
is
a
simple example
of
the
sequence
of
operations
a
usergoes
through to
process
an
image. The
sequence
below
illustrates
what
the
userwould
typically
see
on
the
screen.
User
@
Console
Application Menu
Options
Menu
ipsw
1
IP
APPLICATIONS
IliMlMB
Ieqlz
User
selectsbutton
1
ROTATE
IzOOM
User
selects operationSMOOTH
output
image displayed
in ROI
windowCommand
inserted
into
pipeline and
executed.
if
error occurserrormessage echoed
in
error window
Repeat
untilalloptions
are collected
If
Interactive
collect
value
from
command
window.
REGION OF INTEREST
Window
IMAGE
Window
Button
code
sent
via
pipe
ERROR
Window
BUTTON
Handler
COMMAND
Window
Chapter 3
Chapter
3: The Error Window
Daemon
3.1.
Introduction
An
error condition
canarise
from
asystem
or asubroutine call.
It
may
not
be desirable
to
makethe
errorcondition
fatal;
it is
preferable
to trace the
reasonfor
the
errorand
try
to
recovergracefully
instead
ofan
unclean
termination
ofthe
user'sprogram.
The
global
variableermo\
canbe
usedto
index into
the
global
errortable
sysjterr whichhas
acorresponding
error messagefor
each valid errorcode.
However
there
may
be
errorconditions specific to
X
orto the
userinterface
andthese
errorcodes
need
to
be
identified separately
from
the
system errorcodes.
X
has
afunction
(Xerror())
whichhan
dles
any internal
errorconditions.
In
the
presentimplementation,
specific errorsin
the
XIP
userinter
face have
not
been
identified,
but
there
arehooks
providedto
build
an errortable
which canbe
referenced
by
the
errorroutine.
3.2.
Design
As
discussed
in
the
previouschapter,
the
error messagefacility
needsto
be isolated from
normalprocessing.
Whenever
an error conditionis
raisedthe
user program/function can chooseto
print out anerror
message and
either exit or returnto
its
calling
function.
The best way
to
isolate
errorhandling
is
to
use a separate process.Using
a
separate
process
automatically implies
use ofa
inter-process
communication mechanismto
passdown
formatted
errormessage
buffers. In
the
previousimplementation
ofthe
error windowhandler
the
pipe(2)
system callunder
UNIX
wasused,
however
that
preventsmany
client processesfrom writing
to
the same
serverprocess.
Having
discarded
the
client-servermodel,
the
most elegant solutionto this
pr