writeDcmProj.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. %% Author: Aleks Prša
  2. % Date: May, 2022
  3. % alex.prsa@gmail.com
  4. % =========================================================================
  5. %{
  6. % -------------------------------------------------------------------------
  7. % writeDcmProj(dataProj,filestring,parameter)
  8. % -------------------------------------------------------------------------
  9. % DESCRIPTION:
  10. % This function write a set of Dicom images with respective headers.
  11. %
  12. %
  13. % INPUT:
  14. % - dataProj = Projection images
  15. % - filestring = Path to save
  16. % - parameter = Parameter of all geometry
  17. %
  18. % ---------------------------------------------------------------------
  19. %}
  20. % =========================================================================
  21. %% Write Dicom images
  22. function writeDcm(dataProj,filestring,parameter)
  23. for k=1:size(dataProj,3)
  24. dataProj = uint16(dataProj);
  25. end
  26. % Write dicom files in respective folder
  27. fprintf('%3d/%3d', 1, parameter.nProj)
  28. for i=1:size(dataProj,3)
  29. fprintf('\b\b\b\b\b\b\b%3d/%3d', i, parameter.nProj)
  30. if(i<10)
  31. fileimg = [filestring,filesep,'0',num2str(i),'.dcm'];
  32. else
  33. fileimg = [filestring,filesep,num2str(i),'.dcm'];
  34. end
  35. dicomwrite(dataProj(:,:,i), fileimg);
  36. end
  37. end