1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- function eDVH(planName)
- 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\jake')
- addpath('C:\Documents and Settings\Steve\My Documents\Research\optNew\linlsqOpt\input')
- Ndvhbins = 1000; %number of dvh bins
- prescTumor = open_presc('PTV70DosePlus.bin'); %open prescription in Matlab
- prescNormal = open_presc('NormalDosePlus.bin');
- prescEyes = open_presc('EyesDosePlus.bin');
- %dim = 1; %2D
- dim = 35; %3D
- fid = fopen(planName,'rb'); %open plan in Matlab
- plan = reshape(fread(fid,'float'),93,93,dim);
- fclose(fid);
- for i=1:prescNormal.Nind;
- prescNormal.non_zero_values(i)=1;
- end
- for i=1:prescEyes.Nind;
- prescEyes.non_zero_values(i)=1;
- end
- tumorMask = single(~~(full3D(prescTumor))); %define tissue masks
- normalMask = single(~~(full3D(prescNormal)));
- eyesMask = single(~~(full3D(prescEyes)));
- tumorDose = plan.*tumorMask; %dose distributions in each ROI
- normalDose = plan.*normalMask;
- eyesDose = plan.*eyesMask;
- tumorDoseSparse = sparse3D(tumorDose); %convert 3D matrices to sparse matrices
- normalDoseSparse = sparse3D(normalDose);
- eyesDoseSparse = sparse3D(eyesDose);
- tumorNormDose = ((tumorDoseSparse.non_zero_values)./(prescTumor.non_zero_values)); %calculate equivalent uniform dose
- tumorAverageDose = mean(prescTumor.non_zero_values);
- tumorEdose = tumorNormDose.*tumorAverageDose;
- % NON UNIFORM PRESCRIPTIONS TO NORMAL TISSUE AND OAR
- % normalNormDose = ((normalDoseSparse.non_zero_values)./(prescNormal.non_zero_values));
- % normalAverageDose = mean(normalDoseSparse.non_zero_values);
- % normalEdose = normalNormDose.*normalAverageDose;
- %
- % eyesNormDose = ((eyesDoseSparse.non_zero_values)./(prescEyes.non_zero_values));
- % eyesAverageDose = mean(eyesDoseSparse.non_zero_values);
- % eyesEdose = eyesNormDose.*eyesAverageDose;
- dMax = 1.1*max(tumorEdose);
- dvhbins = [0:Ndvhbins-1]*dMax/Ndvhbins;
- dHistTumor = histc(tumorEdose,dvhbins);
- % dHistNormal = histc(normalEdose,dvhbins);
- % dHistEyes = histc(eyesEdose,dvhbins);
- %dHistTumor = histc(tumorDoseSparse.non_zero_values,dvhbins);
- dHistNormal = histc(normalDoseSparse.non_zero_values,dvhbins);
- dHistEyes = histc(eyesDoseSparse.non_zero_values,dvhbins);
- dHistTumorNorm = 100*dHistTumor./(double(tumorDoseSparse.Nind));
- dHistNormalNorm = 100*dHistNormal./(double(normalDoseSparse.Nind));
- dHistEyesNorm = 100*dHistEyes./(double(eyesDoseSparse.Nind));
- DVHtumor = flipud(cumsum(flipud(dHistTumorNorm)));
- DVHnormal = flipud(cumsum(flipud(dHistNormalNorm)));
- DVHeyes = flipud(cumsum(flipud(dHistEyesNorm)));
- createfigure(dvhbins,DVHtumor,DVHnormal,DVHeyes)
- end
|