make_DP_maps_Tomo.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. if true
  2. %% load up NRRD
  3. load('C:\010-work\003_localGit\WiscPlan_v2\data\PD_HD_dicomPhantom\matlab_files\Geometry.mat')
  4. CTin = Geometry.data;
  5. % orthoslice(CTin)
  6. ROImap=zeros(size(CTin));
  7. ROImap(Geometry.ROIS{1, 2}.ind)=1;
  8. doseMap = zeros(size(ROImap));
  9. for z = 1:size(ROImap, 3)
  10. doseMap(:,:,z) = bwdist(1-ROImap(:,:,z));
  11. end
  12. % orthoslice(doseMap)
  13. matrix = 50* ones(size(CTin))+2* doseMap;
  14. % matrix = 50* ones(size(CTin));
  15. % temp = 50* ones(size(CTin)) + 2*(max(doseMap(:))-doseMap);
  16. % matrix(Geometry.ROIS{1, 2}.ind)=temp(Geometry.ROIS{1, 2}.ind);
  17. % orthoslice(matrix)
  18. % save nrrds
  19. filename = ['C:\010-work\003_localGit\WiscPlan_v2\data\PD_HD_dicomPhantom\Tomo_DP_target.nrrd'];
  20. pixelspacing = Geometry.voxel_size;
  21. origin = Geometry.start;
  22. encoding ='raw'; % 'raw', 'ascii' or 'gzip'
  23. ok = nrrdWriter(filename, matrix, pixelspacing, origin, encoding)
  24. end
  25. if false
  26. [D_full, w_fin, Geometry, optGoal] = NLP_beamlet_optimizer;
  27. orthoslice(matrix)
  28. orthoslice(D_full)
  29. colorwash(Geometry.data, matrix, [500, 1500], [0,70])
  30. colorwash(Geometry.data, D_full, [500, 1500], [0,70])
  31. slice_i = 24;
  32. D_diff = D_full - matrix;
  33. orthoslice(D_diff)
  34. end