pet2doseHuman.asv 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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(['linDiscrete' num2str(k)]);
  30. cd(['linDiscrete' num2str(k)]);
  31. write_presc(PETpresc);
  32. end
  33. for k=12:2:20;
  34. for n=1:Nstep;
  35. ind{n} = find(presc.non_zero_values >= (n-1)*dpresc + minpresc ...
  36. & presc.non_zero_values < n*dpresc + minpresc);
  37. presc.non_zero_values(ind{n}) = mean(presc.non_zero_values(ind{n}));
  38. end
  39. for i=1:k;
  40. ind{i} = find(PETnorm.non_zero_values >= (i-1)./k & PETnorm.non_zero_values < i./k);
  41. PETnorm.non_zero_values(ind{i}) = double(20*i./k);
  42. end
  43. PETpresc = PETsparse;
  44. PETpresc.non_zero_values = 70.+PETnorm.non_zero_values;
  45. PETnorm.non_zero_values = PETsparse.non_zero_values./(max(PETsparse.non_zero_values));
  46. mkdir(['linDiscrete' num2str(k)]);
  47. cd(['linDiscrete' num2str(k)]);
  48. write_presc(PETpresc);
  49. end