attachment:cbu_diffusion_params.m of DiffusionFdtNotes - MRC CBU Imaging Wiki
location: attachment:cbu_diffusion_params.m of DiffusionFdtNotes

Attachment 'cbu_diffusion_params.m'

Download

   1 function [bvals, bvecs] = cbu_diffusion_params(input_files)
   2 % Find bvals and bvecs from DICOM directory
   3 
   4 if nargin < 1
   5   input_files = spm_select(Inf, '^.*\.dcm$', 'Select DICOM files');
   6 end
   7 
   8 hdr = spm_dicom_headers(input_files);
   9 n = length(hdr);
  10 bvals = zeros(n, 1);
  11 bvecs = zeros(n, 3);
  12 
  13 for i = 1:n
  14   H = hdr{i};
  15   bvals(i) = str2num(H.CSAImageHeaderInfo(7).item(1).val);
  16   if bvals(i) == 0 % no gradient
  17     continue
  18   end
  19   d_info = H.CSAImageHeaderInfo(22).item;
  20   for D = 1:3
  21     bvecs(i,D)= str2num(d_info(D).val);
  22   end
  23 end

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-04-30 15:55:44, 0.5 KB) [[attachment:cbu_diffusion_params.m]]
  • [get | view] (2007-04-30 15:55:59, 1.1 KB) [[attachment:cbu_write_fdt.m]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.