jakeOptSetup.asv 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. % Linear least squares optimization for Jake the Dogg
  2. % set up the optimizer setup
  3. optSettings = [];
  4. optSettings.optInfo.Niterations = 100;
  5. optSettings.optInfo.Nperbatch = 50;
  6. optSettings.optInfo.optRun = 'no';
  7. optSettings.optInfo.waitForResults = 'no';
  8. optSettings.optInfo.saveOptInfo = 'yes';
  9. optSettings.beamletInfo.saveBeamlets = 'no';
  10. optSettings.beamletInfo.saveBeamletHeader = 'yes';
  11. optSettings.prescInfo.savePresc = 'yes';
  12. % Prescription table
  13. % (code name) (file name) (plot flag) (color) (alpha) (Bplus) (dplus) (Bminus) (dminus) (BVplus) (dVplus) (Vplus) (BVminus) (dVminus) (Vminus)
  14. prescTable = {
  15. 'Tumor' 'tumor.short.am' 1 'blue' 1 100 100 100 100 0 0 0 0 0 0
  16. 'Normal' 'normal.short.am' 0 'magenta' 1 10 0 0 0 0 0 0 0 0 0
  17. 'Eyes' 'eyes.short.am' 2 'green' 1 1 0 0 0 0 0 0 0 0 0
  18. };
  19. % Create the prescription structure
  20. presc = []; % erase the old prescription structure, if it exists
  21. % assign the parameters to the prescription structure
  22. for j=1:size(prescTable,1)
  23. % pull out the prescription indices for each tissue
  24. tissName = prescTable{j,1}; % current tissue name
  25. amiraFileName = prescTable{
  26. %convert amira files to matlab data structures
  27. ROI = {'Tumor' 'Normal' 'Eyes'};
  28. ROI{j} = [];
  29. ROI{j} = am2geom(prescTable{j,2});
  30. if strcmp(tissName,'Tumor')
  31. ind = find(ROI{j}.data)-1;
  32. elseif strcmp(tissName,'Normal')
  33. ind = find(ROI{j}.data)-1;
  34. elseif strcmp(tissName,'Eyes')
  35. ind = find(ROI{j}.data)-1;
  36. else
  37. error('Unknown tissue type');
  38. end
  39. presc.tissue(j).name = prescTable{j,1};
  40. presc.tissue(j).filename = prescTable(j,2);
  41. presc.tissue(j).plotFlag = prescTable{j,3};
  42. presc.tissue(j).colorName = prescTable{j,4};
  43. % look up the color code (an error will be thrown if it doesn't exist)
  44. presc.tissue(j).colorCode = plotColors(presc.tissue(j).colorName);
  45. presc.tissue(j).ind = ind;
  46. presc.tissue(j).alpha = prescTable{j,5};
  47. presc.tissue(j).betaPlus = prescTable{j,6};
  48. presc.tissue(j).dPlus = single(zeros(size(ind)) + prescTable{j,7});
  49. presc.tissue(j).betaMinus = prescTable{j,8};
  50. presc.tissue(j).dMinus = single(zeros(size(ind)) + prescTable{j,9});
  51. presc.tissue(j).betaVPlus = prescTable{j,10};
  52. presc.tissue(j).dVPlus = prescTable{j,11};
  53. presc.tissue(j).vPlus = prescTable{j,12};
  54. presc.tissue(j).betaVMinus = prescTable{j,13};
  55. presc.tissue(j).dVMinus = prescTable{j,14};
  56. presc.tissue(j).vMinus = prescTable{j,15};
  57. end
  58. optSettings.prescInfo.presc = presc; % set prescription
  59. % calculate initial guess
  60. w0 = calcNormalizedInitialGuess(B360,presc);
  61. optSettings.initialGuessInfo.w0 = w0;
  62. optSettings.beamletInfo.beamlets = B360;
  63. [w,dose] = linlsqOptimization(optSettings);