|
@@ -91,12 +91,14 @@ classdef SliceViewerPanel < handle
|
|
|
% redraw only changed dimension
|
|
|
if obj.hSVPS.POI(obj.zOrien) ~= obj.hSVPS.prev_POI(obj.zOrien)
|
|
|
obj.redraw_image();
|
|
|
- obj.redraw_contour();
|
|
|
+% obj.redraw_contour();
|
|
|
+ obj.redraw_overlay();
|
|
|
end
|
|
|
case {'Geometry' 'ctWindow' 'ROIdisp' 'dosedisp'}
|
|
|
% redraw all
|
|
|
obj.redraw_image();
|
|
|
- obj.redraw_contour();
|
|
|
+% obj.redraw_contour();
|
|
|
+ obj.redraw_overlay();
|
|
|
case 'TCSVisible'
|
|
|
% redraw line
|
|
|
obj.redraw_lines();
|
|
@@ -336,8 +338,12 @@ classdef SliceViewerPanel < handle
|
|
|
end
|
|
|
%-------------------------------------------------------------------------------
|
|
|
function redraw_contour(obj)
|
|
|
+ % This function is not called anymore. See redraw_overlay for
|
|
|
+ % the actual drawing of the contours
|
|
|
+
|
|
|
slice = obj.hSVPS.POI(obj.zOrien);
|
|
|
-
|
|
|
+ disp('Contour!!')
|
|
|
+
|
|
|
delete(obj.hROIs);
|
|
|
obj.hROIs = [];
|
|
|
hold(obj.hAxis,'on');
|
|
@@ -346,7 +352,8 @@ classdef SliceViewerPanel < handle
|
|
|
if obj.hSVPS.Geometry.ROIS{i}.visible == false
|
|
|
continue;
|
|
|
end
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
switch obj.zOrien
|
|
|
case 1
|
|
|
curve_indices = find(obj.hSVPS.Geometry.ROIS{i}.Xcurves_slices == slice);
|
|
@@ -385,6 +392,114 @@ classdef SliceViewerPanel < handle
|
|
|
|
|
|
hold(obj.hAxis,'off');
|
|
|
end
|
|
|
+%-------------------------------------------------------------------------------
|
|
|
+ function redraw_overlay(obj)
|
|
|
+ slice = obj.hSVPS.POI(obj.zOrien);
|
|
|
+
|
|
|
+ delete(obj.hROIs);
|
|
|
+ obj.hROIs = [];
|
|
|
+ hold(obj.hAxis,'on');
|
|
|
+
|
|
|
+ for i = 1:numel(obj.hSVPS.Geometry.ROIS)
|
|
|
+ % skip if display == OFF
|
|
|
+% fprintf('ROI #%.0f', i)
|
|
|
+ if obj.hSVPS.Geometry.ROIS{i}.visible == false
|
|
|
+% fprintf(' skipped!\n', i)
|
|
|
+ continue;
|
|
|
+ end
|
|
|
+% fprintf(' analyzed!\n', i)
|
|
|
+
|
|
|
+ testIdxList=obj.hSVPS.Geometry.ROIS{i}.ind;
|
|
|
+ matSize=size(obj.hSVPS.Geometry.data);
|
|
|
+ [x,y,z] = ind2sub(matSize, testIdxList);
|
|
|
+
|
|
|
+% fprintf('ROI #%.0f \n', disp(obj.zOrien))
|
|
|
+ switch obj.zOrien
|
|
|
+ case 1
|
|
|
+ curve_indices = find(x == slice);
|
|
|
+ if ~isempty(curve_indices)
|
|
|
+ for curve_idx = curve_indices
|
|
|
+ canvas=zeros(matSize(2),matSize(3));
|
|
|
+ idx=sub2ind([matSize(2),matSize(3)], y(curve_indices), z(curve_indices));
|
|
|
+ canvas(idx)=1;
|
|
|
+
|
|
|
+% sum(canvas(:))
|
|
|
+ B = bwboundaries(canvas);
|
|
|
+ numContours=length(B);
|
|
|
+ for contourI=1:numContours
|
|
|
+ B_I = B{contourI};
|
|
|
+ clear C
|
|
|
+ % up-down (+ high)
|
|
|
+ yshift= obj.hSVPS.Geometry.start(2) - 1.5*obj.hSVPS.Geometry.voxel_size(2);
|
|
|
+ zshift= obj.hSVPS.Geometry.start(3) - 1.0*obj.hSVPS.Geometry.voxel_size(3);
|
|
|
+
|
|
|
+ C(:,1)= yshift + (B_I(:,1))*obj.hSVPS.Geometry.voxel_size(2);
|
|
|
+ C(:,2)= zshift + (B_I(:,2))*obj.hSVPS.Geometry.voxel_size(3);
|
|
|
+ obj.hROIs(end+1) = plot(obj.hAxis, ...
|
|
|
+ C(:,2), C(:,1), ...
|
|
|
+ '--', 'LineWidth', 2, 'Color', obj.hSVPS.Geometry.ROIS{i}.color);
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end % end of IF
|
|
|
+
|
|
|
+ case 2
|
|
|
+ curve_indices = find(y == slice);
|
|
|
+ if ~isempty(curve_indices)
|
|
|
+ for curve_idx = curve_indices
|
|
|
+ canvas=zeros(matSize(1),matSize(3));
|
|
|
+ idx=sub2ind([matSize(1),matSize(3)], x(curve_indices), z(curve_indices));
|
|
|
+ canvas(idx)=1;
|
|
|
+
|
|
|
+% sum(canvas(:))
|
|
|
+ B = bwboundaries(canvas);
|
|
|
+ numContours=length(B);
|
|
|
+ for contourI=1:numContours
|
|
|
+ B_I = B{contourI};
|
|
|
+ clear C
|
|
|
+ % up-down (+ high)
|
|
|
+ xshift= obj.hSVPS.Geometry.start(1) - 1.5*obj.hSVPS.Geometry.voxel_size(1);
|
|
|
+ zshift= obj.hSVPS.Geometry.start(3) - 1.0*obj.hSVPS.Geometry.voxel_size(3);
|
|
|
+
|
|
|
+ C(:,1)= xshift + (B_I(:,1))*obj.hSVPS.Geometry.voxel_size(1);
|
|
|
+ C(:,2)= zshift + (B_I(:,2))*obj.hSVPS.Geometry.voxel_size(3);
|
|
|
+ obj.hROIs(end+1) = plot(obj.hAxis, ...
|
|
|
+ C(:,2), C(:,1), ...
|
|
|
+ '--', 'LineWidth', 2, 'Color', obj.hSVPS.Geometry.ROIS{i}.color);
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end % end of IF
|
|
|
+
|
|
|
+ case 3
|
|
|
+ curve_indices = find(z == slice);
|
|
|
+ if ~isempty(curve_indices)
|
|
|
+ for curve_idx = curve_indices
|
|
|
+ canvas=zeros(matSize(1),matSize(2));
|
|
|
+ idx=sub2ind([matSize(1),matSize(2)], x(curve_indices), y(curve_indices));
|
|
|
+ canvas(idx)=1;
|
|
|
+
|
|
|
+% sum(canvas(:))
|
|
|
+ B = bwboundaries(canvas);
|
|
|
+ numContours=length(B);
|
|
|
+ for contourI=1:numContours
|
|
|
+ B_I = B{contourI};
|
|
|
+ clear C
|
|
|
+ % up-down (+ high)
|
|
|
+ yshift= obj.hSVPS.Geometry.start(2) - 1.5*obj.hSVPS.Geometry.voxel_size(2);
|
|
|
+ xshift= obj.hSVPS.Geometry.start(1) - 1.5*obj.hSVPS.Geometry.voxel_size(1);
|
|
|
+
|
|
|
+ C(:,1)= yshift + (B_I(:,1))*obj.hSVPS.Geometry.voxel_size(1);
|
|
|
+ C(:,2)= xshift + (B_I(:,2))*obj.hSVPS.Geometry.voxel_size(2);
|
|
|
+ obj.hROIs(end+1) = plot(obj.hAxis, ...
|
|
|
+ C(:,2), C(:,1), ...
|
|
|
+ '--', 'LineWidth', 2, 'Color', obj.hSVPS.Geometry.ROIS{i}.color);
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end % end of IF
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ hold(obj.hAxis,'off');
|
|
|
+ end
|
|
|
%-------------------------------------------------------------------------------
|
|
|
end % methods
|
|
|
%===============================================================================
|