Difference between revisions of "NAMIC"

From NAMIC Wiki
Jump to: navigation, search
m (Update from Wiki)
m (Update from Wiki)
Line 1: Line 1:
NRRD0005
+
Note: please also see [[NAMIC-Dartmouth-DWI|this page about NRRD headers which refer to the original image files]], without the need for any additional data reading with MATLAB.
content: NAMIC01
+
 
type: short
+
The following MATLAB script converts the Dartmouth DWIs into a single file in which the volumes (2 baselines and 12 diffusion weighted images) are in the appropriate space. The resulting raw image, together with [[NAMIC-Dartmouth-nrrdheader|a nrrd header]], are used by Slicer to do DTI analysis.
dimension: 4
+
 
space: right-anterior-superior
+
  fpout = fopen('nrrdraw.raw', 'w');
sizes: 256 256 36 14
+
  for k = 1:14;
thicknesses:  NaN  NaN 3  NaN
+
    % for subject 1,2,4,5 the slice order is Superior-Inferior, need to
space directions: (-0.9375,0,0) (0,-0.9375,0) (0,0,3) none
+
    % reverse order
centerings: cell cell cell none
+
    % for m = 36:-1:1
  kinds: space space space list
+
    % for subject 3, 6, the slice order is Inferior-superior
endian: little
+
    for m = 1:36
encoding: raw
+
      n = (k-1)*36+m;
space units: "mm" "mm" "mm"
+
      % use appropriate dicom prefix
space origin: (119.531,119.531,-52.5)
+
      name = sprintf('S8.%03d', n);
data file: nrrdraw.raw
+
      fp = fopen(name);
measurement frame: (0,-1,0) (1,0,0) (0,0,-1)
+
      fseek(fp, -65536*2, 'eof');
modality:=DWMRI
+
      A = fread(fp, [256 256], 'short');
DWMRI_b-value:=800
+
      fclose(fp);
DWMRI_gradient_0000:= 0 0 0
+
      fwrite(fpout, A, 'short');
DWMRI_NEX_0000:=2
+
    end
DWMRI_gradient_0002:= -0.8238094 -0.4178235 -0.3830949
+
    end
DWMRI_gradient_0003:= -0.5681645 0.5019867 -0.6520725
+
  fclose(fpout);
DWMRI_gradient_0004:= 0.4296590 0.1437401 0.8914774
 
DWMRI_gradient_0005:= -0.0482123 0.6979894 0.7144833
 
DWMRI_gradient_0006:= 0.8286872 -0.0896669 -0.5524829
 
DWMRI_gradient_0007:= 0.9642489 -0.2240180 0.1415627
 
DWMRI_gradient_0008:= -0.1944068 0.9526976 -0.2336092
 
DWMRI_gradient_0009:= 0.1662157 0.6172332 -0.7690224
 
DWMRI_gradient_0010:= -0.3535898 -0.9178798 -0.1801968
 
DWMRI_gradient_0011:= -0.7404186 -0.5774342 0.3440203
 
DWMRI_gradient_0012:= -0.2763061 0.0476582 0.9598873
 
DWMRI_gradient_0013:= 0.6168819 -0.7348858 -0.2817793
 

Revision as of 13:56, 18 December 2006

Home < NAMIC

Note: please also see this page about NRRD headers which refer to the original image files, without the need for any additional data reading with MATLAB.

The following MATLAB script converts the Dartmouth DWIs into a single file in which the volumes (2 baselines and 12 diffusion weighted images) are in the appropriate space. The resulting raw image, together with a nrrd header, are used by Slicer to do DTI analysis.

fpout = fopen('nrrdraw.raw', 'w');
  for k = 1:14;
    % for subject 1,2,4,5 the slice order is Superior-Inferior, need to
    % reverse order
    % for m = 36:-1:1
    % for subject 3, 6, the slice order is Inferior-superior
    for m = 1:36
      n = (k-1)*36+m;
      % use appropriate dicom prefix
      name = sprintf('S8.%03d', n);
      fp = fopen(name);
      fseek(fp, -65536*2, 'eof');
      A = fread(fp, [256 256], 'short');
      fclose(fp);
      fwrite(fpout, A, 'short');
    end
   end
 fclose(fpout);