JIV can be run either as a Java applet, either as a (standalone) Java application.
Running it as an applet requires an HTML file to invoke it; however,
this can be a very simple file, containing only the applet
tag.
This applet expects a run-time parameter (in the form of an applet
parameter): the URL of a config file, which contains information about
which 3D data volumes to load, the layout of the user interface,
initial settings of various controls, and so on.
The applet can be launched by some HTML code like this:
<applet height=50 width=400 archive="jiv.jar" code="jiv/Main.class"> <param name="cfg" value="config_file"> </applet>where
jiv.jar
should be the URL of the JAR file containing the
JIV Java bytecode, and config_file
should be the URL of the
appropriate JIV config file (config
can be used instead of
cfg
for the parameter name). The config file can also be
supplied ``inline'' within the HTML file using the inline_cfg
(or inline_config
) applet parameter; for
example:
<applet height=50 width=400 archive="jiv.jar" code="jiv/Main.class"> <param name="inline_cfg" value=" ; # config file's content here: ; data1 : data1.raw_byte.gz ; jiv.panel.0 : data1 ; # ... ; "> </applet>Note that, unlike the separate config file, the inline config needs to have each line terminated with the ';' character. Both a separate config file and an inline config can be supplied at the same time: the inline config is read last, so its content takes precendence for keys defined in both places.
The HTML file is not needed when JIV is not run as an applet but as a
regular Java application. In this case, the config file's URL can be
supplied as a command line argument, or as the value of the cfg
or config
Java system properties (``environment variables'').
The top-level class that needs to be run is the same
(jiv/Main.class
).
The config file is expected to be in the following format:
#
or !
are comments and are
ignored.
key = value key : value key valueLeading/trailing whitespace and control characters in
value
are trimmed off.
\newline
:
an escaped newline character is ignored, along with the spaces or
tabs that follow it.
\n
: expands to a newline character.
\r
: expands to a return character.
\t
: expands to a tab character.
\uxxxx
: expands to the Java Unicode character code
specified by the hexadecimal digits.
Keys which start with ``jiv.
'' are JIV configuration options.
Keys which do not start with ``jiv.
'' give the location of the
image data files (image volumes). JIV configuration options refer to
data files by means of data volume aliases, i.e. a kind of a
short name. The alias is displayed as a title at the top of each
panel, hence it's a good idea to choose something descriptive and
short (such that it will fit in the, possibly narrow, panel).
For a given alias ``myalias'', the value associated with key
myalias
is the volume image file's URL (URL-s for the
individual slices are derived from the volume URL, as described in
section 1.3). The value associated with key
myalias.header
is the URL of the header file associated with
the image file(s). All relative URL-s are interpreted relative to the
base URL of the config file, or relative to the base URL of the HTML
file launching the applet if a config file is not defined (by means of
the cfg
or config
applet parameters). If all volumes
have the same header, it is acceptable to specify it only for one of
the volumes; otherwise, a header should be specified for all volumes
(see section 1.3 for the header file format).
The following JIV configuration options are supported:
jiv.sync = [true|false]
jiv.world_coords = [true|false]
jiv.byte_values = [true|false]
jiv.panel.N = alias
alias
, which
should be a data volume alias declared somewhere else in the same
config file). N
should be a non-negative integer and
represents this panel's number.
jiv.panel.N.combine = alias1 alias2
alias1
and alias2
). N
should be a non-negative
integer and represents this panel's number. The two aliases should
be separated by one or more blanks (
) or tabs (\t
).
Also, these two aliases should be displayed in their
individual panels as well. If an alias is displayed in more than one
individual panel, then the lowest numbered such panel is used as the
``source'' for that volume alias.
jiv.panel.N.coding = [gray|grey|hotmetal|spectral|\
red|green|blue|mni_labels]
N
, which has to
be an individual volume panel.
jiv.panel.N.range = L U
N
, which has to be an individual volume
panel. L
and U
should be fractional (float) numbers in
the range 0.0-1.0. The two should be separated by one or more
blanks (
) or tabs (\t
).
jiv.download = [upfront|on_demand|hybrid]
In mode upfront
, all of the data is loaded and stored in
memory before the user can view and interact with any of it. This
guarantees the best interactive response of the viewer, however the
user has to wait for all the data to load before the JIV interface
becomes available. This mode is recommended when the data is
available locally, but is impractical for accessing remote data over
a slow network.
In mode on_demand
image data is loaded one slice at a time,
and only if and when the user is viewing that particular slice
number. This mode is recommended for remote access over very slow
networks. It minimizes the data downloads and the amount of memory
required by JIV, but the interactive performance is completely
dependent on the network speed.
Mode hybrid
combines the other two: the complete image volume
is downloaded in the background, and the slices at the cursor are
downloaded with priority, as soon as they are needed. This mode is
the recommended for typical remote data access situations; it
provides the fast startup of on_demand
and, after the
background downloading completes, the optimal interactive
performance of upfront
.
Panels are displayed left to right, sorted by their increasing number. Note that these numbers do not have to be consecutive -- ``gaps'' in the numbering sequence are silently skipped. Note that the same alias (i.e. the same data volume) can be displayed in several individual and combined volume panels.
The config file is parsed in several passes, so the order of the key/value pairs is irrelevant. However, if several conflicting key/value definitions are given (which is bad practice, by the way), not the last definition given but a random one of them will be considered!
The header file is a text file with the same syntax as the
config file (see section 1.2). The following
statements are supported (where the 3 values of the right-hand side
can be separated by whitespace or ``,
'') :
size : x_size y_size z_size
start : x_start y_start z_start
step : x_step y_step z_step
order : (permutation of {x,y,z})
order : z y x
'' means that the imagerange : range_min range_max
size : 181 217 181 start : -90 -126 -72 step : 1 1 1 order : z y x imagerange : 0.0 1.0
Performance tip: Due to internal optimizations, the initial
download of the image data will be faster if all the steps are
positive and equal (for all dimensions and all image volumes) and the
dimension ordering is 'z y x'
. However this performance
difference will be hardly noticeable when using a modern Java runtime
environment (JVM)...
There are two kinds of image files:
upfront
and the hybrid
download
modes.
on_demand
and the hybrid
download modes.
base and extension are obtained by breaking the
volume file URL at the last ``.
'' (other than the suffixes
.gz
or .bz2
); for example, all of the following:
/some/dir/somename.raw_byte.gz /some/dir/somename.raw_byte /some/dir/somename.gz /some/dir/somenameresult in base = /some/dir/somename .
For converting MNI-MINC data to the JIV input format, two utilities
(Perl scripts) are distributed along with JIV: minc2jiv.pl
, and
jiv.pl
.
Note: the upfront
download mode requires the volume
file(s), the on_demand
mode requires the slice files, and the
hybrid
download mode requires both the volume and the slice
files.