~ubuntu-branches/ubuntu/utopic/mricron/utopic

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>





  
  
  
  
  
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">





  
  
  
  
  
  <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">





  
  
  
  
  
  <title>dcm2nii DICOM to NIfTI image conversion</title>
</head>


<body bgcolor="#ffffff">





 
<table bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%">





 <tbody>





    <tr>





 <td bgcolor="#ffffff">
      
      
      
      
      
      <table bgcolor="#000050" border="0" width="100%">





 <tbody>





          <tr>





 <td><a href="index.html"><img src="images/icon.png" height="86" width="128"></a></td>





 <td width="100%"><font color="#ffffff" size="5">dcm2nii DICOM to NIfTI conversion</font></td>





          </tr>





 
        
        
        
        
        
        </tbody>
      
      
      
      
      
      </table>





 </td>





    </tr>





 
  
  
  
  
  
  </tbody>
</table>





 
<table border="0" width="100%">





 <tbody>





    <tr>





 <td width="40">&nbsp;</td>





 <td valign="top" width="100%"><b>Introduction</b>
      
      
      
      
      
      <p style="font-weight: bold; color: rgb(204, 0, 0);">Important note: dcm2nii
is still beta software - please carefully monitor the output from this
software. In particular, be aware of potential left-right flipping.
This has only been tested with Philips Intera DICOM, Siemens Trio DICOM
and Philips Intera PAR/REC images. This software is provided under the <a href="install.html"> BSD license.</a></p>





      
      
      
      
      
      <p>DCM2NII attempts to convert images from the proprietary
scanner format to the NIfTI format used by FSL, SPM5, MRIcron and many
other brain imaging tools. NIfTI is a modern incarnation of the Analyze
format, but includes important information like the orientation of the
image. DCM2NII is a stand-alone program that is distributed with
MRIcron. It is natively compiled for Windows, Linux x86, Mac OSX PPC
and Mac OSX x86.</p>




      
      
      
      
      <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="0">




        <tbody>




          <tr>




            <td style="width: 90%;"><br>




            
            
            
            
            <table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">




              <tbody>




                <tr>




                  <td style="width: 90%;">The NIfTI image format
standard was designed for scientific analysis of brain images. The
format is simple, compact and versatile. The images can be stored as a
pair of files (hdr/img, compliant with most Analyze format viewers), or
a single file (nii). Programs like FSL and MRIcron can also read
compressed (nii.gz) images. One nice feature about NIfTI is that the
format attempts to keep spatial orientation information. Therefore,
NIfTI software that can read the spatial information (MRIcron and SPM5)
should reduce your chance of making left-right errors. Also, software
like SPM5 will tend to be more accurate at coregistering images, as all
the images from an individual can use the scanner position as a
beginning estimate for alignment. For example, here are two scans from
the same individual (the sagittal T1 is shown in grayscale, and the
coronal FLAIR is shown in reds). Note that the scans were acquired with
different orientations (with the FLAIR along the axis of the
hippocampus), however MRIcron shows the image orientation correctly.</td>




                  <td><img style="width: 220px; height: 256px;" alt="NIfTI image transform" src="images/nifti.jpg"></td>




                </tr>




              
              
              
              
              </tbody>
            
            
            
            
            </table>




            </td>




          </tr>




        
        
        
        
        </tbody>
      
      
      
      
      </table>




      

      
      
      
      
      
      <ol>





      
      
      
      
      
      </ol>





 
      
      
      
      
      
      <p><b>Installation</b></p>





 
      
      
      
      
      
      <ol>





        <li>Follow the instructions to <a href="./install.html">install MRIcron</a> on your hard disk - this should create a program named dcm2nii.exe (Windows) or dcm2nii (Unix).</li>





        <li>Double click on dcm2nii.exe - a file named
dcm2nii.ini will be created. If you are using Windows, this file is in
the same folder as dcm2nii. If you are using Unix (Linux, OSX) then
this file is created in your home directory.</li>





        <li>Open dcm2nii.ini with a text editor (double click on the file). You will be able to adjust the settings:<br>

          
          <table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">

            <tbody>

              <tr>

                <td style="width: 1%;">Text</td>

                <td style="width: 100%;">Description</td>

              </tr>

              <tr>

              </tr>
              <tr>

                <td style="width: 1%;">[BOOL]</td>

                <td style="width: 100%;"> </td>

              </tr>

              <tr>

                <td style="width: 1%;">AnonymizeSourceDICOM=0</td>

                <td style="width: 100%;">If '=1' then dcm2nii will
create anonymized copies of DICOM images (remove name, DOB, patient ID,
sex). No other conversion will occur. </td>

              </tr>

              <tr>

                <td style="width: 1%;">ManualNIfTIConv=1</td>

                <td style="width: 100%;">If '=1' then dcm2nii will
prompt user to describe output subformat for every NIfTI image dragged
onto the program. Otherwise, subformat will be based on $D,
SingleNIIFile,SPM2 settings.</td>

              </tr>

              <tr>

                <td style="width: 1%;">4D=1</td>

                <td style="width: 100%;">If '=1' then dcm2nii will generate 4D files (FSL style), otherwise output will be 3D (SPM style). </td>

              </tr>

              <tr>

                <td style="width: 1%;">Anonymize=1</td>

                <td style="width: 100%;"> If '=1' then patient name will not be copied to NIfTI header. </td>

              </tr>
              <tr>

                <td style="width: 1%;">SingleNIIFile=1</td>

                <td style="width: 100%;">If '=1' then dcm2nii will create .nii files (FSL style), otherwise .hdr/.img pairs will be created (SPM style) </td>

              </tr>
              <tr>

                <td style="width: 1%;">Gzip=0</td>

                <td style="width: 100%;">If '=1' then dcm2nii will create compressed .nii.gz files (FSL style). </td>

              </tr>
              <tr>

                <td style="width: 1%;">SPM2=0</td>

                <td style="width: 100%;">If '=1' then dcm2nii will create Analyze images (SPM2 style), otherwise headers will be in NIfTI (SPM5/FSL). </td>

              </tr>
              <tr>

                <td style="width: 1%;">AppendDate=1</td>

                <td style="width: 100%;">If '=1' then output filename will include date of study. </td>

              </tr>
              <tr>

                <td style="width: 1%;">AppendAcqSeries=1</td>

                <td style="width: 100%;">If '=1' then output filename will include acquisition number. </td>

              </tr>

	<tr>

                <td style="width: 1%;">AppendProtocolName=1</td>

                <td style="width: 100%;"> If '=1' then output filename will include protocol name.</td>

              </tr>

	<tr>

                <td style="width: 1%;">AppendPatientName=0</td>

                <td style="width: 100%;"> If '=1' then output filename will include patient name.</td>

              </tr>

	<tr>

                <td style="width: 1%;">AppendFilename=0</td>

                <td style="width: 100%;">If '=1' then output filename will include source filename. </td>

              </tr>

	<tr>

                <td style="width: 1%;">EveryFile=1</td>

                <td style="width: 100%;">If '=1' then all .par/.rec files in the source folder will be converted, otherwise only the file specified will be converted</td>

              </tr>
              
	<tr>

                <td style="width: 1%;">[INT]</td>

                <td style="width: 100%;"> </td>

              </tr>
     
	<tr>

                <td style="width: 1%;">BeginClip=0</td>

                <td style="width: 100%;"> Specifies number of volumes to be removed from the beginning of a 4D acquisition (e.g. avoid T1 effects)</td>

              </tr>
   
	<tr>

                <td style="width: 1%;">LastClip=0</td>

                <td style="width: 100%;">Specifies number of volumes
to be removed from the end of a 4D acquisition (e.g. fMRI scanning
continued after behavioral paradigm ended). </td>

              </tr>
                   
                   
 	<tr>

                <td style="width: 1%;">MinReorientMatrix=255</td>

                <td style="width: 100%;">Images with a larger matrix size than this value will be reoriented to canonical space (see below). </td>

              </tr>                  
                          
            </tbody>
          
          </table>

          <br>




          
          
          <div style="margin-left: 40px;"><br>


          </div>





        </li>





        
        
        
        
        
        <ul>


        
        
        </ul>





        <li>With each option listed under the heading [BOOL], add
a '1' for yes and a '0' for no. For
example, if you want to have images saved as .hdr/.img pairs, set
SingleNIIFile to 0. If you want to save images a single .nii files, set
this to 1. The append options adjust the output filenames. For example,
if you had both AppendDate and AppendProtocolName set to 1, the
converted images would have names such as 20060331_123456anat1x1x1.nii
if the data session was acquired on 31 March 2006 at 12:34:56 and the
protocol was called 'anat1x1x1'. The last two values (listed under the
heading [INT]) except integer values - for example if you set
'LastClip=8' then the last 8 volumes of every 4-dimensional dataset
will not be saved (e.g. if you had an fMRI dataset with 120 volumes,
only the first 111 volumes would be converted). A fuller description of
these options is in the gray box below.<br>





        </li>





      
      
      
      
      
      </ol>





      
      
      
      
      
      <p><b>Running DCM2NII</b></p>


      
      
      <p>There are two ways to run dcm2nii</p>


      
      
      <ol>


        <li>You can either drag and drop files onto the program - this will convert the images using the
values in your dcm2nii.ini file (see above).</li>

 
       <li>You can
launch dcm2nii from the command line, specifying specifically the
options to use.</li>


      
      </ol>


      
      
      <p>To use dcm2nii by dragging and dropping:</p>





 
      
      
      
      
      
      <ol>





        <li>Place all the DICOM (or Philips PAR/REC) images you wish to convert into a folder where you have write access.</li>





        <li>Drag and drop one of the images onto dcm2nii.&nbsp;</li>





        <li>You can now vew the images with MRIcron, SPM5, FSL, or other Analyze/NIfTI viewers.</li>





      
      
      
      
      
      </ol>


To see your options for running dcm2nii from the command line, simply
execute the program without specifying any files (e.g. just double
click on the program to launch it). The available options will the be
written to the screen:<br>
      <table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2">
        <tbody>
          <tr>
            <td>dcm2nii 12 May 2007 by Chris Rorden<br>

Either drag and drop or specify command line options:<br>

  dcm2nii <options> <sourcenames><br>

OPTIONS:<br>

&nbsp;-a Anonymize [remove identifying information]: Y,N<br>

&nbsp;&nbsp;    default: Y<br>

&nbsp;-b Clip beginning volumes from 4D file: 0..1000<br>

&nbsp;&nbsp;    default: 0<br>

&nbsp;-d Date in filename [filename.dcm -&gt; 20061230122032.nii]: Y,N<br>

&nbsp;&nbsp;    default: N<br>

&nbsp;-e events (series/acq) in filename [filename.dcm -&gt; s002a003.nii]: Y,N<br>

&nbsp;&nbsp;    default: Y<br>

&nbsp;-f Source filename [e.g. filename.par -&gt; filename.nii]: Y,N<br>

&nbsp;&nbsp;    default: N<br>

&nbsp;-g gzip output, filename.nii.gz [ignored if '-n n']: Y,N<br>

&nbsp;&nbsp;    default: Y<br>

&nbsp;-i ID  in filename [filename.dcm -&gt; johndoe.nii]: Y,N<br>

&nbsp;&nbsp;    default: N<br>

&nbsp;-l Clip last volumes from 4D file: 0..1000<br>

&nbsp;&nbsp;    default: 0<br>

&nbsp;-n output .nii file [if no, create .hdr/.img pair]: Y,N<br>

&nbsp;&nbsp;    default: Y<br>

&nbsp;-o Output Directory, e.g. 'C:\TEMP'<br>

&nbsp;&nbsp;    default: source directory<br>

&nbsp;-p Protocol in filename [filename.dcm -&gt; TFE_T1.nii]: Y,N<br>

&nbsp;&nbsp;    default: Y<br>

&nbsp;-s SPM2/Analyze not SPM5/NIfTI [ignored if '-n y']: Y,N<br>

&nbsp;&nbsp;    default: N<br>

&nbsp;-v Convert every PAR file in the directory: Y,N<br>

&nbsp;&nbsp;    default: Y<br>

HINTS<br>

 &nbsp; the combination '-d n -p n -i n -e n' will be ignored.<br>

&nbsp;  You can also set defaults by editing C:\lazarus\mricron\dcm2nii\dcm2nii.ini<br>

EXAMPLE: dcm2nii -a y -o C:\TEMP C:\DICOM\input1.par C:\input2.par</sourcenames></options></td>
          </tr>
        </tbody>
      </table>
      <br>
<br>

      <p><b>Reorienting to canonical space</b></p>

The NIfTI format stores spatial transforms so that software can determine the oreintation of the image. This means that MRIcron can display the image with an intuitive orientation. However, many programs ignore these transforms, and display the images as they are saved to disk (e.g. FSLview, MRIcro) - this means that a sagittally acquired scan appears very differently from an axially acquired scan. In fact, the three spatial dimensions (left-right, anterior-posterior, superior-inferior) can be saved in 48 different orthogonal orientations. The drawing below shows just three of these possible orientations.
 <img style="width: 620px; height: 200px;" alt="Orthogonal orientations" src="images/space.gif"><br>
 You can set dcm2nii to reorient all images so they are all aligned to the nearest orthogonal direction to 'canonical space' (i.e. as close as possible to the rotation matrix [1 0 0; 0 1 0; 0 0 1]). This means programs like FSLview and MRIcro will display the images in a sensible orientation, regardless of the acquisition. The NIfTI transform codes the residual oblique orientations, so no information is lost in this tranformation. However, you will only want to orient anatomical scans to canonical space - reorienting fMRI data can disrupt slice timing correction (as the software assumes that the slice order of the stored data is correlated with the time of acquisition). Reorienting can also disrupt analysis of the DTI data (as the diffusion directions are not adjusted for the change in image orientation). Therefore, the "MinReorientMatrix" allows you to adjust which images will be reoriented - a value of 255 ensures that T1/T2 scans (typically with a 256x256 matrix) are reoriented, while fMRI (~64x64) and DTI (~128x128) scans are not. If you do not want any scans reoriented, reset this to a very large value (e.g. 5000).
      <br>
      <br>
      After reorienting, dcm2nii will attempt to 'autocrop' T1-weighted anatomical images (images with a Echo Time [TE] of less than 20ms). A new copy of the image is created with the prefix 'c' that attempts to remove excess air surrounding the individual as well as parts of the neck below the cerebellum. This excess neck can disrupt normalization of images (as the template images do not have similar neck regions). This new image has a slightly different NIfTI transform - the origin is adjusted to compensate for the removed portions of the image. The image below shows a T1-weighted scan before and after cropping. 
      <br>
 <img style="width: 616px; height: 172px;" alt="Orthogonal orientations" src="images/autocrop.jpg"><br>
As a final note, reorienting images is useful if you want to create masks for an image to use with SPM or FSL. These programs require that the mask image has precisely the same dimensions as the image it is designed to mask. In these cases, you can not apply the precise spatial transforms to an image (as the oblique orientation corrections means that the resulting drawing will have different dimensions than the original image. Therefore, you will want to draw a mask on on a image that has not used the fine spatial transforms. You can use MRIcro or FSLview to do this (as they ignore these transforms). If yu use MRIcron, select Help/Preferences and uncheck the 'Reorient (reslice) images when loading' option - this will ensure that the raw image is loaded. Regardless of which software you use, having a canonically aligned image will mean that the image will be displayed in a sensible manner.
      <br>
<p><b>Diffusion data</b></p>
Diffusion sequences are sensitive to the random spontaneous motion of water molecules. This movement is anisotropic in fiber bundles - in other words it preferentially moves up and down the fibers whereas motion across the fiber is constrained. Diffusion tensor imaging (DTI) use different gradient directions so that different images are sensitive to specific directions. In order to process this data with medINRIA or FSL, you need to extract the diffusion direction information as well as the images. For these images, dcm2niigui will attempt to generate .bvec and .bval text files. This information is extracted from the <a href="http://wiki.na-mic.org/Wiki/index.php/NAMIC_Wiki:DTI:DICOM_for_DWI_and_DTI"> DICOM header</a> (for Siemens data the software attempts to read the "B_value" and "DiffusionGradientDirection" fields from the CSA header).

      <p><b>NIfTI Sub-Formats</b></p>

SPM5 and FSL both support NIfTI format images. However, by default
these programs assume your data is in slightly different formats. Most
SPM5 users generate a single 3D volume for each timepoint, and each
image is saved as both a .hdr and .img file (separating the header
information from the raw image data). On the other hand, by default FSL
uses a single 4D dataset, with all the data stored in a single .nii
file (this single file contains both the header and raw image data). To
save disk space, FSL saved these files as compressed gzipped files
(.nii.gz). Therefore, you may want to convert your DICOM data to a
different NIfTI sub-format depending on how you want to process and
analyze your data. You should adjust dcm2nii's settings depending on
which software you will use for post-processing. Here are some general
guidelines:<br>


       
      
      <ol>


        <li>FSL/MRIcron: compressed NIfTI (.nii.gz) - SingleNIIFile=1; Gzip=1; SPM2=0 </li>


        <li>Recent software (SPM5/Voxbo/FSL/MRIcron): NIfTI (.nii) - SingleNIIFile=1; Gzip=0; SPM2=0 </li>

        
        <li>Legacy software (SPM2/Analyze/MRIcro): analyze (.hdr/.img) - SingleNIIFile=0; Gzip=0; SPM2=1 </li>



        
      
      </ol>


        
 
      
      <p><b>Converting between NIfTI Sub-Formats</b></p>



FSL includes the <a href="http://www.fmrib.ox.ac.uk/fsl/avwutils/index.html">avwsplit and avwmerge</a>
tools for converting between 3D and 4D NIfTI images. This is useful, as
FSL likes 4D images while SPM likes 3D images. The latest versions of
dcm2nii (since May 2007) can also help you convert between NIfTI
subformats. Specifically, if you drag and drop a NIfTI image (.nii,
.nii.gz, or .hdr/.img subformats) onto dcm2nii it will ask how you want
the data converted. You can convert these files to SPM2 (analyze 3D
hdr/img), SPM5 (3D hdr/img), 3D nii, 4D nii, and FSL (NIfTI 4D nii.gz).
If ManualNIfTIConv=1 then the user will be prompted for every file to
specify the output format, while if this value is ManualNIfTIConv=0
then the files will be converted automatically using the sub-formant
specified in the dcm2nii.ini file. Note that this software will both
change subformat and/or convert 4D files to 3D files. However, it does
not convert 3D files to 4D files (use avwmerge for this).<br>

 <p><b>Anonymizing DICOM images</b></p>

This software can also 'anonymize' DICOM data - protecting the participants private information. There are a number of free as well as professional programs that can help anonymize DICOM data. My favorite is the free
<a href="http://www.unipacs.com/en/uniView.html">uniPACS viewer</a> can strip all the private tags from a DICOM file (choose File/BatchFileExport and select 'Anonymize' from the file menu). However, it is worth mentioning that some DICOM images store important data in the 'private' tags - for example, Siemens data includes information about the number of slices in a mosaic as well as DICOM diffusion directions. Therefore, use these 'strong' anonymizers with caution. In contrast, dcm2nii provides a 'weak' anonymization: it only anonymizes  the patients name (0010:0010), ID (0010:0020), date of birth (0010:0030),
sex (0010:0040), age (0010:1010) and weight (0010:1030). The name is replaced with the number of seconds that elapsed between the study time and January 1, 2000 (ensuring that data from different individuals will not be confused). In theory, the participant can still be identified by study time (if you know when people received scans), and some manufacturers may store personal information in other parts of the DICOM file. To use dcm2nii's DICOM anonymizer, simply edit the dcm2nii file to read "AnonymizeSourceDICOM=1". Then just drag and drop DICOM files on the program - an anonymized file will be created (with the same name as the original image, but with the extension '.dcm' appended at the end). Note that in this mode the software will not convert the DICOM files to the NIfTI format. You may want to keep two copies of dcm2nii with different filenames (and hence different .ini files) - for example you could call one 'dcmanon' and another 'dcm2nii' so that one copy generates anonymized files and the other converts files. <br>

        
      <p><b>dcm2niiGUI</b></p>
I find dcm2nii very easy to use - just drop the images that you wish to convert onto the program's icon. However, some people prefer programs with a graphical user interface. The Windows distribution of MRIcron includes my dcm2niigui program - which is simply a version of dcm2nii with a graphical interface. Just launch the program, then drag and drop the images you wish to convert. The 'Output format' pulldown menu determines whether the images will be saved in SPM or FSL style NIfTI format. You can also choose help/preferences to more advanced options. In addition, you can use the File/AnonymizeDICOM command to strip personal details from DICOM images. Finally, you can use the File/ModifyNIfTI command to change existing NIfTI images - this command guides you through selecting the images and then choosing how you want to modify the images (remove volumes, changing subformat, reorienting, or changing the order of the 3rd and fourth dimension).<br> 
      
       <img style="width: 474px; height: 356px;" alt="dcm2niigui" src="images/dcm2niigui.gif"><br>

<p><b>Performance</b></p>

Converting DICOM images is fast compared to the other processing stages common to neuroimaging. However, several people have asked me how to improve dcm2nii's performance. I have tried to design this software to be quick - it attempts to minimize the amount of time writing to disk (by using a large amount of RAM). The table below shows the time required to process a standard neuroimaging dataset (1060 DICOM images [325Mb] with 792 fMRI volumes [36 slices, saved as mosaics], one T1 weighted anatomical scan and a field map). This dataset is typical for a one hour scanning session. The table below shows the time (in seconds) for dcm2nii (and SPM5) to convert these images. The 'GZ' cells reflect times for creating FSL style compressed .nii.gz images, while the other cells report times for creating SPM5 style .hdr/.img pairs. In brief, creating uncompressed images is generally constrained by disk speeds, while creating compressed images is limited by your processing power.  <br>

<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="0">
  <tbody>
    <tr>
      <td>Setup</td>
      <td>eSata</td>
      <td>Internal HD</td>
      <td>USB HD</td>
      <td>GZ eSata</td>
      <td>GZ Internal HD</td>
      <td>GZ USB HD</td>
    </tr>
    <tr>
      <td>dcm2nii 2166Mhz CoreDuo Laptop</td>
      <td>12<br>
      </td>
      <td>20</td>
      <td>41</td>
      <td>70</td>
      <td>70</td>
      <td>73</td>
    </tr>
    <tr>
      <td>SPM5 2166Mhz CoreDuo Laptop</td>
      <td>94</td>
      <td>138</td>
      <td>165</td>
      <td>-</td>
      <td>-</td>
      <td>-</td>
    </tr>
    <tr>
      <td>dcm2nii&nbsp;667Mhz G4 Laptop</td>
      <td>-</td>
      <td>41</td>
      <td>-</td>
      <td>-</td>
      <td>229</td>
      <td>-</td>
    </tr>
  </tbody>
</table>

      
      <p><b>Sample Datasets</b></p>



Here are some sample images that help show whether images are converted with the correct image orientation:<br>


       
      
      <ol>


        <li><a href="http://www.sph.sc.edu/comd/rorden/mricron/ge_dcm.zip">GE DICOM dataset. </a>
Twelve 4D EPI series, each with five volumes: s26692 axial ascending
sequentia, s26693: axial ascending interleaved, s26694: axial
descending sequentia, s26695: axial descending interleaved, s26696:
sagittal right to left sequential, s26697: sagittal right to left
interleaved, s26698: sagittal left to right sequential, s26699 sagittal
left to right interleaved, s26700: coronal P to A sequential, s26701:
coronal P to A interleaved, s26702: coronal A to P sequential, s26703:
EPI, coronal A to P interleaved. A water filled fiduical marker is
placed over the right temple of the participant. Data were acquired on
a GE-SignaHD-Excite scanner at 3 Tesla using an 8 Channel Brain Array
Coil. The first volume of each series has been marked with a '1' on the
image. (LMU Grosshadern)</li>


        <li><a href="http://www.sph.sc.edu/comd/rorden/mricron/intera_dcm.zip">Philips DICOM dataset.</a>
Six 4D EPI volumes, each with two volumes: sagittal, coronal and axial
each with both 'ascending' and 'descending' slice order. The white line
added at the bottom should be shorter on the earlier volumes. (MUSC
Center for Advanced Imaging Research)</li>


        <li><a href="http://www.sph.sc.edu/comd/rorden/mricron/intera_par.zip">Philips PAR/REC dataset. </a>
Five 4D EPI volumes - same raw data as Philips DICOM dataset, but only
a single axial volume is included.(MUSC Center for Advanced Imaging
Research)</li>


        <li><a href="http://www.sph.sc.edu/comd/rorden/mricron/trio_dcm.zip">Siemens Trio B12 DICOM dataset. </a>
Six 4D EPI volumes, each with two volumes: sagittal, coronal and axial
each with both 'ascending' and 'descending' slice order. A saline bag
is placed near the participant's left temple. (USC McCausland Center)</li>


        <li><a href="http://www.sph.sc.edu/comd/rorden/mricron/trio_dti.zip">Siemens Trio B13 DICOM DTI dataset.</a>
From May-2007, dcm2nii attempts to generate FSL and medINRIA compatible
descriptions of the B-values (bval) and Diffusion Gradient Directions
(bvec). For instructions on using FSL and medINRIA, see my <a href="http://www.sph.sc.edu/comd/rorden/workshop/fsl/dti/index.html">DTI page.</a>
These sample images were simply designed to validate dcm2nii's
conversion: these protocols are not appropriate for any other use (<a href="http://www.sph.sc.edu/comd/rorden/workshop/bic/protocols/index.html">our standard protocol is described here</a>).
This large (33Mb) file includes four 20 direction EPI datasets: the
first two are true axial (aligned to scanner bore, not the
participant's head) and are identical except that the phase direction
is Anterior-Posterior in the first and Right-Left in second. The third
volume is identical to the second except that the imaging plane has
been rotated: a pitch and yaw have been applied. The final scan is a
coronal scan,also taken in plane with the scanner's bore with pahse
encoding in the right-left direction. The file also includes a matlab
function (dtivecs.m) that illustrates dcm2nii's calculation for
correcting the diffusion directions for the imaging plane, using
suggestions from dicom2ana (see below) and Paul Morgan. (USC McCausland
Center)</li>



        
      
      </ol>

        
        
      
      
      <p><b>Alternatives</b></p>



Each manufacturer has interpretted the DICOM data standard a bit
differently. Therefore, you may want to test several programs to see
which one is best suited for your data<br>



      
      
      
      <ol>



        <li><a href="http://www.loni.ucla.edu/Software/Software_Detail.jsp?software_id=11">LONI Debabeler </a>is
a Java applet that can run on just about any computer. It can also read
a number of medical imaging formats. Another nice feature is that it
reorients the raw data to be approximately aligned with the nearest
orthogonal orientation (i.e. coronal and sagittal scans are resliced
along the axial plane).</li>



        <li><a href="http://www.fil.ion.ucl.ac.uk/spm/software/spm5/">SPM5</a> includes a DICOM to NIfTI covnerter that works particularly well for Siemens data (requires Matlab).</li>



        <li><a href="http://www.fmrib.ox.ac.uk/%7Erobson/internal/Dicom2Nifti.htm">dicom2nifti</a> is a matlab script for converting DICOM to NIfTI (requires Matlab and the Matlab Image Processing Toolbox).
          <a href="http://www.ocmr.ox.ac.uk/internal/information-for-researchers/computing/dicom-to-nifti/dicom-to-nifti-information">[an alternative version is described here.]</a> 
        </li>



        <li><a href="http://xmedcon.sourceforge.net/">xmedcon</a> offers limited NIfTI writing support for&nbsp;many image formats. It uses the <a href="http://niftilib.sourceforge.net/">niftilib</a> tools, which look very useful.</li>



        <li><a href="http://lcni.uoregon.edu/%7Ejolinda/MRIConvert/">MRIconvert</a> is a popular converter for Windows and Linux.</li>



        <li><a href="https://www.cbi.nyu.edu/public/software/dinifti/">dinifti</a> looks useful.</li>



        <li>Here is a <a href="http://cfmriweb.ucsd.edu/fmap/ppge2">script</a> that uses <a href="http://www.barre.nom.fr/medical/dicom2/">dicom2</a> and <a href="http://www.fmrib.ox.ac.uk/fsl/">FSL</a> to convert DICOM images to NIfTI.</li>



        <li><a href="http://xmedcon.sourceforge.net/">XMedCon</a>
includes the ability to convert between Acr/Nema 2.0, Analyze (SPM),
Concorde/&micro;PET, DICOM 3.0, CTI ECAT 6/7, NIfTI-1, InterFile3.3 and
PNG or Gif87a/89a formats, as well as an elegant image viewer.</li>


      
      
      
      </ol>





      </td>





    </tr>





  
  
  
  
  
  </tbody>
</table>




<table style="text-align: left; background-color: rgb(0, 0, 80); width: 100%;" border="0" cellpadding="0" cellspacing="0">



  <tbody>



    <tr>



      <td><img style="width: 367px; height: 109px;" alt="logo" src="images/meld.jpg"></td>



    </tr>



  
  
  
  </tbody>
</table>




</body>
</html>