User interaction Brightness/Contrast
Posted by SarahV on Jun 07, 2017; 4:16pm
URL: http://imagej.273.s1.nabble.com/User-interaction-Brightness-Contrast-tp5018858.html
Hello everyone,
I barely have any programming experience but would like to do the following:
- scale all images in a certain directory, set scale and add scalebar, apply green LUT
- adjust brightness/contrast by hand to make it visible
- save each image both as tiff and as png with the suffixes 'beab' and 'beabpng' added to them, respectively.
This is what I have so far (see below), the scaling and LUT and saving works but ImageJ does not display the images in a window, therefore I am not able to see what I am doing before I click ok.
I am aware that I probably should add lines to display the images in a window and select a window, but no idea how or if it's even possible without splitting the thing in 2 macros.
Best greetings
Sarah
macro "greenscalethensave" {LocationOfFiles = getDirectory("Select Folder");
LocationOfSave = getDirectory("Select Save Location");
setBatchMode(true);
FileList = getFileList(LocationOfFiles);
NumberOfFiles = FileList.length;
for (i=0; i<NumberOfFiles; i+=1) {
FileName = FileList[i];
open(LocationOfFiles+FileName);
name = getTitle();
run("Green");
run("Set Scale...", "distance=1 known=0.10 unit=um");
run("Scale Bar...", "width=10 height=12 font=42 color=White background=None location=[Lower Right] bold overlay");
run("Brightness/Contrast...");
waitForUser("Do something, then click OK");
SaveName1 = replace(name, ".tif", " beab.tiff");
SaveName2 = replace(name, ".tif", " beab.png");
saveAs("TIFF", LocationOfSave+SaveName1);
saveAs("PNG", LocationOfSave+SaveName2);
}
}
}