writeData.m 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. %path already set by loadData
  2. headerInfoOut=headerInfo;
  3. k1=squeeze(xa(:,:,:,1));
  4. vbf=squeeze(xa(:,:,:,2));
  5. if size(xa,4)>2
  6. k2=squeeze(xa(:,:,:,3));
  7. end
  8. headerInfoOut.data=single(k1);
  9. headerInfoOut.content=[patientID '_k1'];
  10. nhdr_nrrd_write(fullfile(path,[patientID '_k1.nrrd']),headerInfoOut,1)
  11. if size(xa,4)>2
  12. headerInfoOut.data=single(k2);
  13. headerInfoOut.content=[patientID '_k2'];
  14. nhdr_nrrd_write(fullfile(path,[patientID '_k2.nrrd']),headerInfoOut,1)
  15. end
  16. headerInfoOut.data=single(vbf);
  17. headerInfoOut.content=[patientID '_vbf'];
  18. nhdr_nrrd_write(fullfile(path,[patientID '_vbf.nrrd']),headerInfoOut,1)
  19. dt=size(data);
  20. for i=1:nclass
  21. u=reshape(U(i,:),dt(1:3));
  22. headerInfoOut.data=single(u);
  23. headerInfoOut.content=sprintf('%s_center%i',patientID,i);
  24. nhdr_nrrd_write(fullfile(path,sprintf('%s_center%d.nrrd',patientID,i)),headerInfoOut,1);
  25. end
  26. %for i=1:c1
  27. % headerInfoOut.data=single(data1(:,:,:,i))*cm(i);
  28. % s=sprintf('%sVolume%d_model.nrrd',patientID,i-1);
  29. % nhdr_nrrd_write(fullfile(path,s),headerInfoOut,1);
  30. %end