loadSPECTdata.m 595 B

123456789101112131415161718192021222324
  1. function data = loadSPECTdata(path,patientID,cm)
  2. %loadData Summary of this function goes here
  3. % Detailed explanation goes here
  4. c1=size(cm,1);
  5. ofile=fullfile(path,patientID,sprintf('%s_Volume0.nrrd',patientID));
  6. headerInfo = nhdr_nrrd_read(ofile,1);
  7. a0=headerInfo.data;
  8. [i1,i2,i3]=size(a0);
  9. data=zeros(i1,i2,i3,c1);
  10. for i=1:c1
  11. s=sprintf('%s_Volume%d.nrrd',patientID,i-1);
  12. ofile=fullfile(path,patientID,s);
  13. hInfo = nhdr_nrrd_read(ofile,1);
  14. hInfo.data(hInfo.data<0)=0;
  15. data(:,:,:,i)=hInfo.data/cm(i);
  16. end
  17. end