資源簡(jiǎn)介
可以一次批量讀取多個(gè)患者放射治療計(jì)劃Dicom RTstructure,dose,plan文件并格式化輸出DVH數(shù)據(jù)到excel的matlab代碼;該代碼文件內(nèi)描述了需要輸入的患者dicom文件的命名格式
代碼片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%?%%
%%?Code?writer?:?Song?Wei?from?jiangsu?province?hospital?of?t.c.m.
%%?Reference?:?Anil?Pyakuryal?Northwestern?Memorial?Hospital?/?University?of?Illinois?at?ChicagoHART
%%?Purpose:???格式化輸出一批患者多種計(jì)劃的DVH數(shù)據(jù)到excel文件,以便后續(xù)使用spss等統(tǒng)計(jì)軟件比較?????????????????????????????????????????????????????????????????????????????????????????????????????%%??
function?h?=OuputDVHtoExcel()
%display(‘Customized?Format?of?the?cDVH?analysis?of?DICOMRT?plan.‘);?fprintf(‘\n‘);
clc;
clear;
%?Select?Input?/?Output?Patient?Folders
folder?=?uigetdir(‘C:\‘‘SELECT?PATIENT?FOLDER‘);%open?standard?dialog?box?for?selecting?directory
%checkin?=?strcmp(folder‘C:\NWRR?DIR\‘);
checkout?=?strcmp(folder‘0‘);
if?(~isempty(folder)?&&??checkout==0?)%not?empmtynot‘C:\NWRR?DIR\‘??and?not?‘0‘
????if(isdir(‘C:\INPUT‘))%if?input?exists?then?delete
????????rmdir(‘C:\INPUT‘‘s‘);%without?s?only?empty?folder?can?be?deleted?or?error
????end
????mkdir(‘C:\INPUT‘);fprintf(‘\n‘);%creates?a?folder
????copyfile(folder‘C:\INPUT‘);%copy?files?from?folder?to?INPUT
????[FileNamePathName]?=?uiputfile(‘.xlsx‘‘SELECT?OUTPUT?FOLDER‘‘C:\‘);%Open?standard?dialog?box?for?saving?files
????
end
%?Counting?the?number?of?files?in?the?Input?Data?folder?and??assigning?files?x?(structure)?and?z?(dose)
list=dir(‘C:\INPUT\*.dcm‘);
[a?b]?=size(list);
%the?format?of?DICOM?RT?doseplan?structure?file?names?for?each?patient?
%每個(gè)病人的DICOM?文件命名方式
%RD.2017007_p1.dcm?
%RD.2017007_p2.dcm
%RP.2017007_p1.dcm
%RP.2017007_p2.dcm
%RS.2017007_.dcm
%RD.2017009_p1.dcm?
%RD.2017009_p2.dcm
%RP.2017009_p1.dcm
%RP.2017009_p2.dcm
%RS.2017009_.dcm
%...
plantypes=?2;
patientnum=?a/?(1+?2*?plantypes);%a/3;?plantypes?個(gè)?RD?RP?file?1?個(gè)RS?file?per?patient
ID=zeros(patientnum1);%interger?%save?the?index?in?file?list
RD=zeros(patientnumplantypes);
RS=zeros(patientnum1);
planname={‘p1‘‘p2‘};%可以超過(guò)兩種計(jì)劃,自行修改
Targets={‘PTV‘};
Structures={‘Lungs‘‘Cord_PRV‘‘Heart‘‘Body-P‘‘Brachial?Plexus‘};
RP=?zeros(patientnumplantypes);
%?TdSet=?PrescriptionDose*[0.95?1];%D?Gyto?get?V95%?V100%?prescription?dose?60?Gy?for?Targets.
%?TdSetNameOutput=?[95?100];%output?name?in?the?form?of?percent?dose?ie?V95%
%?
%?TvSet=?volt*[0.02?0.98?0.5];%V?absolute?volume?cm3?to?get?D2%?D98%?D50%
%?TvSetNameOutput=?[2?98?50];%V%?output?name?in?the?form?of?percent?volume?ie?D2%
%?
%?SdSet=[51015203040505760];%V5?V10...Gy?output?name?in?the?form?of?abs?dose?ie?V5(Gy)
%?
%?SvSet=?volt*[0.010.05];%V?absolute?volume?cm3?to?get?D1%
%?SvSetNameOutput=?[1?5];%V%?output?name?in?the?form?of?percent?volume?ie?D2%
%%%%%%%%%%%%%%%%%%%%%%Initialize?output?variable?array
%需要輸出的靶區(qū)DVH參數(shù),可自行修改
%?Calculation?of??Target?Volume?Vd
TdSetNameOutput=?[95?100];%?V95%??V100%
%?Calculation?of??Target?Dv
TvSetNameOutput=?[2?98?50];%?D2%?D98%?D50%
%%%%%%%%%%%%%%%%%%%%%%%Initialize?output?variable?array
%需要輸出的OARDVH參數(shù),可自行修改
%?Calculation?of??OA
評(píng)論
共有 條評(píng)論