123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- function [cellVOI] = dicomrt_loadvoi(rtstruct_filename)
- dictFlg = checkDictUse;
- if dictFlg
- rtstruct=dicominfo(rtstruct_filename,'dictionary', 'ES - IPT4.1CompatibleDictionary.mat');
- else
- rtstruct=dicominfo(rtstruct_filename);
- end
- ROIContourSequence=fieldnames(rtstruct.ROIContourSequence);
- VOI=cell(size(ROIContourSequence,1),2);
- h = waitbar(0,['Loading progress:']);
- set(h,'Name','dicomrt_loadvoi: loading RTSTRUCT objects');
- for i=1:size(ROIContourSequence,1)
- voilabel=getfield(rtstruct.StructureSetROISequence,char(ROIContourSequence(i)),'ROIName');
- VOI{i,1}=voilabel;
- try
- ncont_temp=fieldnames(getfield(rtstruct.ROIContourSequence,char(ROIContourSequence(i)), ...
- 'ContourSequence'));
- catch
- warning(['ContourSequence not found for ROI: ', voilabel]);
- ncont_temp = [];
- end
- switch isempty(ncont_temp)
- case 0
- for j=1:size(ncont_temp,1)
- if j==1
- VOI{i,2}=cell(size(ncont_temp,1),1);
- end
- try
- NumberOfContourPoints=getfield(rtstruct.ROIContourSequence,char(ROIContourSequence(i)), ...
- 'ContourSequence', char(ncont_temp(j)),'NumberOfContourPoints');
- ContourData=getfield(rtstruct.ROIContourSequence,char(ROIContourSequence(i)), ...
- 'ContourSequence',char(ncont_temp(j)),'ContourData');
- x=dicomrt_mmdigit(ContourData(1:3:NumberOfContourPoints*3)*0.1,7);
- y=dicomrt_mmdigit(ContourData(2:3:NumberOfContourPoints*3)*0.1,7);
- z=dicomrt_mmdigit(ContourData(3:3:NumberOfContourPoints*3)*0.1,7);
- VOI{i,2}{j,1}=cat(2,x,y,z);
- end
- end
- case 1
-
- NumberOfContourPoints=1;
- ContourData=[0,0,0];
- x=0;
- y=0;
- z=0;
- VOI{i,2}{1,1}=cat(2,x,y,z);
- end
- waitbar(i/size(ROIContourSequence,1),h);
- ncont_temp=[];
- end
- cellVOI=cell(3,1);
- cellVOI{1,1}=rtstruct;
- cellVOI{2,1}=VOI;
- cellVOI{3,1}=[];
- close(h);
|