910 likes | 1.18k Views
National Alliance for Medical Image Computing. NA-MIC Training Workshop NCBC AHM. Session 3 Diffusion Tensor Imaging From Dicom to Nrrd with Slicer. Sonia Pujol, Ph.D. Randy Gollub, M.D., Ph.D. Acknowledgments. National Alliance for Medical Image Computing NIH U54EB005149
E N D
National Alliance for Medical Image Computing NA-MIC Training Workshop NCBC AHM Session 3 Diffusion Tensor ImagingFrom Dicom to Nrrd with Slicer Sonia Pujol, Ph.D. Randy Gollub, M.D., Ph.D.
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
Raw Data Raw Data Raw Data Dicom Header Dicom Header Dicom Header Dicom Header Raw Data Nrrd Header Goal of the Tutorial Training on how to convert DICOM DWI data to the Nrrd File format, compatible with Slicer visualization and analysis
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
Diffusion Weighted Imaging Diffusion Weighted Images Diffusion Sensitizing Gradients The signal is dimmer when the direction of the applied gradient is parallel to the principal direction of diffusion.
Diffusion Weighted Imaging (DWI) Example: Correlation between the orientation of the 11th gradient and the signal intensity in the Splenium of the Corpus Callosum
Diffusion Weighted Imaging (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
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
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
Raw Data Raw Data Raw Data Nearly Raw Raster Data (Nrrd) • The flexible Nrrd format includes a single header file and image file(s) that can be separate or combined. • A Nrrd header accurately represents N-dimensional raster information for scientific visualization and medical image processing. + Nrrd Header
Nrrd file format • NA-MIC has developed a robust way of using the Nrrd format to represent DWI volumes
Nrrd file format • DWI data written into Nrrd format with appropriate parameters can be read into 3D Slicer
(X,Y,Z) (I,J,K) Coordinate Frames Courtesy G.Kindlmann Diffusion Weighted Images Diffusion Sensitizing Gradients Courtesy G.Kindlmann
(X,Y,Z) (I,J,K) Coordinate Frames Diffusion Sensitizing Gradients (X,Y,Z) DWI Image Orientation (I,J,K) Patient Space Courtesy G.Kindlmann
Transformation matrices T: IJKRAS (I,J,K) (X,Y,Z) T: XYZRAS (R,A,S) Courtesy G.Kindlmann
Nrrd Terminology T: XYZRAS (X,Y,Z) (I,J,K) T: IJKRAS (R,A,S) 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
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
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
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
Unu syntax • General Syntax: unucmd-iinput-ooutput • Tips: “unu” list of unu commands “unucmd” help on cmd
Unu syntax: ‘make’ command • ‘make’ syntax: unumake-iinput-ooutput • ‘make’ documentation: unumakehelp on make
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.
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-05-18/Lib/darwin-ppc/teem-build/bin
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
DICOM DWI Training Data • 2 Baselines and 12 Gradients • 504 DICOM images named S4.xxx where xxx is the image number
DWI Training Data Type the command cd and enter the path to your data in the Tk Console. Type ls to list all the data files.
DWI Training Data The dataset is composed of 504 images named S4.xxx
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 Enter 2D Image Read backwards from end of file Min index Increment Max index
Unu command (Mac/Linux) Type the unu command with the input, encoding and byteskip fields slicer2.6-opt-darwin-ppc-2006-05-18/Lib/darwin-ppc/teem-build/bin unu make -h --input S4.%03d 1 504 1 2 --encoding raw --byteskip -1 2D Image Read backwards from end of file Min index Increment Max index
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
Read the DICOM Header Click on AddVolume
Read the DICOM Header The Props panel appears. Select the Properties Dicom
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
Read the Dicom Header Slicer displays the list of Dicom files in the directory. Click on OK
Read the Dicom Header Click on Extract Header to display the content of the Dicom Header.
Read the Dicom Header Slicer displays the content of the Dicom Header. This information will be used to generate the Nrrd header.
Extracting the volume characteristics • Extract the values corresponding to the following information: • - Data Type • Endianess • Image Dimensions
Extracting the volume characteristics - Data Type: Short - Endianess: Little
Unu Command Add the fields endian and type to the unu command --endian little --type short
Extracting the volume characteristics Image Dimensions: 256 pixels x 256 pixels The dataset was acquired with Nb=2 Baselines and Ng=12 Gradients
DICOM DWI Training Data • 2 Baselines and 12 Gradients • 504 DICOM images named S4.xxx where xxx is the image number
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
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
Slice Thickness Extract the slice thickness from the Dicom header
Slice Thickness slice thickness = 3.00 mm
Slice Thickness Add the field thickness to the unu command --thickness nan nan 3.0 nan