Browse code

searchlight ready. missing nifti-image-write support. added timing to FBS

git-svn-id: https://svn.discofish.de/MATLAB/spmtoolbox/SVMCrossVal@167 83ab2cfd-5345-466c-8aeb-2b2739fb922d

Christoph Budziszewski authored on30/03/2009 17:54:25
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,38 @@
1
+%  Save NIFTI header extension.
2
+%
3
+%  Usage: save_nii_ext(ext, fid)
4
+%
5
+%  ext - struct with NIFTI header extension fields.
6
+%
7
+%  NIFTI data format can be found on: http://nifti.nimh.nih.gov
8
+%
9
+%  - Jimmy Shen (jimmy@rotman-baycrest.on.ca)
10
+%
11
+function save_nii_ext(ext, fid)
12
+
13
+   if ~exist('ext','var') | ~exist('fid','var')
14
+      error('Usage: save_nii_ext(ext, fid)');
15
+   end
16
+
17
+   if ~isfield(ext,'extension') | ~isfield(ext,'section') | ~isfield(ext,'num_ext')
18
+      error('Wrong header extension');
19
+   end
20
+
21
+   write_ext(ext, fid);
22
+
23
+   return;                                      % save_nii_ext
24
+
25
+
26
+%---------------------------------------------------------------------
27
+function write_ext(ext, fid)
28
+
29
+   fwrite(fid, ext.extension, 'uchar');
30
+
31
+   for i=1:ext.num_ext
32
+      fwrite(fid, ext.section(i).esize, 'int32');
33
+      fwrite(fid, ext.section(i).ecode, 'int32');
34
+      fwrite(fid, ext.section(i).edata, 'uchar');
35
+   end
36
+
37
+   return;                                      % write_ext
38
+