loadData.m 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. addpath('nrrd_read_write_rensonnet')
  2. %patientID='2SMobr';
  3. %path='/home/studen/temp/dynamicSPECT';
  4. %load ventricle data
  5. %caFile=[ patientID '_Ventricle.mcsv'];
  6. %caFile=fullfile(path,caFile);
  7. %opts = detectImportOptions(caFile,'FileType','text');
  8. %ca=readmatrix(caFile,opts);
  9. [cax,cm]=loadTime(path,patientID);
  10. %w=cay/sum(cay);
  11. %w(1)=1;
  12. %caspline=csaps(cax,cay,p,[],w);
  13. %x=lsqnonlin(biexp,[20 3 10 5.5 0.1],[0,0,0,0,0],[Inf,Inf,Inf, Inf, Inf]);
  14. %chat0=[20, 3, 10, 5.5, 0.1];
  15. %chat0=[10 0.8 10 100];
  16. %lb=zeros(size(chat0));
  17. %ub=Inf*ones(size(chat0));
  18. %chat0=[chat0 cax(1:2)'];
  19. %lb=[lb cax(1:2)'];
  20. %ub=[ub cax(1:2)'];
  21. %chat=lsqcurvefit(@biexp,chat0 ,cax,cay,lb,ub);
  22. [c1 c2]=size(cax);
  23. volumeNamePattern=[ patientID '_Volume'];
  24. s0=[volumeNamePattern '0.nrrd'];
  25. ofile=fullfile(path,patientID,sprintf('%s_Volume0.nrrd',patientID));
  26. headerInfo = nhdr_nrrd_read(ofile,1);
  27. a0=headerInfo.data;
  28. [i1,i2,i3]=size(a0);
  29. data=zeros(i1,i2,i3,c1);
  30. for i=1:c1
  31. s=sprintf('%s_Volume%d.nrrd',patientID,i-1);
  32. ofile=fullfile(path,patientID,s);
  33. hInfo = nhdr_nrrd_read(ofile,1);
  34. hInfo.data(hInfo.data<0)=0;
  35. data(:,:,:,i)=hInfo.data/cm(i);
  36. end
  37. %A=reshape(data,[],c1);
  38. %find most common responses
  39. %[centers,U]=fcm(A,5);
  40. %data(ix,iy,iz,:)=A((iz-1)*i1*i2+(iy-1)*i1+ix,:)