Code covered by the BSD License  

Highlights from
Line Phantoms For Back Projection Detectability Tests

image thumbnail
from Line Phantoms For Back Projection Detectability Tests by Michael Chan
Drafts lines used as biomedical phantoms for Back Projection Detectability Tests.

draftLinesForBackProjectionTest(scratchPad, numberOfLinesRequired, offset_x, offset_y, ...
function scratchPad = draftLinesForBackProjectionTest(scratchPad, numberOfLinesRequired, offset_x, offset_y, ...
                                x_range, y_range, imageSize)
%DRAFTLINESFORBACKPROJECTIONTEST 
% Caveat: only able to draw 180 degrees, for 360 degrees, a mirror feature
% may be implemented later

numberOfLinesRequired = numberOfLinesRequired*2; % as the range of 0 to -180 degrees is not covered

  % start the lines plotting
  %lengthOfLine = 100;
  % update the lines
  startPoints = [1 1];
  % numberOfLinesRequired = 10; % == numberOfEndPoints
  startPoints = repmat(startPoints, numberOfLinesRequired, 1); % replicate column-wise
  
  degreeStepSize = 360/numberOfLinesRequired;
  degreeRanges = 0:degreeStepSize:360; % determines the fanning out of the lines, ie. how widely spread they are apart
  radianRanges = degreeRanges*(pi/180);
  
  endPoints = [];
  
%   offset_x = 30;
%   offset_y = 30;
  startPoints = [offset_y*startPoints(:,1) offset_x*startPoints(:,2)];
  
  % compute the end-points
  for i = 1:numberOfLinesRequired
      gradient = tan(radianRanges(i));
      y = (gradient*x_range);
      endPoints = [endPoints; x_range y];
  end
  
  %endPoints = lengthOfLine.*[2 2];  
  [ind label] = drawline(startPoints, endPoints, imageSize); 
  
  scratchPad(ind) = label;

end

Contact us