|
I am attempting to program a macro that will run orientation analysis on its own. I can manually do this (which is extremely long and tedious). It is time to automate the process and increase production.
I have a list of ROIs (all to be named on specimen location from user) my current code is:
for(i=1;i<=roiManager("count");i++) {
roiManager("Select",i-1);
SpecimenNumber= 5;
Dialog.create("Settings");
Dialog.addNumber("What is specimen number", SpecimenNumber);
Dialog.show();
SpecimenNumber= Dialog.getNumber();
roiManager("Rename",SpecimenNumber);
run("Copy");
run("Internal Clipboard");
run("Set Scale...", "distance=2540 known=25400 unit=micron");
run("32-bit");
run("Gaussian Blur...", "sigma=20 scaled");
run("Bandpass Filter...", "filter_large=3 filter_small=1 suppress=None tolerance=10 autoscale saturate");
run("OrientationJ Distribution");
run("OrientationJ Distribution", "log=0.0 tensor=3.0 gradient=1 min-coherency=0.0 min-energy=0.0 harris-index=on color-survey=on s-distribution=on hue=Orientation sat=Coherency bri=Original-Image ");
selectWindow("S-Distribution-1");
run("Save...");
close();
selectWindow("ROIManager");
}
My major drawback is at the end:
selectWindow("S-Distribution-1");
run("Save...");
close();
selectWindow("ROIManager");
The macro cannot recognize "save" from the distribution output window. The program will not continue through ROI list.
Ultimately, I want the program to loop through the whole set of ROIs. All I edit is the specimen number and the orientation distribution is saved as the specimen number to a certain folder.
Because my file is so big (running gaussian and bandpass filters on full image will crash my computer), I run internal clip board on specific ROI then run filters and each time orientation is run about 4 windows pop up. This creates two problems 1. tons of windows populate my screen 2. selecting ROI manager is not recognized and results in loop continuing on newest image (which I want loop to run on original image and ROIs).
I am new to image analysis and writing macro's so any help will be greatly appreciated!
|