pet2doseHuman.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. addpath('C:\Documents and Settings\Steve\My Documents\Research\matlab')
  2. addpath('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqUtil')
  3. % petFileName = 'C:\Documents and Settings\Steve\My Documents\Research\Human\HeadAndNeck\HN003\MatlabData\cuATSMoptFlipped.am';
  4. % PET = am2geom(petFileName);
  5. TDP = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003laplace\continuous\PTV70dosePlus.bin');
  6. % TDPfull = full3D(TDP);
  7. % TDPbinary = single(~~TDPfull);
  8. % PETcorrected = PET.data.*TDPbinary;
  9. % PETsparse = sparse3D(PETcorrected);
  10. % PETnorm = PETsparse;
  11. % PETnorm.non_zero_values = PETsparse.non_zero_values./(max(PETsparse.non_zero_values));
  12. presc = TDP;
  13. ind = {};
  14. for k=1:10;
  15. dpresc = (max(presc.non_zero_values)-min(presc.non_zero_values))./k;
  16. minpresc = min(presc.non_zero_values);
  17. for n=1:Nstep;
  18. ind{n} = find(presc.non_zero_values >= (n-1)*dpresc + minpresc ...
  19. & presc.non_zero_values < n*dpresc + minpresc);
  20. presc.non_zero_values(ind{n}) = mean(presc.non_zero_values(ind{n}));
  21. end
  22. % for i=1:k;
  23. % ind{i} = find(PETnorm.non_zero_values >= (i-1)./k & PETnorm.non_zero_values < i./k);
  24. % PETnorm.non_zero_values(ind{i}) = double(20*i./k);
  25. % end
  26. % PETpresc = PETsparse;
  27. % PETpresc.non_zero_values = 70.+PETnorm.non_zero_values;
  28. % PETnorm.non_zero_values = PETsparse.non_zero_values./(max(PETsparse.non_zero_values));
  29. mkdir(['laplace' num2str(k)]);
  30. cd(['laplace' num2str(k)]);
  31. write_presc(presc);
  32. presc = TDP;
  33. end
  34. for k=12:2:20;
  35. dpresc = (max(presc.non_zero_values)-min(presc.non_zero_values))./k;
  36. minpresc = min(presc.non_zero_values);
  37. for n=1:Nstep;
  38. ind{n} = find(presc.non_zero_values >= (n-1)*dpresc + minpresc ...
  39. & presc.non_zero_values < n*dpresc + minpresc);
  40. presc.non_zero_values(ind{n}) = mean(presc.non_zero_values(ind{n}));
  41. end
  42. % for i=1:k;
  43. % ind{i} = find(PETnorm.non_zero_values >= (i-1)./k & PETnorm.non_zero_values < i./k);
  44. % PETnorm.non_zero_values(ind{i}) = double(20*i./k);
  45. % end
  46. % PETpresc = PETsparse;
  47. % PETpresc.non_zero_values = 70.+PETnorm.non_zero_values;
  48. % PETnorm.non_zero_values = PETsparse.non_zero_values./(max(PETsparse.non_zero_values));
  49. mkdir(['laplace' num2str(k)]);
  50. cd(['laplace' num2str(k)]);
  51. write_presc(presc);
  52. presc = TDP;
  53. end