Skip to content
Snippets Groups Projects
Commit 2a9e8ac2 authored by Sandro Pereira's avatar Sandro Pereira
Browse files

Upload f_barMask_V2

parent 6e8ce4df
No related branches found
No related tags found
No related merge requests found
function [BarMask, BarCenter] = f_barMask(length_um, umPerPixel, imSize, position_x, position_y, height)
%Create a mask corresponding to a scalebar:
% length_um defines the length of the scalebar in um
% umPerPixel corresponds to the pixelsize in um per pixel
% imSize corresponds to the size of the image. Use size(ImageOfInterest) to assign this value
% position corresponds to the bottom left pixel coordinate of the scalebar
% x,
% y,
% height corresponds to the hight of the scalebar
Image = zeros(imSize(1), imSize(2));
BarPixelLength = round(length_um / umPerPixel);
%Image((position_x : position_x + BarPixelLength), (position_y : position_y + hight)) = 1;
Image((position_x : position_x + height), (position_y : position_y + BarPixelLength)) = 1;
BarMask = Image;
BarMask = (BarMask ~= 0);
BarCenterX = (position_x + (position_x + height)) / 2;
BarCenterY = (position_y + (position_y + BarPixelLength)) /2;
BarCenter = [BarCenterX, BarCenterY];
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment