Importing an Image Stack
In many ways, regular volumes composed of a rectilinear grid of
voxels can be interpreted as a stack of 2D images. The ImportImageStack module
is designed to make it easy to import volumes composed of a set of 2D images.
To import a stack of images, go to File->Load Object->Regular Volume->Image Stack
in the VolSuite main window. This will open a window resembling the following
image:
First, you need to choose the directory containing the images you wish to load.
Press the Choose Directory button and a file chooser dialog will open
that allows you to navigate to and choose a directory. Navigate to the directory
containing the images then push Ok. The module will then scan the directory
for all files and the window should change and resemble the following image:
You will see the scrollbox now contains a list of all files in the directory.
You can use the Pattern input field to specify what files in the directory
to put in the scrollbox. For example, a pattern of "*" lists all files.
A pattern of "*.png" lists all files ending in ".png". A
pattern of "image?.bw" lists the files "image0.bw, image1.bw, ...,
image9.bw".
It is relatively common for images to be consecutively numbered
with integers in their filenames. Typically, the numbers are "padded",
meaning the integers in the filenames are expressed with leading zeros: file001,
file002, ..., file207 instead of file1, file2, ... file207. Padded filenames are
usually sorted correctly in the scrollbox list. Unpadded filenames are almost
never sorted correctly. To help sort them correctly, try pushing the
Lexo-Size Sort button.
If the scrollbox contains only the images that you want to load, and the
image formats are of a type that VolSuite supports, and they are listed in the
correct order in the scrollbox, then just push Load. If the image file
format is not supported by VolSuite, you will probably have to convert them first
to a supported format. If there are extra files listed in the scrollbox that you
do not want to load, you can select a subset of the images through a combination
of click-and-dragging, shift-clicking and ctrl-clicking. Then push either the
Cut button to remove the selected files, or the Keep button to remove
all unselected files, and repeat until you have only the files you want. When you
are satisfied, push Load to load the images.
If you are loading a stack of raw binary images, enable the Raw Images
panel and enter the appropriate values into each of the input fields before
pushing Load. These fields are analagous to those in the
RAW loader module.
To save yourself the effort of going through these steps the next time you want
to load this stack of images, consider making a "VOL" file by pushing
the Make "VOL" File button. "VOL" files can be loaded
far more easily. See the section on loading a "VOL" file
below.
Exporting an Image Stack
To export a volume as a stack of images, go to
File->Save Object->Regular Volume->Image Stack in the VolSuite main
window. This will open a window resembling the following:
Choose a filename for your image stack and an image format type to export the images
in. Push Export when you are ready. A new directory will be created with the
name you have chosen, and each image will
be saved into that directory. For your convenience, a "VOL" file will also be
created.
Importing a RAW Volume
Data generated by physical simulation is often written as a
single raw binary 3D volume to a file. The ImportRAW module is designed to load
this type of volume data. To import a RAW volume, go to File->Load Object->
Regular Volume->RAW Volume in the VolSuite main window. This will open a
window resembling the following:
Choose the filename containing the raw binary data by either typing it into the
Filename input field or using the Browse button to navigate a
file chooser dialog. Then enter the appropriate values into each of the input
fields before pushing Load.
Data is read as Depth images, each consisting of Height rows of
Width pixels each, where each pixel has a certain number of Channels
(e.g. red, green, blue, etc), and each channel is of type Channel Type.
The meanings of each field/option are as follows:
- Header - the number of bytes to skip in the file before the first voxel
- Big Endian - enable this option if the data is stored in the file in the big endian format
- Ascii - enable this option if the data is stored in the file as a series of whitespace delimited ascii numbers. Note that if this option is checked, the Header field turns into a Lines field, in which case that value means how many lines to skip from the start of the file to get to the first voxel.
- Width - how many pixels per row
- Height - how many rows per image
- Depth - how many images in the volume
- Channels - how many channels per pixel
- Channel Type - the type of data in each channel
Note that if your data is of a custom data type (i.e. not char, short, or float), you
can still load it with this module. Simply set the number of channels to be the number
of bytes in your type, and set the Channel Type to 1 byte (char). *NOTE* Keep in mind
that many of the modules that process RegularVolume data are only capable of handling
1, 2, 3, or 4 channel data of 8-, 16-, and 32-bit data.
To save yourself the effort of going through these steps the next time you want
to load this volume, consider making a "VOL" file by pushing
the Make "VOL" File button. "VOL" files can be loaded
far more easily. See the section on loading a "VOL" file
below.
Exporting a RAW Volume
To export a volume as a raw binary file, go to
File->Save Object->Regular Volume->RAW Volume in the VolSuite main
window. This will open a window resembling the following:
Choose a filename for your image raw volume and whether you want the data written
in the big endian format or not, then push Export.
Loading a VOL File
"VOL" files are essentially text files that describe
either a single raw 3D volume or a stack of images. They are easy to make and easy
to load. To load a "VOL" file, simply go to
File->Load Object->Regular Volume->VOL File, and choose the name of
the file to load.
To create a "VOL" file, either use the
Image Stack Loader module or the
RAW Loader module, or edit a new text
file such that it conforms to the following requirements:
Single RAW 3D Volume - Put the following onto exactly two lines in
the text file:
\raw header w h d c cs be filename
where
- header is the offest (in bytes) from the start of the file to
the first byte of the volume
- w is the width (in voxels) of the volume data
- h is the height (in voxels) of the volume data
- d is the depth (in voxels) of the volume data
- c is the number of channels in each voxel
- cs is the size (in bytes) of the channels in each voxel
- be is
0 for little-endian data types and
1 for big-endian data types
- filename is the name of the file containing the raw voxel data
For example, to describe a 128x256x78 single channel volume of floating point
voxels in big-endian format in file "MRIdata.raw":
\raw 0 128 256 78 1 4 1 /path/to/MRIdata.raw
Stack of 2D Images - Simply put the absolute path to each image
on its own line in the the text file. For example:
/path/to/image_file0.rgb
/path/to/image_file1.rgb
/path/to/image_file2.rgb
/path/to/image_file3.rgb
/path/to/image_file4.rgb
For Linux/Unix users, it is easy to generate such a file
using a command similar to the following:
ls -1 /path/to/image_file*.rgb > MyVolFile.vol
If the image data is in a raw format, make the first line in the file:
\imgRaw header w h c cs be
with the same definition for each field as above.
|