1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- % Linear least squares optimization for Jake the Dogg
- % set up the optimizer setup
- optSettings = [];
- optSettings.optInfo.Niterations = 100;
- optSettings.optInfo.Nperbatch = 50;
- optSettings.optInfo.optRun = 'no';
- optSettings.optInfo.waitForResults = 'no';
- optSettings.optInfo.saveOptInfo = 'yes';
- optSettings.beamletInfo.saveBeamlets = 'no';
- optSettings.beamletInfo.saveBeamletHeader = 'yes';
- optSettings.prescInfo.savePresc = 'yes';
- % Prescription table
- % (code name) (file name) (plot flag) (color) (alpha) (Bplus) (dplus) (Bminus) (dminus) (BVplus) (dVplus) (Vplus) (BVminus) (dVminus) (Vminus)
- prescTable = {
- 'Tumor' 'tumor.short.am' 1 'blue' 1 100 100 100 100 0 0 0 0 0 0
- 'Normal' 'normal.short.am' 0 'magenta' 1 10 0 0 0 0 0 0 0 0 0
- 'Eyes' 'eyes.short.am' 2 'green' 1 1 0 0 0 0 0 0 0 0 0
- };
- % Create the prescription structure
- presc = []; % erase the old prescription structure, if it exists
- % assign the parameters to the prescription structure
- for j=1:size(prescTable,1)
-
- % pull out the prescription indices for each tissue
- tissName = prescTable{j,1}; % current tissue name
- amiraFileName = prescTable{
-
- %convert amira files to matlab data structures
- ROI = {'Tumor' 'Normal' 'Eyes'};
- ROI{j} = [];
- ROI{j} = am2geom(prescTable{j,2});
-
- if strcmp(tissName,'Tumor')
- ind = find(ROI{j}.data)-1;
- elseif strcmp(tissName,'Normal')
- ind = find(ROI{j}.data)-1;
- elseif strcmp(tissName,'Eyes')
- ind = find(ROI{j}.data)-1;
- else
- error('Unknown tissue type');
- end
-
- presc.tissue(j).name = prescTable{j,1};
- presc.tissue(j).filename = prescTable(j,2);
- presc.tissue(j).plotFlag = prescTable{j,3};
- presc.tissue(j).colorName = prescTable{j,4};
-
- % look up the color code (an error will be thrown if it doesn't exist)
- presc.tissue(j).colorCode = plotColors(presc.tissue(j).colorName);
-
- presc.tissue(j).ind = ind;
- presc.tissue(j).alpha = prescTable{j,5};
- presc.tissue(j).betaPlus = prescTable{j,6};
- presc.tissue(j).dPlus = single(zeros(size(ind)) + prescTable{j,7});
- presc.tissue(j).betaMinus = prescTable{j,8};
- presc.tissue(j).dMinus = single(zeros(size(ind)) + prescTable{j,9});
- presc.tissue(j).betaVPlus = prescTable{j,10};
- presc.tissue(j).dVPlus = prescTable{j,11};
- presc.tissue(j).vPlus = prescTable{j,12};
- presc.tissue(j).betaVMinus = prescTable{j,13};
- presc.tissue(j).dVMinus = prescTable{j,14};
- presc.tissue(j).vMinus = prescTable{j,15};
- end
- optSettings.prescInfo.presc = presc; % set prescription
- % calculate initial guess
- w0 = calcNormalizedInitialGuess(B360,presc);
- optSettings.initialGuessInfo.w0 = w0;
- optSettings.beamletInfo.beamlets = B360;
- [w,dose] = linlsqOptimization(optSettings);
|