Nrrd to Dicom Conversion-3769

4,182 views
3,946 views

Published on

http://hdl.handle.net/1926/529

Published in: Health & Medicine, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,182
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
46
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Nrrd to Dicom Conversion-3769

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

×