123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- function tumorSigSlopeDVH(sig1,sig2,sig3,sig4,sig5,sig6,sig7,sig8)
- addpath('C:\Documents and Settings\Steve\My Documents\Research\matlab')
- addpath('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqUtil')
- addpath('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input')
- Ndvhbins = 1000; %number of dvh bins
- prescTumorUni = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003uniPrescVolNew\PTV70DosePlus.bin');
- prescTumorSig1 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.5\PTV70DosePlus.bin'); %open prescription in Matlab
- prescTumorSig2 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.5\PTV70DosePlus.bin');
- prescTumorSig3 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.5\PTV70DosePlus.bin');
- prescTumorSig4 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.4\PTV70DosePlus.bin');
- prescTumorSig5 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.5\PTV70DosePlus.bin');
- prescTumorSig6 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.6\PTV70DosePlus.bin');
- prescTumorSig7 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.7\PTV70DosePlus.bin');
- prescTumorSig8 = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003sigmoidLaw\doseRedistribution\normGomp2.8\PTV70DosePlus.bin');
- prescNormal = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003uniPrescVolNew\NormalDosePlus.bin');
- prescLarynx = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003uniPrescVolNew\larynxDosePlus.bin');
- prescRt = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003uniPrescVolNew\RtparotidDosePlus.bin');
- prescLt = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003uniPrescVolNew\LtparotidDosePlus.bin');
- prescCord = open_presc('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input\HN003uniPrescVolNew\CordDosePlus.bin');
- dim = 30; %3D
- fid = fopen(sig1,'rb'); %open plans in Matlab
- planSig1 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig2,'rb'); %open plans in Matlab
- planSig2 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig3,'rb'); %open plans in Matlab
- planSig3 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig4,'rb'); %open plans in Matlab
- planSig4 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig5,'rb'); %open plans in Matlab
- planSig5 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig6,'rb'); %open plans in Matlab
- planSig6 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig7,'rb'); %open plans in Matlab
- planSig7 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- fid = fopen(sig8,'rb'); %open plans in Matlab
- planSig8 = reshape(fread(fid,'float'),72,72,dim);
- fclose(fid);
- for i=1:prescNormal.Nind;
- prescNormal.non_zero_values(i)=1;
- end
- for i=1:prescLarynx.Nind;
- prescLarynx.non_zero_values(i)=1;
- end
- for i=1:prescRt.Nind;
- prescRt.non_zero_values(i)=1;
- end
- for i=1:prescLt.Nind;
- prescLt.non_zero_values(i)=1;
- end
- for i=1:prescCord.Nind;
- prescCord.non_zero_values(i)=1;
- end
- tumorMaskUni = single(~~(full3D(prescTumorUni)));
- tumorMaskSig1 = single(~~(full3D(prescTumorSig1))); %define tissue masks
- tumorMaskSig2 = single(~~(full3D(prescTumorSig2)));
- tumorMaskSig3 = single(~~(full3D(prescTumorSig3)));
- tumorMaskSig4 = single(~~(full3D(prescTumorSig4)));
- tumorMaskSig5 = single(~~(full3D(prescTumorSig5)));
- tumorMaskSig6 = single(~~(full3D(prescTumorSig6)));
- tumorMaskSig7 = single(~~(full3D(prescTumorSig7)));
- tumorMaskSig8 = single(~~(full3D(prescTumorSig8)));
- larynxMask = single(~~(full3D(prescLarynx)));
- rtMask = single(~~(full3D(prescRt)));
- cordMask = single(~~(full3D(prescCord)));
- tumorDoseSig1 = planSig1.*tumorMaskSig1; %dose distributions in each ROI
- tumorDoseSig2 = planSig2.*tumorMaskSig2;
- tumorDoseSig3 = planSig3.*tumorMaskSig3;
- tumorDoseSig4 = planSig4.*tumorMaskSig4;
- tumorDoseSig5 = planSig5.*tumorMaskSig5;
- tumorDoseSig6 = planSig6.*tumorMaskSig6;
- tumorDoseSig7 = planSig7.*tumorMaskSig7;
- tumorDoseSig8 = planSig8.*tumorMaskSig8;
- tumorDoseSparseSig1 = sparse3D(tumorDoseSig1);
- tumorDoseSparseSig2 = sparse3D(tumorDoseSig2);
- tumorDoseSparseSig3 = sparse3D(tumorDoseSig3);
- tumorDoseSparseSig4 = sparse3D(tumorDoseSig4);
- tumorDoseSparseSig5 = sparse3D(tumorDoseSig5);
- tumorDoseSparseSig6 = sparse3D(tumorDoseSig6);
- tumorDoseSparseSig7 = sparse3D(tumorDoseSig7);
- tumorDoseSparseSig8 = sparse3D(tumorDoseSig8);
- tumorNormDoseSig1 = ((tumorDoseSparseSig1.non_zero_values)./(prescTumorSig1.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig1 = mean(prescTumorSig1.non_zero_values);
- tumorEdoseSig1 = tumorNormDoseSig1.*tumorAverageDoseSig1;
- tumorEdoseSig1 = tumorNormDoseSig1;
- indSig1 = find(((tumorNormDoseSig1-1.).^2).^(1/2) >= 0.05);
- volSig1 = 100.-double(length(indSig1))./(double(tumorDoseSparseSig1.Nind))*100
- tumorNormDoseSig2 = ((tumorDoseSparseSig2.non_zero_values)./(prescTumorSig2.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig2 = mean(prescTumorSig2.non_zero_values);
- tumorEdoseSig2 = tumorNormDoseSig2.*tumorAverageDoseSig2;
- tumorEdoseSig2 = tumorNormDoseSig2;
- indSig2 = find(((tumorNormDoseSig2-1.).^2).^(1/2) >= 0.05);
- volSig2 = 100.-double(length(indSig2))./(double(tumorDoseSparseSig2.Nind))*100
- tumorNormDoseSig3 = ((tumorDoseSparseSig3.non_zero_values)./(prescTumorSig3.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig3 = mean(prescTumorSig3.non_zero_values);
- tumorEdoseSig3 = tumorNormDoseSig3.*tumorAverageDoseSig3;
- tumorEdoseSig3 = tumorNormDoseSig3;
- indSig3 = find(((tumorNormDoseSig3-1.).^2).^(1/2) >= 0.05);
- volSig3 = 100.-double(length(indSig3))./(double(tumorDoseSparseSig3.Nind))*100
- tumorNormDoseSig4 = ((tumorDoseSparseSig4.non_zero_values)./(prescTumorSig4.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig4 = mean(prescTumorSig4.non_zero_values);
- tumorEdoseSig4 = tumorNormDoseSig4.*tumorAverageDoseSig4;
- tumorEdoseSig4 = tumorNormDoseSig4;
- indSig4 = find(((tumorNormDoseSig4-1.).^2).^(1/2) >= 0.05);
- volSig4 = 100.-double(length(indSig4))./(double(tumorDoseSparseSig4.Nind))*100
- tumorNormDoseSig5 = ((tumorDoseSparseSig5.non_zero_values)./(prescTumorSig5.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig5 = mean(prescTumorSig5.non_zero_values);
- tumorEdoseSig5 = tumorNormDoseSig5.*tumorAverageDoseSig5;
- tumorEdoseSig5 = tumorNormDoseSig5;
- indSig5 = find(((tumorNormDoseSig5-1.).^2).^(1/2) >= 0.05);
- volSig5 = 100.-double(length(indSig5))./(double(tumorDoseSparseSig5.Nind))*100
- tumorNormDoseSig6 = ((tumorDoseSparseSig6.non_zero_values)./(prescTumorSig6.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig6 = mean(prescTumorSig6.non_zero_values);
- tumorEdoseSig6 = tumorNormDoseSig6.*tumorAverageDoseSig6;
- tumorEdoseSig6 = tumorNormDoseSig6;
- indSig6 = find(((tumorNormDoseSig6-1.).^2).^(1/2) >= 0.05);
- volSig6 = 100.-double(length(indSig6))./(double(tumorDoseSparseSig6.Nind))*100
- tumorNormDoseSig7 = ((tumorDoseSparseSig7.non_zero_values)./(prescTumorSig7.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig7 = mean(prescTumorSig7.non_zero_values);
- tumorEdoseSig7 = tumorNormDoseSig7.*tumorAverageDoseSig7;
- tumorEdoseSig7 = tumorNormDoseSig7;
- indSig7 = find(((tumorNormDoseSig7-1.).^2).^(1/2) >= 0.05);
- volSig7 = 100.-double(length(indSig7))./(double(tumorDoseSparseSig7.Nind))*100
- tumorNormDoseSig8 = ((tumorDoseSparseSig8.non_zero_values)./(prescTumorSig8.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDoseSig8 = mean(prescTumorSig8.non_zero_values);
- tumorEdoseSig8 = tumorNormDoseSig8.*tumorAverageDoseSig8;
- tumorEdoseSig8 = tumorNormDoseSig8;
- indSig8 = find(((tumorNormDoseSig8-1.).^2).^(1/2) >= 0.05);
- volSig8 = 100.-double(length(indSig8))./(double(tumorDoseSparseSig8.Nind))*100
- dMax = 1.1*max(tumorEdoseSig1);
- dvhbins = [0:Ndvhbins-1]*dMax/Ndvhbins;
- dHistTumorSig1 = histc(tumorEdoseSig1,dvhbins);
- dHistTumorSig2 = histc(tumorEdoseSig2,dvhbins);
- dHistTumorSig3 = histc(tumorEdoseSig3,dvhbins);
- dHistTumorSig4 = histc(tumorEdoseSig4,dvhbins);
- dHistTumorSig5 = histc(tumorEdoseSig5,dvhbins);
- dHistTumorSig6 = histc(tumorEdoseSig6,dvhbins);
- dHistTumorSig7 = histc(tumorEdoseSig7,dvhbins);
- dHistTumorSig8 = histc(tumorEdoseSig8,dvhbins);
- dHistTumorNormSig1 = 100*dHistTumorSig1./(double(tumorDoseSparseSig1.Nind));
- dHistTumorNormSig2 = 100*dHistTumorSig2./(double(tumorDoseSparseSig2.Nind));
- dHistTumorNormSig3 = 100*dHistTumorSig3./(double(tumorDoseSparseSig3.Nind));
- dHistTumorNormSig4 = 100*dHistTumorSig4./(double(tumorDoseSparseSig4.Nind));
- dHistTumorNormSig5 = 100*dHistTumorSig5./(double(tumorDoseSparseSig5.Nind));
- dHistTumorNormSig6 = 100*dHistTumorSig6./(double(tumorDoseSparseSig6.Nind));
- dHistTumorNormSig7 = 100*dHistTumorSig7./(double(tumorDoseSparseSig7.Nind));
- dHistTumorNormSig8 = 100*dHistTumorSig8./(double(tumorDoseSparseSig8.Nind));
- DVHtumorSig1 = flipud(cumsum(flipud(dHistTumorNormSig1)));
- DVHtumorSig2 = flipud(cumsum(flipud(dHistTumorNormSig2)));
- DVHtumorSig3 = flipud(cumsum(flipud(dHistTumorNormSig3)));
- DVHtumorSig4 = flipud(cumsum(flipud(dHistTumorNormSig4)));
- DVHtumorSig5 = flipud(cumsum(flipud(dHistTumorNormSig5)));
- DVHtumorSig6 = flipud(cumsum(flipud(dHistTumorNormSig6)));
- DVHtumorSig7 = flipud(cumsum(flipud(dHistTumorNormSig7)));
- DVHtumorSig8 = flipud(cumsum(flipud(dHistTumorNormSig8)));
- tumorSigFigure(dvhbins,DVHtumorSig1,DVHtumorSig2,DVHtumorSig3,DVHtumorSig4,DVHtumorSig5,DVHtumorSig6,DVHtumorSig7,DVHtumorSig8)
- end
|