From 2a9e8ac297b91da6994d913fb4f99152f7eee2d0 Mon Sep 17 00:00:00 2001 From: Sandro Pereira <sandro.pereira@uni.lu> Date: Fri, 5 Jul 2024 15:16:37 +0200 Subject: [PATCH] Upload f_barMask_V2 --- Figure2/palm-astrocytes/f_barMask_V2.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Figure2/palm-astrocytes/f_barMask_V2.m diff --git a/Figure2/palm-astrocytes/f_barMask_V2.m b/Figure2/palm-astrocytes/f_barMask_V2.m new file mode 100644 index 0000000..4c8418d --- /dev/null +++ b/Figure2/palm-astrocytes/f_barMask_V2.m @@ -0,0 +1,23 @@ +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 + -- GitLab