National Alliance for Medical Image Computing Diffusion Tensor Imaging: from Dicom to Nrrd Sonia Pujol, Ph.D. Randy Gollub, M.D., Ph.D. Surgical Planning Laboratory -1- http://www.slicer.org Brigham and Women’s.

Download Report

Transcript National Alliance for Medical Image Computing Diffusion Tensor Imaging: from Dicom to Nrrd Sonia Pujol, Ph.D. Randy Gollub, M.D., Ph.D. Surgical Planning Laboratory -1- http://www.slicer.org Brigham and Women’s.

National Alliance for Medical Image Computing
Diffusion Tensor Imaging:
from Dicom to Nrrd
Sonia Pujol, Ph.D.
Randy Gollub, M.D., Ph.D.
Surgical Planning Laboratory
-1-
http://www.slicer.org
Brigham and Women’s Hospital
Acknowledgments
National Alliance for Medical Image Computing
NIH U54EB005149
Neuroimage Analysis Center
NIH P41RR013218
Laboratory of Mathematics in Imaging,
Brigham and Women’s Hospital
Thanks to Dr. Gordon Kindlmann
Dartmouth Hitchcock Medical Center
Thanks to Dr. Andy Saykin
Surgical Planning Laboratory
-2-
http://www.slicer.org
Brigham and Women’s Hospital
Goal of the Tutorial
Raw Data
Raw Data
Raw Data
Dicom
Dicom
Header
Dicom
Header
Dicom
Header
Header
Raw Data
Nrrd
Header
Surgical Planning Laboratory
-3-
http://www.slicer.org
Training on how to
convert DICOM
DWI data to the
Nrrd File format,
compatible with
Slicer visualization
and analysis
Brigham and Women’s Hospital
Overview
•
•
•
•
Part 1: DWI data specificity
Part 2: Nrrd description
Part 3: Generating Nrrd Files
Part 4: Working with DICOM DWI
training data
• Part 5: Orientation validation
within Slicer
Surgical Planning Laboratory
-4-
http://www.slicer.org
Brigham and Women’s Hospital
Diffusion Weighted Imaging
Diffusion
Sensitizing
Gradients
Diffusion
Weighted
Images
The signal is dimmer when the direction of the applied
gradient is parallel to the principal direction of diffusion.
Surgical Planning Laboratory
-5-
http://www.slicer.org
Brigham and Women’s Hospital
Diffusion Weighted Imaging (DWI)
Example: Correlation between the orientation of
the 11th gradient and the signal intensity in the
Splenium of the Corpus Callosum
Surgical Planning Laboratory
-6-
http://www.slicer.org
Brigham and Women’s Hospital
Diffusion Weighted Imaging
bgˆi T Dgˆ i
Si  S0 e
(Stejskal and Tanner 1965, Basser 1994 )
Diffusion
Weighted
Images

{Si} represent the signal intensities in
presence of the diffusion sensitizing
gradients gi
b is the diffusion weighted parameter
Surgical Planning Laboratory
-7-
http://www.slicer.org
Brigham and Women’s Hospital
Background
• Challenge: Concise and standardized description of
the information contained in DWI data.
• Current situation:
– DICOM (Supplement 49) contains information on how to
represent b-value and gradient directions of DWI
– However every MR Scanner manufacturer has their own
unique way of archiving the relevant image acquisition
parameters
– The definition of the coordinate frame of the diffusion
gradients is not explicitly recorded in the header
• Proposed Solution: Nrrd format
Surgical Planning Laboratory
-8-
http://www.slicer.org
Brigham and Women’s Hospital
Which image is correct ?
Surgical Planning Laboratory
-9-
http://www.slicer.org
Brigham and Women’s Hospital
Which image is correct ?
Surgical Planning Laboratory
-10-
http://www.slicer.org
Brigham and Women’s Hospital
The left one is correct
Surgical Planning Laboratory
-11-
http://www.slicer.org
Brigham and Women’s Hospital
Overview
•
•
•
•
Part 1: DWI data specificity
Part 2: Nrrd description
Part 3: Generating Nrrd Files
Part 4: Working with DICOM DWI
training data
• Part 5: Orientation validation
within Slicer
Surgical Planning Laboratory
-12-
http://www.slicer.org
Brigham and Women’s Hospital
Nearly Raw Raster Data (Nrrd)
• The flexible Nrrd format includes a single header file
and image file(s) that can be separate or combined.
Nrrd
+
Raw Data
Raw Data
Raw Data
Header
• A Nrrd header accurately represents N-dimensional
raster information for scientific visualization and
medical image processing.
Surgical Planning Laboratory
-13-
http://www.slicer.org
Brigham and Women’s Hospital
Nrrd file format
• NA-MIC has developed a robust way of using the
Nrrd format to represent DWI volumes
Surgical Planning Laboratory
-14-
http://www.slicer.org
Brigham and Women’s Hospital
Nrrd file format
• DWI data written into Nrrd format with appropriate
parameters can be read into 3D Slicer
Surgical Planning Laboratory
-15-
http://www.slicer.org
Brigham and Women’s Hospital
Coordinate Frames
Courtesy
G.Kindlmann
(X,Y,Z)
Diffusion
Sensitizing
Gradients
Surgical Planning Laboratory
-16-
http://www.slicer.org
(I,J,K)
Diffusion
Weighted
Images
Brigham and
Women’s Hospital
Courtesy
G.Kindlmann
Coordinate Frames
Diffusion
Sensitizing
Gradients
(X,Y,Z)
DWI Image
Orientation
(X,Y,Z)
(I,J,K)
(I,J,K)
Patient Space
Courtesy G.Kindlmann
Surgical Planning Laboratory
-17-
http://www.slicer.org
Brigham and Women’s Hospital
Transformation matrices
(I,J,K)
(X,Y,Z)
T: XYZRAS
Surgical Planning Laboratory
-18-
http://www.slicer.org
T: IJKRAS
(R,A,S)
Brigham and
Women’s Hospital
Courtesy
G.Kindlmann
Nrrd Terminology
(X,Y,Z)
(I,J,K)
T: XYZRAS
Surgical Planning Laboratory
-19-
http://www.slicer.org
T: IJKRAS
(R,A,S)
Brigham and
Women’s Hospital
Courtesy
G.Kindlmann
Nrrd requirements for DWI data
To generate a Nrrd header for DWI data, you’ll
need to know information about data representation:
•
DWI Volume characteristics
– Data Type
– Endianess
– Dimensions
•
Disk Storage
– Axis Ordering
Surgical Planning Laboratory
-20-
http://www.slicer.org
Brigham and Women’s Hospital
Nrrd requirements for DWI data
To generate a Nrrd header for DWI data, you’ll
need to know the acquisition parameters:
•
Coordinate Frames
– DWI Image Orientation
– Gradient Measurement Frame
Surgical Planning Laboratory
-21-
http://www.slicer.org
Brigham and Women’s Hospital
Overview
•
•
•
•
Part 1: DWI data specificity
Part 2: Nrrd description
Part 3: Generating Nrrd Files
Part 4: Working with DICOM DWI
training data
• Part 5: Orientation validation
within Slicer
Surgical Planning Laboratory
-22-
http://www.slicer.org
Brigham and Women’s Hospital
Generating Nrrd Files
• Nrrd files can be generated from the Tk
console of Slicer using the “unu” command
line tool
• unu is part of set of libraries called “Teem”
compiled into Slicer 2.6
http://teem.sourceforge.net/
• Slicer includes a Nrrd reader to load DWI
volumes in Nrrd format
Surgical Planning Laboratory
-23-
http://www.slicer.org
Brigham and Women’s Hospital
Unu syntax
• General Syntax:
unu cmd -i input -o output
• Tips:
“unu”  list of unu commands
“unu cmd” help on cmd
Surgical Planning Laboratory
-24-
http://www.slicer.org
Brigham and Women’s Hospital
Unu syntax: ‘make’ command
• ‘make’ syntax:
unu make -i input -o output
• ‘make’ documentation:
unu make help on make
Surgical Planning Laboratory
-25-
http://www.slicer.org
Brigham and Women’s Hospital
Running unu on Windows
To run the unu command from the Tk
console, type unu.
On Windows, you do not need to be in the
directory win32/bin/teem-build/bin
 the unu commands run from any location.
Surgical Planning Laboratory
-26-
http://www.slicer.org
Brigham and Women’s Hospital
Running unu on Mac/Linux/Solaris
To run the unu command from the Tk console,
you need to enter the whole path to the /bin
directory
Ex: Mac ../slicer2.6-opt-darwin-ppc-2006-0518/Lib/darwin-ppc/teem-build/bin
Surgical Planning Laboratory
-27-
http://www.slicer.org
Brigham and Women’s Hospital
Overview
•
•
•
•
Part 1: DWI data specificity
Part 2: Nrrd description
Part 3: Generating Nrrd Files
Part 4: Working with DICOM DWI
training data
• Part 5: Orientation validation
within Slicer
Surgical Planning Laboratory
-28-
http://www.slicer.org
Brigham and Women’s Hospital
DICOM DWI Training Data
• 2 Baselines and 12 Gradients
• 504 DICOM images named S4.xxx where
xxx is the image number
Surgical Planning Laboratory
-29-
http://www.slicer.org
Brigham and Women’s Hospital
DWI Training Data
-30-
Type the command cd and enter the path to your data in
Brigham and Women’s Hospital
Surgical Planning Laboratory
the
Tk
Console.
Type
ls
to
list
all
the data files.
http://www.slicer.org
DWI Training Data
The dataset is composed of
504 images named S4.xxx
Surgical Planning Laboratory
-31-
http://www.slicer.org
Brigham and Women’s Hospital
Unu command (Windows)
Type the unu command with the input, encoding and
byteskip fields
unu make -h --input S4.%03d 1 504 1 2 --encoding raw --byteskip -1
Do not hit
Min index
Enter
Surgical Planning Laboratory
-32-
http://www.slicer.org
Max index
2D Image
Read
Brigham and backwards
Women’s Hospital from
Increment
end of file
Unu command (Mac/Linux)
Type the unu command with the input, encoding and
byteskip fields
slicer2.6-opt-darwin-ppc2006-05-18/Lib/darwinppc/teem-build/bin
unu make -h --input S4.%03d 1 504 1 2 --encoding raw --byteskip -1
2D Image
Min index
Surgical Planning Laboratory
-33-
http://www.slicer.org
Max index
Read
Brigham and backwards
Women’s Hospital from
Increment
end of file
Numbers as file naming convention (*)
unu make -h --input S4.%03d 1 504 1 2 --encoding raw --byteskip -1
• % is a special character to be replaced by the
specific file number (cf C/C++ printf command)
• %03d means a 3 digit number with zero
“padding”: Padding means there will be zeros
instead of spaces at the beginning of the number
Ex: %03d  S4.001 for file number 1
%03d  S4.024 for file number 24
• This is a compact way to refer to the whole
image sequence
(*) Background information
Surgical Planning Laboratory
-34-
http://www.slicer.org
Brigham and Women’s Hospital
Read the DICOM Header
Click on AddVolume
Surgical Planning Laboratory
-35-
http://www.slicer.org
Brigham and Women’s Hospital
Read the DICOM Header
The Props panel appears.
Select the Properties Dicom
Surgical Planning Laboratory
-36-
http://www.slicer.org
Brigham and Women’s Hospital
Read the DICOM Header
The Dicom Props panel appears.
Click on Select Dicom
Volume and browse to
load the dataset located in
the directory dwi-dicom
Surgical Planning Laboratory
-37-
http://www.slicer.org
Brigham and Women’s Hospital
Read the Dicom Header
Slicer displays the list of
Dicom files in the directory.
Click on OK
Surgical Planning Laboratory
-38-
http://www.slicer.org
Brigham and Women’s Hospital
Read the Dicom Header
Click on Extract Header to display
the content of the Dicom Header.
Surgical Planning Laboratory
-39-
http://www.slicer.org
Brigham and Women’s Hospital
Read the Dicom Header
Slicer displays the content of
the Dicom Header.
This information will be used to
generate the Nrrd header.
Surgical Planning Laboratory
-40-
http://www.slicer.org
Brigham and Women’s Hospital
Extracting the volume characteristics
Extract the values corresponding to
the following information:
- Data Type
- Endianess
- Image Dimensions
Surgical Planning Laboratory
-41-
http://www.slicer.org
Brigham and Women’s Hospital
Extracting the volume characteristics
- Data Type: Short
- Endianess: Little
Surgical Planning Laboratory
-42-
http://www.slicer.org
Brigham and Women’s Hospital
Unu Command
Add the fields endian and type to the unu command
--endian little --type short
Surgical Planning Laboratory
-43-
http://www.slicer.org
Brigham and Women’s Hospital
Extracting the volume characteristics
Image Dimensions: 256 pixels x 256 pixels
The dataset was acquired with Nb=2
Baselines and Ng=12 Gradients
Surgical Planning Laboratory
-44-
http://www.slicer.org
Brigham and Women’s Hospital
DICOM DWI Training Data
• 2 Baselines and 12 Gradients
• 504 DICOM images named S4.xxx where
xxx is the image number
Surgical Planning Laboratory
-45-
http://www.slicer.org
Brigham and Women’s Hospital
Extracting the volume characteristics
Image Dimensions: 256 pixels x 256 pixels
The dataset was acquired with Nb=2
Baselines and Ng=12 Gradients
n=NbxNg = 12 + 2 = 14 intensity values/voxel
NSlices= NdicomImages/n = 504/14 = 36 slices
Surgical Planning Laboratory
-46-
http://www.slicer.org
Brigham and Women’s Hospital
Unu Command
Add the fields size and centering to the unu command
Medical
images are
cell-centered
samples
--size 256 256 36 14
--centering cell cell cell none
Surgical Planning Laboratory
-47-
http://www.slicer.org
Brigham and Women’s Hospital
Slice Thickness
Extract the slice thickness from
the Dicom header
Surgical Planning Laboratory
-48-
http://www.slicer.org
Brigham and Women’s Hospital
Slice Thickness
slice thickness = 3.00 mm
Surgical Planning Laboratory
-49-
http://www.slicer.org
Brigham and Women’s Hospital
Slice Thickness
Add the field thickness to the unu command
--thickness nan nan 3.0 nan
Surgical Planning Laboratory
-50-
http://www.slicer.org
Brigham and Women’s Hospital
Building the transformation matrices
We specifically change orientation from the DICOM default of Left
Posterior-Superior (LPS) to Right-Anterior-Superior (RAS)
so that the data can be viewed in Slicer coordinate space
DICOM: LPS
Surgical Planning Laboratory
-51-
http://www.slicer.org
SLICER: RAS
Brigham and Women’s Hospital
Space Directions
Add the field space to the unu command
--space right-anterior-superior
Surgical Planning Laboratory
-52-
http://www.slicer.org
Brigham and Women’s Hospital
Space Directions
Extract the pixel size from
the Dicom Header.
Surgical Planning Laboratory
-53-
http://www.slicer.org
Brigham and Women’s Hospital
Space Directions
Pixel size = 0.9375 mm x 0.9375 mm
The dataset was acquired with
Superior-Inferior slice ordering
Surgical Planning Laboratory
-54-
http://www.slicer.org
Brigham and Women’s Hospital
Space Directions
Add the fields directions and unit to the unu command
--directions “(-0.9375,0,0) (0,-0.9375,0) (0,0,-3) none“
DICOM: LPS
Surgical Planning Laboratory
-55-
http://www.slicer.org
SLICER: RAS
Brigham and Women’s Hospital
Space Origin
The space origin is the position of
the first pixel in the first image.
This information is contained in the
Dicom Header of the first slice.
Courtesy G.Kindlmann
Surgical Planning Laboratory
-56-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
The space origin information is
located in the Dicom header
[0020,0032, Image
Position Patient ]
Courtesy G.Kindlmann
Surgical Planning Laboratory
-57-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Click on Cancel to come
back to the Main menu
Create a directory called
FirstSlice and copy the first file
S4.001 of the Dicom-dwi
dataset
Surgical Planning Laboratory
-58-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Click Add Volume
select the tab Props,
and the format DICOM
Surgical Planning Laboratory
-59-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Click on Select DICOM Volume
Select the directory /FirstSlice
containing the first slice
Surgical Planning Laboratory
-60-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Click on List Headers to
display the content of the
header of the first image.
Surgical Planning Laboratory
-61-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Slicer displays the content of
the header of the first image.
Surgical Planning Laboratory
-62-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Scroll down to display the value of the tag
[0020,0032, Image Position Patient ]
Surgical Planning Laboratory
-63-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
[0020,0032, Image Position Patient ]
= -125.0, -124.09, 79.30
Surgical Planning Laboratory
-64-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Click on OK to close the Dicom Header
Window
Surgical Planning Laboratory
-65-
http://www.slicer.org
Brigham and Women’s Hospital
Space Origin
Add the field origin to the unu command
--origin "(+125.0,+124.10,79.30)"
Surgical Planning Laboratory
-66-
DICOM: LPS
http://www.slicer.org
Brigham and Women’s Hospital
SLICER: RAS
Measurement Frame
Surgical Planning Laboratory
-67-
http://www.slicer.org
Brigham and Women’s Hospital
Measurement Frame
Surgical Planning Laboratory
-68-
http://www.slicer.org
Brigham and Women’s Hospital
Measurement Frame
Add the field measurement frame to the unu command
--measurementframe “(0,-1,0) (1,0,0) (0,0,-1)"
Surgical Planning Laboratory
-69-
http://www.slicer.org
Brigham and Women’s Hospital
Axis Ordering
Courtesy G.Kindlmann
Surgical Planning Laboratory
-70-
http://www.slicer.org
Brigham and Women’s Hospital
Axis Ordering
Add the field kinds to the unu command
Axis Ordering:
columns, rows,
slices, intensity
values
--kind space space space list
Surgical Planning Laboratory
-71-
http://www.slicer.org
Brigham and Women’s Hospital
Output File
Add the field output to the unu command
--output myNrrdDWI.nhdr
Surgical Planning Laboratory
-72-
http://www.slicer.org
Brigham and Women’s Hospital
Output File
Type ls in the Tk Console
The file myNrrdDWI.nhdr is listed in the directory
Surgical Planning Laboratory
-73-
http://www.slicer.org
Brigham and Women’s Hospital
Acquisition parameters
Open the file MyNrrdDWI.nhdr with a text Editor
Surgical Planning Laboratory
-74-
http://www.slicer.org
Brigham and Women’s Hospital
Acquisition parameters
Open a web browser at the location
http://www.na-mic.org/Wiki/index.php/Dartmouth-DWI-parameters
Surgical Planning Laboratory
-75-
http://www.slicer.org
Brigham and Women’s Hospital
Acquisition parameters
Copy the acquisition parameters from this wiki page to the end of the file
MyNrrdDWI.nhdr, hit Enter and save the resulting file
Surgical Planning Laboratory
-76-
http://www.slicer.org
Brigham and Women’s Hospital
Result
Final result of the
tutorial: Nrrd header
for the DWI training
dataset
Surgical Planning Laboratory
-77-
http://www.slicer.org
Brigham and Women’s Hospital
Overview
•
•
•
•
Part 1: DWI data specificity
Part 2: Nrrd description
Part 3: Generating Nrrd Files
Part 4: Working with DICOM DWI
training data
• Part 5: Orientation validation
within Slicer
Surgical Planning Laboratory
-78-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
Click on Cancel to come
back to the Main Menu
Surgical Planning Laboratory
-79-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
Click on Add Volume to load
the DWI training dataset using
the Nrrd header
Surgical Planning Laboratory
-80-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
The Props Panel of the module
Volumes appears.
Select Nrrd Reader in
the Properties field
Surgical Planning Laboratory
-81-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
Browse to load the
myNrrdDWI.nhdr
file
Check that the path to the file
myNrrdDWI.nhdr is correct.
If needed, manually enter it
Click on
Apply
Surgical Planning Laboratory
-82-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
Slicer loads the Nrrd
DWI dataset
Left-click on Or and
change the
orientation to Slices
Surgical Planning Laboratory
-83-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
Change the
FOV to 2000
Surgical Planning Laboratory
-84-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
The sagittal and
coronal viewers
display the 14
DWI volumes: 2
baselines and
12 gradients
Surgical Planning Laboratory
-85-
http://www.slicer.org
Brigham and Women’s Hospital
Loading the Nrrd Volume
Display the axial
and sagittal slices
inside the viewer.
Use the axial slider
to observe the
baselines and
gradient volumes.
Surgical Planning Laboratory
-86-
http://www.slicer.org
Brigham and Women’s Hospital
Converting the DWI data to tensors
Select the module DTMRI and
click on the tab Conv
Select the Input volume
myNrrdDWI.nhdr and
click on ConvertVolume
Surgical Planning Laboratory
-87-
http://www.slicer.org
Brigham and Women’s Hospital
Converting the DWI data to tensors
Slicer displays the
anatomical views of
the Average
Gradient volume.
Surgical Planning Laboratory
-88-
http://www.slicer.org
Brigham and Women’s Hospital
Glyphs
Select the panel Glyphs in
the DTMRI module
Select the Active DTMRI volume
myNrrdDWI-nhdr_Tensor
Select Glyphs on Slice for
the axial (red) view
Set Display Glyphs On
Surgical Planning Laboratory
-89-
http://www.slicer.org
Brigham and Women’s Hospital
Glyphs
Orientation of the
glyphs in the
Corpus Callosum
Surgical Planning Laboratory
-90-
http://www.slicer.org
Brigham and Women’s Hospital
Conclusion
• Standardized description of the information
contained in DWI data.
• Rapid, intuitive visual assessment of
orientation results within Slicer
• Open-Source: http://teem.sourceforge.net/nrrd/
Surgical Planning Laboratory
-91-
http://www.slicer.org
Brigham and Women’s Hospital