How to mask a section of image

I am mirroring and comparing the difference of two images like this (Image > Transform > Mirror):
g 4
and the mirrored image is:
khar
and I compare these two images ( Process > Image Calculator and compare the ‘difference’ of the two images):
khar2
There is a vertical black line in this image. and I want to mask the half of this shape using this line so I would have semicircle.
How should I do that?

Hi @Zeynab_Mousavi
20191218_Mask a section of image

Can such a result be suitable?

1 Like

Just to help
Please, mark this post as a solution

// Macro "20191218_Find line of symmetry"
//clear the environment
print("\\Clear");
roiManager("reset") ;
run("Duplicate...", "title=1");
run("Duplicate...", "title=2");
run("Duplicate...", "title=3");
run("RGB to CMYK");
selectWindow("CMYK_3");
run("Stack to Images");
selectWindow("K");
close("Y");close("M"); close("C");
setAutoThreshold("Default");
//run("Threshold...");
setOption("BlackBackground", true);
run("Convert to Mask");
run("Set Measurements...", "add redirect=None decimal=3");
run("Analyze Particles...", "display add");
roiManager("Select", newArray(0,1,26,27));
wait(100);
run("Clear Results");
run("Set Measurements...", "center add redirect=None decimal=0");
roiManager("Measure");
X1=(getResult("XM",0) +getResult("XM",1))/2;
print(X1);
X2=(getResult("XM",2) +getResult("XM",3))/2;
print(X1);
Y1=0;
Y2=getHeight();
print(Y2);
selectWindow("1");
roiManager("reset") ;
makeRectangle(0, 0, X1,Y2);
setBackgroundColor(255, 255, 255);
//setBackgroundColor(0, 0, 0);
run("Clear", "slice");
// close others
close("\\Others");
close("ROI Manager");
if (isOpen("Results")) {
selectWindow("Results");
run("Close");
}
if (isOpen("Log")) {
selectWindow("Log");
run("Close");
}
1 Like