Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

save_nii_ext.m 1015 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. if ~exist('ext','var') | ~exist('fid','var')
  13. error('Usage: save_nii_ext(ext, fid)');
  14. end
  15. if ~isfield(ext,'extension') | ~isfield(ext,'section') | ~isfield(ext,'num_ext')
  16. error('Wrong header extension');
  17. end
  18. write_ext(ext, fid);
  19. return; % save_nii_ext
  20. %---------------------------------------------------------------------
  21. function write_ext(ext, fid)
  22. fwrite(fid, ext.extension, 'uchar');
  23. for i=1:ext.num_ext
  24. fwrite(fid, ext.section(i).esize, 'int32');
  25. fwrite(fid, ext.section(i).ecode, 'int32');
  26. fwrite(fid, ext.section(i).edata, 'uchar');
  27. end
  28. return; % write_ext