We have a NEW web site, where you can find the newest relevant information on 3DSlicer. These pages are for archival purposes.
Cookbook
|
The Cookbook gives you recipes for common Slicer tasks.
|
1. Acquiring your data
This page is intended to help people who are working at the Surgical Planning
Lab (SPL) to get their data into a safe place to begin working with Slicer.
That data may be from the scanners at Brigham and Women's Hospital, or
imported from other sites.
Check the appropriate link below for your particular situation.
We suggest that other sites create a similar page describing their environment
for data acquisition.
Often, a major obstacle to using Slicer is
finding your data, and getting it into a format that is compatible with Slicer.
Recent MR scans done at Brigham and Women's Hospital
Currently there are 6 MR scanners at the hospital main campus:
- MR1 - main clinical scanner
- MR2 - clinical and research scanner
- MR3 - cardiac and research scanner
- MRT - open magnet for surgical cases
- MRMAX - clinical scanner
- CNIMR1 - Center for Neuroimaging
Data from each scanner is stored in an image database dedicated to the scanner.
Recent data is kept in the database, and is directly available.
As newer data becomes available, older data is archived to tape and removed from the database.
The data persists in the database for different lengths of time, depending on the volume of
scans being done on the scanners.
Generally, the clinical scanners are
busier and data is available in the database for less time.
Here are the typical days
of on-line storage for each scanner:
- MR1 : 7 days
- MR2 : 11 days
- MR3 : 10 days
- MRT : 120 days
- MRMAX : NOT ARCHIVED IN SPL
- CNIMR1 : 30 days
To work with this data, you need to know both the 8-digit Medical Record Number (MRN)
and on which scanner your data was acquired.
Change to the appropriate directory for that scanner data, and make a copy of the
data. (The directories containing the data are read-only.)
The SPL provides
limited short-term storage in a file system located in directory /spl/tmp.
You can use this "staging area" to sort your data and find the series of interest,
before moving the data to another location.
This short-term storage currently provides 100 gigabytes of storage.
Data in this area
will persist for 2 weeks from the time it is last accessed.
For longer term storage, ask your supervisor for some disk space. Most
data sets are either 512x512 resolution or 256x256 resolution and from
50 to hundreds of images, so disk space needed is substantial: from 20
to several hundred megabytes per dataset.
For example, if your data was generated on the main clinical
scanner and the MRN is 12345678 you could use the following sequence of
commands:
-
Make a working directory for yourself in the temporary storage
area:
- Change to the directory with the patient data. The naming schemes for
the scanners are the same as the scanner names above. In this case:
cd /d/MR1/images/idb/GINX/GENESIS/BWS/12345678
- Copy the data to your working directory:
cp -r * /spl/tmp/your_name
Now you have a copy of the data to work with.
Older MR scans done at Brigham and Women's Hospital
We also have long-term backup of virtually all MR cases.
These cases are stored on older
style exabyte tapes as UNIX tar files.
Our current procedure is somewhat cumbersome.
To find your data you need to know the Medical Record Number (MRN) or the patient name.
(Since the MRN is
unique and the patient name may be very common, it is best to use the MRN.) It is also very useful to know the date of the scan that you are interested in, so that you can determine which case you want to restore if there are multiple cases for the patient. This is actually the rule rather than the exception.
Data
archives are also categorized by scanner.
Each scanner has its own series of tapes
and also a command for searching the database for the data you are seeking:
|
Scanner |
Command |
| MR1 | where1 |
| MR2 | where2 |
| MR3 | where3 |
| MRT | wheremrt |
| CNIMR1 | wherecni |
To find an older MR case use the following procedure:
-
Run a script to set up the above commands:
source /local/bin/setup_search
- Search for your data in the appropriate database. In this example, we
will search the MR1 database for MRN 12345678:
This will produce entries of the following form:
/d/nile/backups/MR1/95111/tar25:12345678
/d/nile/backups/MR1/96011/tar12:123456789
The key field above is the one after MR1 (for example, 96011).
This tells the date and tar file: 96 is the year 1996, 01 is the month 01 (January), and the last 1 is the tape number. You can use this information to determine if you have the
correct dataset.
- The next step is to make sure you have enough disk space for the data.
- Then, send both the disk location where to store the data
and the information about the data you want (for example,
/d/nile/backups/MR1/96011/tar12:123456789)
to the manager of the SPL data archive.
He will restore the data from the tape to the disk location for you.
Now you have a copy of the data to work with.
Recent (up to 3 months) CT scans done at Brigham and Women's Hospital
Currently the SPL does not maintain archives of the CT data.
To access recent CT cases, you will need to use the Partners HealthCare System
Radiology Web Server.
To do this, please follow these steps:
- Get a BICS account (if you don't already have one).
After you get
your BICS account, you will be able to look up information in the hospital database
and view images with your browser. However, to transfer the image to the
SPL, you will need to contact the BICS manager and get your BICS account modified
to include data transfer privileges. Also, make sure that your browser
accepts cookies, or you will not be able to use your BICS account.
- Point your browser at RadReport.
- Click RadReport and enter your BICS access key (which you received from
the BICS manager).
- Enter the Medical Record Number (MRN) of the patient, or do a BWH search to
find the information for recent cases. Most of this page is self-explanatory.
The one important field that is not obvious is the one labeled "Stat" (Status) and it is
important to know what the letters stand for:
- S : Scheduled
- I : In progress
- C : Completed
- D : Dictated
- P : Preliminary Report available
- F : Finalized Report
- A : Report Addendum
- X : Cancelled exam
Reports that are not in
F : Finalized are not likely to be available.
- When you have located the dataset of interest, you can view any or all of the images in the series to determine if this is the data that you want. Select
images and click View Image(s).
- After viewing the images, return to the previous page to transfer the images. Click Transfer. Again, you can select any or all of the images to transfer.
- Select Transfer compressed .gz and click Do it!. This will build a
compressed tar file of your images.
This may take a while to complete if you are getting a lot of images.
- When the compression is done, click Click to download study. By default,
the data will go to your home directory, so make sure to change this to
the actual file destination.
- Use the
cd command to change to the directory where your data
has been transferred.
The file images.tar is the compressed tar file.
- Extract the tar file with the UNIX command:
- Uncompress the tar file with the command:
- Remove the tar file with:
Now you have a copy of the data to work with.
Older CT scans done at Brigham and Women's Hospital
The PACS (Picture Archiving and Communications Systems) system only keeps data available online for 1 to 3 months, depending on the volume of
cases. The data is then archived to optical disk, which is not accessible
directly via the Radweb interface.
To get these older cases, you will need to
use one of the following procedures.
Preferred procedure
Note: This method will only work for cases
scanned after September 1998.
- Get a BICS account (if you don't already have one).
You can do this through Suzanne Nagle (x2-6723) or Cheryl Mcdonald-Spriggs (x2-6266).
After you get
your BICS account, you will be able to look up information in the hospital database
and view images with your browser.
However, to transfer the image to the SPL you will need to have your
BICS account modified to include transfer privileges. (Contact Bill Hanlon at x2-5938 or Dave Gigas at x2-6512.) Also, make sure that your browser
accepts cookies, or you will not be able to use your BICS account.
- Point your browser at RadReport.
- Click RadReport and enter your BICS access key (which you received from
the BICS manager). Click Submit.
- Click Search PACS.
- Enter the MRN and as much information that you know about the study that you
want to restore. Click Submit Query.
- A list of cases matching your search criteria will appear as hypertext links.
To put your case in the retrieval queue, click the link. The case should be
restored within 1 hour and will persist in the Radweb database for 30 days.
- After waiting an hour for the case to be restored, follow steps 5-12 in the previous section to
finish restoring the data.
Alternate procedure
- Go to the CT reading area and ask for the chief technician (or someone who can
restore a case to the PACS from the optical disk).
(Unfortunately, we
do not have an established person to handle this procedure. It is sometimes
difficult to find a person who is capable of assisting in this regard.)
You will need to know the patient name, MRN, and date of the exam.
The data is automatically restored so that it is visible from the CT consoles.
- When the case is restored to the PACS, it will show up in a list of
patients available for display at the CT reading stations. From the console,
you (or one of the technicians) can choose to send the data to remote
destination SPL. This will send the data to the SPL.
- Once the data is sent back to the SPL, it will be available in
directory
/spl/tmp/incoming.
This data will be in DICOM (digital imaging and communications in medicine) format.
Any MR or CT scans that you would like to acquire via FTP from a remote site
The SPL provides an anonymous ftp server. To get data to the SPL via ftp,
use the following commands:
-
ftp -i to duke.bwh.harvard.edu (duke's IP address is 134.174.9.66).
-
login as anonymous, using your email address as password.
-
cd pub/incoming
-
binary (this puts you in binary file mode).
-
mput * (this assumes that you are in the directory where the remote images
exist).
- Locally, in the SPL:
-
cp your files to a place to work on them, for example:
cp your_images /spl/tmp/your_name
- After you have made a copy of your data, make sure to remove your
files from the ftp directory.
Now you have a copy of the data to work with.
Any MR or CT scans that you have stored on a CDROM that were acquired at a remote site
Most of the workstations in the SPL are equipped with CDROM readers. To get
your data from CDROM to the SPL you will need to use the following procedure.
- Insert your CDROM into the CDROM reader.
- On the same workstation, change to the directory where the CDROM is
mounted. The mount point is
/cdrom, so the command is:
- Look in this directory for your data. It may take a few minutes to
mount the drive, so be patient.
- When your data shows up, copy it to a "staging area" so that you can
sort through it, for example:
cp -r * /spl/tmp/yourname
- Eject the CDROM with the command:
- Take your CDROM.
Now you have a copy of the data to work with.
top
2. Understanding and Importing your data into Slicer
Slicer can read a number of different image formats, including:
GE Genesis, GE Signa, DICOM (digital imaging and communications in medicine), and no-header format.
You can use the following sequence to load your data into Slicer:
- Type the command:
- On the Main menu, click Data.
- Click Add Volume. The Props panel should appear:
Slicer browser interface
If your data is in DICOM format:
- Click DICOM (some of the letters may not be visible).
- See Using DICOM data with Slicer.
For other data formats:
- Click Browse.
Slicer will open the
directory where you started Slicer from.
- Double-click one of the images that you want to work on, and then click Apply.
Slicer now tries to figure out what kind of data you have so it can properly load and
orient your data. If it succeeds, Slicer will load your data and you will see your images.
If it does not succeed, Slicer will display a
message asking you to enter the header information manually and the following
panel will appear:

Default Slicer header parameters
The default parameters above are the minimum that Slicer requires
to load your data.
Slicer uses these parameters to determine the geometry of your data.
For example, if you have 60 MR images and the parameters for your data are the same as the default parameters, then Slicer would know the following about your data:
- The Field Of View (FOV) of your data, or the distance across your image,
is the product of the Pixel Size and the Width in pixels of the image.
In this case, the FOV would be .9375 x 256 = 240 mm.
- A voxel is a 3-dimensional pixel.
The size of a voxel is the product of the Pixel Size width, the Pixel Size height, and Slice Thickness + Slice Spacing.
In this case, the voxel size is .9375 * .9375 * (1.5 + 0.0) = 1.3183 cubic mm.
- The volume of a slice is the voxel size * Width in pixels * Height in pixels.
In this case, the volume of a slice is 1.3183 * 256 * 256 = 86396 cubic mm, or 86.396 cubic cm (cc).
- The total volume of this dataset is the product of the volume of a slice and the total number of slices. In this case, the total volume of the dataset is 86396 * 60 slices = 5183760 cubic mm or 518.376 cubic cm (cc).
These default parameters are commonly used, but
you will need to know the correct values for your data to view your data properly.
Most
of these parameters should be self-explanatory, except the File Pattern.
This is the pattern for naming the files, expressed in C language syntax. For example, a file named skin.001 has a pattern of %s.%03d, and a file named skin.1 has %s.%d for a pattern.
The default is "%s.%03d".
This means that Slicer is able to
read images numbered with 3 digits after the decimal point (xxx.001 to xxx.999).
If your images are instead numbered xxx.1 to xxx.9, you will need
to change the File Pattern to "%s.%d".
When you have entered all the parameters correctly for your data, click
Apply and Slicer will load the data.
Please note that when you have finished editing your data, the segmented/edited images
that Slicer writes out do not contain any header information. Slicer
encodes this header information into a MRML (Medical Reality Modeling Language) file when you save your
scene. This file describes the volumes that you have loaded into Slicer
and how you have modified them using Slicer's tools.
In most cases, you will want to load more than one dataset.
To load more data,
simply repeat the procedure above.
Slicer typically will display up to three data sets at one time:
a foreground, a background, and a segmented dataset.
When the Data tab is active, the data sets that comprise the current scene
appear in the MRML File Contents (Current Scene) panel. This looks
like:

Description of Scene
If some of your data is incorrect or you want to rearrange the order in which
your data is loaded, you can move or delete it.
- Click on
the offending data.
- Then right-click.
- Select from the menu to either delete or cut and paste the data.
top
3. Using DICOM data with Slicer
Slicer now supports reading DICOM (digital imaging and communications in medicine) Version 3.0 CT and MRI images.
(The SPL gratefully acknowledges Attila Tanacs for the work he did to add this
powerful capability to Slicer.)
Currently, segmented and otherwise modified
DICOM images are written in the same format as other images that Slicer reads.
(For example, the images are written in big-endian format and numbered imagename.001 to
imagename.xxx.)
To read DICOM files with Slicer:
-
On the Main menu, click Data.
- Click Add Volume. The Props panel appears.

-
Click DICOM. (Not all the letters of DICOM may be visible.)
-
Click Select Dicom Volume. (A file browser window appears.
This browser does not sort the file names alphabetically.
If there are many files in a directory,
it may be easier to type the path to the images than to use the browser.)

-
Select an image and click OK.
A window appears, displaying patient information, studies, series, and files.
(If there are many images in the directory, it may take a while for the information to appear.)

- In this window, options include:
- Select or deselect images to load. Selected images are
shown in green and deselected images are shown in red.
- Click Increasing or Decreasing to load images in
increasing or decreasing order.
- Click Preview to display images as small icon-size images in the bottom panel.
You can change the size of the previewed images. The default
size is 32x32 pixels.
- Click List Headers to display header information about the
geometry of each image in the series.
- Click Check to display information about the volume and how
to group the data. With DICOM data, the organization of the data is
not always apparent. Check examines the slice location and thickness of each image
in the volume to make sure all slices are the same distance apart.
This helps to show when slices are missing.
This is also useful when several DICOM acquisitions are lumped together.
-
After the data is organized properly, click OK.
- Click Extract Header.
This
displays the information extracted from the headers describing the
dataset.
top
4. The print_header program
The print_header program reads information from the header of an image (if the
header exists) and extracts useful information to help you understand
your data.
print_header can usually read headers for the following data types:
- GE Signa (This is usually old data.)
- Siemens Somatom
- GE Genesis (Slicer was originally designed for this type of data,
but has been expanded to accommodate other formats.)
- DICOM (Slicer can usually read DICOM (digital imaging and communications in medicine) data directly. However, since
DICOM is such a complicated specification, not all DICOM data will be readable in
Slicer.)
-
print_header can read data in compressed (.gz or .Z) format as well as
uncompressed.
To run print_header, type (for an image called I.001):
The print_header program will print output like this:
print_header V1.0
ENTRY AND POSITION ARE 1 1
input_prefix = I
output_prefix =
suffix = <none>
filename_format = %s.%03d
patient_name = mrsmith
patient_sex = F
date = 8/25/93
time_hr_min_sec = 07:01:32
study_desc = *SPL*LINOMIDE
series_desc = *SPL*FILTER(2d2chan)
hospital_name = BRIGHAM WOMENS HARVARD BAY 2
patient_id = 12345678
exam_modality = MR
image_type_text = genesis
image_type = N/A
sop_instance_uid = N/A
image_time = N/A
manufacturer = N/A
referring_physician =
physician_reading_study = N/A
manufacturers_model_name = Ü
anatomic_structure = N/A
birth_date = N/A
weight = N/A
body_part_examined = N/A
repetition_time = N/A
echo_time = N/A
inversion_time = N/A
reconstruction_diameter = N/A
generator_power = N/A
series_in_study = N/A
images_in_acquisition = N/A
rescale_intercept = N/A
rescale_slope = N/A
requested_proc_desc = N/A
patient_age = 36
x_resolution = 256
y_resolution = 256
bytes_per_slice = 131072
header_size = 7900
slice_number = 1
image_type_num = 2
byte_order = 0
status = 1
number_echoes = 2
echo_number = 1
compressed = 0
first_slice = 1
last_slice = 1
num_missing = 0
bytes_per_pixel = 2
num_bytes_data = 131072
num_bytes_header = 7900
bits_stored = 65535
high_bit = 65535
bits_allocated = 65535
patient_position = HFS
patient_orientation = N/A
number_of_slices = 1
exam_number = 56168
series_number = 1
gantry_tilt = 0.100000
pixel_xsize = 0.937500
pixel_ysize = 0.937500
fov = 240.000000
aspect = 3.200000
thick = 3.000000
space = 0.000000
image_location = -20.000000
coord_center_r = 0.000000
coord_center_a = 0.000000
coord_center_s = -65.000000
coord_normal_r = 0.000000
coord_normal_a = 0.000000
coord_normal_s = 1.000000
coord_r_top_left = 120.000000
coord_a_top_left = 120.000000
coord_s_top_left = -65.000000
coord_r_top_right = -120.000000
coord_a_top_right = 120.000000
coord_s_top_right = -65.000000
coord_r_bottom_right = -120.000000
coord_a_bottom_right = -120.000000
coord_s_bottom_right = -65.000000
imagepositionpatient = 0.000000 0.000000 0.000000
imageorientationpatient = 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
There are several things to note about the output of print_header:
- The information may not be correct, and will be inaccurate if you change
the images without changing the headers.
- Not all of the parameters have meaning for all datatypes.
top
5. Viewing data in Slicer
Slicer can be used to create many kinds of scenes, including:
- A single series of
grayscale images
- A complex scene comprised of several grayscale and
segmented data sets
- 3D models, such as the composite scene below of a
grayscale MR dataset of an orange, with a single
section of the orange (in red) and the rest of the orange (in orange)
Each scene
has two parts in both the Normal mode (shown below) and the 4x512 mode.
(Those two modes seem to be
the most popular viewing modes.)
The top portion is the 3D Viewer.
The bottom portion is the 2D Viewer.
Slicer has many controls over the 3D Viewer and 2D Viewer. Here are some of them.
Selecting the View mode
To select the View mode:
- Click View. A drop-down menu of available view modes appears.
- Select a view mode from the menu. The view will change to reflect your selection.
Different View modes are useful for different situations.
Most users prefer the Normal (shown above) or 4D view for observing data after they are done editing
and creating a scene.
Users also prefer the 4x512 view during the editing process.
Controlling the 3D view
There are several options for controlling the 3D view with the mouse:
- Left-click the view and move the mouse to rotate the view.
- Click the middle button (if available) on the view and move the mouse to move the view left, right, up, or down.
- Right-click the view and move the mouse to change the size of the view.
Annotations on the scene
Slicer can display annotations over images
when you move the mouse around the scene to edit or view data.
You can control the appearance of these annotations.
To control the annotations over images:
- Click More. A drop-down menu of modules appears.
- Click Anno. A panel appears.
- Select the annotation options you prefer.
- To save options, click File, then click Save Current Options. This will save your
options to a file called
Options.xml.
Controlling the 2D view
The 2D view of the scene (see below) can display multiple data sets in a variety of ways.
Each of the three separate windows displays the data as a view from one of the three major axes.
Note: Changing the 2D view may also change the 3D view.
Here are some of the ways to control the 2D view:
- To control whether a slice is visible in the 3D view,
click V for that window.
This is useful to view the orientation of multiple
data sets and models with respect to each other.
- To select a slice in a volume, move the
slider for that window.
- You can view up to three data sets at one time.
To control how each dataset appears:
- Click Fg to select the dataset in the foreground.
- Click Bg to select the dataset in the background.
- Click Lb to display a label map layer.
- Click Or to change the default orientation of the data.
- To change the window/level for one of the views, right-click the view.
A window appears. Adjust the sliders to change the display.

In the view above, you can see different combinations of these controls:
- In the first window, slice 0 is selected; the view is visible in the 3D view; the orientation is Axial; the grayscale data is in the background; the skin is in the foreground; and the label of one section of the orange is loaded as a label map (blue outline).
- In the second window, slice -15 is selected; the view is not visible in the 3D view; the orientation is Saggital; the skin is in the background; the section of the orange is in the foreground; and there is no label map.
- In the third window, slice -3 is selected; the view is not visible in the 3D view; the orientation is Coronal; the grayscale data is in the background; the section of the orange is in the foreground; and there is no label map.
Controlling the scene with the user interface panel
| Move the cursor over the Slicer icon: |
|
| The user interface panel appears: |
|
The controls on the user interface panel include:
- The slider on the left between Fade and Exit is useful
when you have data in the foreground and background.
When the slider is at the top, it will display only the foreground dataset;
when it is at the bottom, it will display only the background dataset.
When the slider is in between, it will blend the two data sets.
This is particularly useful when you are registering two data sets, and want to see how accurate the registration is.
- The head icon rotates the 3D view.
Click R (Right), L (Left), P (Posterior), A (Anterior), I (Inferior), or S (Superior) to rotate the image in each direction.
- The arrows pointing up, down, left, and right can rotate the 3D view in
the appropriate direction. Click the arrow and the 3D view will rotate.
- FOV stands for Field Of View, which is the size of your image.
If the image is too small, enter a larger value for FOV. If the image is too large, enter a smaller value for FOV.
- Save 3D saves the current 3D scene.
Enter a name for the scene in the field.
Slicer saves the scene to the directory where you started Slicer.
- Parallel toggles between a parallel projection
(which preserves parallel lines, and displays an object the same size
regardless of how far from the observer)
and a perspective projection (which displays closer objects as larger than farther objects).
top
6. Editing data in Slicer
Slicer has a set of effects (tools) for editing (or segmenting) your data.
Before Editing
On the Main menu, click Editor.
The Volumes tab appears:
NOTE: Slicer creates (in memory) a working version of the data that reflects your edits (called a label map). When saved, the default file name of this working copy is called Working.
Before you start editing:
- If you have multiple copies of grayscale or label maps that are part of
your scene, select the one you currently want to edit.
- Enter a Descriptive Name that is meaningful for the data
(such as 'vessels' or 'ventricles').
- Click View to change the view mode to 4x512.
When you have finished editing, make sure to save your changes. Slicer
will remind you if you have unsaved volumes and will display the names of
unsaved volumes.
NOTE: Slicer will strip the headers off the images when you save
your data. Slicer encodes the geometry and orientation of your data
in a MRML (Medical Reality Modeling Language) file. You can save, reload, and repeatedly
update your MRML file until you have created the scene you want.
Click Start Editing. The Effects tab appears:
Editing Data
Select the Active Slice to edit by clicking Red, Yellow, or Green.
About the Editing Effects
Some considerations are common to all the editing effects:
- Select the correct input volume of data to edit, so that the edits will be applied properly.
- Set the scope of your edits properly:
one slice (the one on the screen that you are currently editing); three
slices (the current slice and the slices on either side of the current slice);
or the entire volume.
For some effects, such as drawing, it only makes sense to
have the scope of the edits be the current slice.
For other effects, such as thresholding, it makes sense to apply the changes to the
entire 3D volume.
- When you select any of the effects, the following row of buttons
appears:
The button labels are abbreviations for the effects (except for PhaseWire and
Measure Island).
The selected button is the current effect.
A description appears under the row of buttons.
The right-most button is Undo (Un), which becomes available after you apply any effect.
If you click Un, it undoes (or reverses) the last applied effect.
Using the Effects
Threshold effect
The goal of thresholding is to limit the output image to only those pixels
whose signal intensity is between the lower and upper bounds you select.
In the new output volume, all the pixels will have a single label (the Output color).
Threshold is useful for separating the anatomy of interest
from surrounding anatomy, based on the signal intensity of the anatomy of interest. For example, Threshold works well for segmenting bone in CT data.
To use Threshold:
- Click Threshold. This window appears:

- Select the Input Volume.
- Select the Scope and Interact ranges.
- Click Output and select a color, or enter an Output color number. You can also enter an optional label for what that color will represent. For instance, in this example, the chosen color is 2 (orange) and the label is 'skin'.
- Adjust the Lo slider to exclude points whose signal intensity is too low.
- Adjust the Hi slider to exclude points whose signal intensity is too high.
- Click Apply to apply the thresholding effect. Slicer will update the
Working volume with your new label of thresholded data.
Results of thresholding
In the example below, we are segmenting the CT skull bone.
Thresholding has changed the label to be blue.
Notice that the skull is well-defined and separated from the rest of the image.
Change Label effect
The Change Label effect changes the value of the label of pixels to another value.
Change Label is useful when you are merging two data sets together
and you want to keep the data sets distinct from each other.
To use Change Label:
- Click Change Label. This window appears:

- Select the Input Volume.
- Select the Scope range.
- Enter a Value to change. This is the value of label of pixels in the Input Volume that Slicer will change.
- Click Output and select a color, or enter an Output color number. This is the new value that pixels with the Value to change will receive.
- Click Apply to apply the change label effect. Slicer will update the
Working volume with your newly labeled data.
Identify Islands effect
This effect does not currently work.
Change Island effect
The Change Island effect changes the label of an "island" of pixels.
Slicer considers an island to be a group of connected pixels that have the same label.
Change Island is useful when, after applying an effect (particularly thresholding) to the volume, you still are not able to separate the anatomy you are interested in.
For example, surrounding areas may have the same signal intensity as the anatomy of interest, as in the case below: separating the skull is difficult because surrounding points have the same label as the skull itself.
To use Change Island:
- Click Change Island. This window appears:

- Select the Input Volume.
- Select the Scope and Render ranges.
- Click New Label and select a color, or enter a New Label color number. This is the new label value that pixels in the selected island will receive.
- Click any part of the island. The pixels that are part of that island will receive the New Label value.
Results after using Change Island:
Measure Island effect
The Measure Island effect calculates the volume of an island of pixels. Slicer considers an island to be a group of connected pixels that have the same label.
To use Measure Island:
- Click Measure Island. This window appears:
- Select the Input Volume.
- Select the Scope range.
- Click Island Label and select a color, or enter an Island Label color number. Measure Island will calculate the volume of the pixels with the Island Label color in the selected island.
- Click any part of the island. Slicer will display the Size, in pixels, of the island you clicked. Slicer will also display the size of the Largest island within the selected Scope.
To calculate the total volume of the selected island,
use the following formula:
size * pixel_size * pixel_size * (thickness + spacing)
Erode effect
The Erode effect removes pixels at the border of all islands. Slicer considers an island to be a group of connected pixels that have the same label. Dilation is the opposite effect, and adds pixels around the borders of all islands.
Erode is useful for separating two distinct pieces of anatomy that are only partially connected, or for removing many small islands,
some of which are connected to the anatomy of interest (as shown below).
To use Erode:
- Click Erode. This window appears:
- Select the Input Volume.
- Select the Scope range. Multi Slice applies the one-slice erosion to each slice.
3D treats the whole volume at once.
- Click Value to Erode and select a color, or enter a Value to Erode color number. Erode will act only on pixels with the selected Value to Erode color.
- Enter 0 for the Fill value.
- Enter the number of times to apply the effect in the Iterations field.
- Select 4 for Neighborhood Size for less erosion or 8 for more erosion.
- Select Active to apply Erode to the active view. Select Native to apply Erode to the original view.
- Click either:
- Erode to remove pixels with the Value to Erode from around islands.
- Dilate to add pixels with the Value to Erode around islands.
- Erode & Dilate to erode, then dilate.
- Dilate & Erode to dilate, then erode.
Results after using Erode:
Draw effect
The Draw effect lets you specify pixels by drawing directly on them.
Draw is useful when automatic methods cannot segment the data correctly.
To use Draw:
- Click Draw. This window appears:
- Click Output and select a color, or enter an Output color number. This is the new value that pixels you draw on will receive.
- Enter a value for the Point Radius, which controls how fine each line of the drawing is. Using a value of 1 or 2 allows you to select individual points.
- Select the Mode of the left mouse button in the draw window.
Draw is for drawing on points. Select is for selecting points. Move is for moving selected points.
- If the Mode is Select or Move, you can use:
- Select All to select all points.
- Deselect All to deselect all points.
- Delete Selected to delete selected points.
- Delete All to delete all points.
- Select the Render range.
- Select the Shape that the left mouse represents in the draw window.
- Draw on the region of interest (ROI), using the left mouse button.
You can use the right mouse button to zoom in and out on the area.
The middle mouse button moves the image in the window.
- To clear the list of points after you click Apply, click Yes. To keep the same points in a list after you click Apply, click No.
- When you have finished drawing the outline of the ROI, click Apply.
Slicer will fill the ROI with the Output color.
Remove Islands effect
This function does not work.
Save Island effect
Save Island will retain the selected island, and remove disconnected pixels with the same label.
Save Island is useful for separating a single connected structure from other structures.
PhaseWire effect
PhaseWire is a semi-automatic tool to outline features on images by following edges or contours.
Using PhaseWire is a rapid way to outline a feature.
To use PhaseWire:
- Click PhaseWire. This window appears:
- Click Basic. (Only the Basic features work.)
- Click Output and select a color, or enter an Output color number. This is the new value that pixels you outline will receive.
- Select the Render range.
- Select the Shape of the outline.
Polygon will fill in the feature when you click Apply.
Lines will create only the outline and not fill in the feature.
- Select the Image Feature Size.
- Click the left mouse on the edge of the feature that you want to outline.
Release the mouse button, but follow the edge with the mouse.
If the "wire" starts to stray from the edge, click the mouse button to pull in the wire.
- To undo the last mouse click, click Undo Last Click.
- To start the outline process again, click Clear Contour.
- When you have finished drawing the outline of the ROI, click Apply.
If Polygon is selected, Slicer will fill the ROI with the Output color.
If Lines is selected, Slicer will outline the ROI with the Output color.
top
7. Image Registration
It is often useful to register (align) one dataset to another.
For example, you can view data for one patient from several different times.
Or, you can view data for one patient using multiple imaging modalities,
such as CT and MR.
Slicer uses the rigid registration technique,
which shifts or rotates one dataset onto the other dataset without warping either dataset.
As a result, Slicer's current registration method is best suited to registering
multiple data sets for the same patient.
To begin registration:
-
Click Data on the Main menu. The Data panel appears.
-
Select the volume(s) and/or model(s) that you would like to move with this transform.
- Click Data.
- Click one of the volumes. This will highlight the volume.
-
Click Add Transform to surround them with a transform.
This will create an identity matrix.
- Click Alignments.
- Click Manual.
- Move the slider in the user interface panel at the bottom-left
(near the Exit and Fade buttons) so that
both volumes are visible.
- Use the translation and rotation sliders to move one dataset into alignment
with the other. You can also drag one dataset to align it with the other dataset.
Example of Registration
Below is how a scene looks before the two data sets are aligned.
The data sets show the top and bottom of a skull.
The white areas are areas of overlap.
(Click image for a larger picture.)
Below is the scene after manually moving the top of the skull.
(Click image for a larger picture.)
The data is now approximately aligned. The white strip is where the two data sets overlap.
If we save this scene and examine the resulting .xml file, there is a text entry similar to the following:
Matrix name='manual7' matrix='1 0 0 -9 0 1 0 -12 0 0 1 105 0 0 0 1'
This Matrix entry precedes one of the Volumes and describes the rigid transform that
moves the top part of the skull into alignment with the bottom part.
Slicer loads in the two misaligned data sets and then applies
the above transform to create the scene with the data properly aligned.
Automatic Registration
Slicer has the ability to perform automatic registration.
However, it is a good idea to start with a manual registration, as described above,
before letting the automatic registration refine the alignment.
To perform automatic registration:
- Click Alignments.
- Click Auto.
- Select one of the matrices generated in the manual registration
phase.
- Select the reference volume and the volume to move.
- Click Run. The automatic registration will run.
This will take a few minutes, including initialization and a series of displays
that appear and disappear.
If we save this new scene and examine the resulting .xml file, there is a new text entry for the matrix:
Matrix name='manual7' matrix='0.999995 0.001058 0.003264 -8.39007 -0.001059 1 0.000422 -11.1639 -0.003263 -0.000425 0.999996 102.155 0 0 0 1'
Note that the numbers in this matrix (resulting from automatic registration) are very similar to those for manual registration, but are more precise.
top
8. Creating 3D Models with Slicer
One of the most important uses of Slicer is to create three dimensional reconstructions
of anatomical structures, using two dimensional slices as input.
This type of reconstruction is called a 3D model.
The input to this process is label map data that has been
created with Slicer's editing tools.
To create a 3D model:
- From the Main menu, click ModelMaker. The ModelMaker panel appears.
- Click the Create tab. The Create panel appears.
- Select the Volume.
- Click Label and select a color, or enter a Label color number.
This is the value that will be used to create the model.
This should correspond to the value in the label map.
- Enter a Name for this model.
- Enter a Smooth value, which controls how smooth the resulting model will be.
- Enter a Decimate value, which indicates how redundant polygons will be reduced.
- Click Create to start the model creation process.
Here is an example.
Below is a skull image segmented using the Threshold effect.
All voxels labeled 4 (blue) will be included in the resulting model.
Below is the resulting 3D skull model.
top
9. Possible caveats
Some Slicer caveats and some possible solutions
Slicer is a research effort and a work in progress. As such, there are
many features that don't always work in all cases. Here are some
known issues and some ways to deal with them.
- My data is 512x512 resolution and this seems to confuse Slicer.
Originally, Slicer was designed for images that are 256x256 resolution.
However, Slicer has been modified to accommodate 512x512 and larger images.
If your data is 512x512,
and Slicer is still having difficulties handling it,
try reducing the resolution of your data to 256x256 resolution.
If you do this, please realize that:
- Your reduced number of pixels will now be twice as big as they were,
since there are half as many pixels in the X direction
and half as many in the Y-direction after reduction.
- In most cases, the reduced data sets look visually acceptable.
But, since there is one-fourth the information in each reduced slice,
some smaller structures may not be acceptable for viewing or editing.
- The headers on my data are confusing Slicer.
Some users find that things work best if they record the information about their images manually,
and then throw the headers away.
Any data that you create and save with Slicer will be written out in no-header format and numbered
slice.001 to slice.xxx where xxx is the highest numbered slice.
- When I try to save my changes, Slicer crashes and prints a "Segmentation fault" message.
Segmentation fault is usually caused by one of two reasons:
- The user is trying to write data to a directory that is owned by
another user.
- The user is trying to write data to a full file system.
To check if the file system is full, change to the directory where the data is
and try to copy one image to a temporary file in the same directory (for example,
cp I.001 junk).
If this does not work, then the file system is likely full.
Note that the df command does not always give the correct results,
so the above approach is preferred
top
10. Saving the scene description to an XML file
In the File menu, there are several save options:
-
Save Scene
This command will save the current session with a default name data.xml.
If the user has previously specified a name, it will save the file as name.xml.
-
Save Scene As
Allows the user to specify a name for the .xml file.
Once the user has specified a name,
use Save Scene for subsequent saves.
- Save Current Options
Allows the user to save a file titled Options.xml that contains the options selected
during the current Slicer session (for example, the FOV, window settings, and so forth).
- Save Scene with Options
Allows the user to save the scene (see Save Scene or Save Scene As above) and the options associated with the current Slicer session.
How to use these save options:
- Launch Slicer from the directory where you would like to save the label maps,
.xml files, and models.
- Load the data that you want to segment, and select values for viewing, such as FOV.
- Use Save Scene As to save an
.xml file with a specific name.
- Use Save Scene with Options to save the scene with your selected options.
- Begin segmentation. Save the label maps.
- Use Save Scene with Options to save the scene.
- Any time that you change and save the label maps, use Save Scene with Options to save the scene.
top