

pat_path='C:\010-work\003_localGit\WiscPlan_v2\WiscPlanPhotonkV125\PatientData_dog5_HD';

% geometry
load([pat_path '\matlab_files\Geometry.mat'])
load([pat_path '\matlab_files\optResults.mat'])


CTin=Geometry.data;
Din = optResults.dose{end};
colorwash(CTin, Din, [-500, 500], [0,60])

roi_max = size(Geometry.ROIS,2);

for i= 1:roi_max
    ROI = logical(zeros(size(CTin)));
    ROI(Geometry.ROIS{1, 1}.ind) = 1;
    orthoslice(ROI, [0,1])

    [dvh, dosebins] = dvhist (Din, ROI);
    figure
    plot(dosebins, dvh, ...
    'Color', [0.5,0.0,0.1] , ...
    'LineStyle', '-', ...
    'DisplayName', 'test');
end



for roi_idx = 1:numel(obj.handles.hSVPS.Geometry.ROIS)
    if obj.handles.hSVPS.Geometry.ROIS{roi_idx}.visible == true % display == ON
        fprintf('%s\n', obj.handles.hSVPS.Geometry.ROIS{roi_idx}.name);
%                     [dvh dosebins] = dvhist(obj.handles.hSVPS.optResults.dose{end}, obj.handles.hSVPS.Geometry.ROIS{roi_idx}.ind);
        % temp solution for karthik dosimetry data
        [dvh dosebins] = dvhist(obj.handles.hSVPS.optResults.dose{end}, ...
            obj.handles.hSVPS.Geometry, ...
            roi_idx, ...
            nfrac);                    
        
    end
end

