Posted by
Michael Schmid on
Dec 29, 2018; 7:16pm
URL: http://imagej.273.s1.nabble.com/macro-tp5021594p5021596.html
Hi Martin,
maybe a few answers, but not all of this can be done...
> The position of the image canvas should be put in the outermost top
> left corner with the full covering of the screen.
Try this:
run("Maximize");
setLocation(0,0);
> The points from the grid are too small, they should be somewhat bigger
> and also the line some thicker.
Sorry, currently the size of the grid points in Analyze>Tools>Grid
cannot be changed. YOu can try crosses instead of points; for grayscale
images I also think that cyan or yellow are more obvious colors than
red.
> I cannot find any macro code except the close command to close a
> window after the measurements are done, with this code all the images
> are done one after another without possible to measure.
I guess that what you miss is the WaitForUser command, which lets the
user do whatever he/she should do, before doing the measurement. E.g.
waitForUser("Your Action Required", "Select all pink elephants.\nThen
press OK");
Then do the measurement and close the image.
If you only want to know the number of points, not their coordinates:
Instead of "Measure", use the macro equivalent to alt-Y (Selection
properties):
setKeyDown("alt");
run("Properties... ");
At the very end, you might want this to save the results:
saveAs("results", dir+"nameOfMyResultsFile.txt");
Setting "Display Label" in Set Measurements will allow you to determine
which image the coordinates of the points correspond to.
Michael
________________________________________________________________
On 2018-12-29 14:43, Braekevelt Martin wrote:
> Dear all,
>
> I am novice in programming so excuse me if what i tried to program
> looks stupid.
> I am trying to make a macro for measuring a set of images one by one
> and after each measuring each image close it, so the macro should open
> the first image from the directory, execute the image adjustment, set
> it as big as possible on the screen, set it to 50% zoom, apply a grid
> and then let the operator do a hit count, save the count score, close
> the image and then opens the next image. This sequence should be done
> till all images from the directory are done, ...
>
> I have some issues with the following :
>
> The position of the image canvas should be put in the outermost top
> left corner with the full covering of the screen.
> The points from the grid are too small, they should be somewhat bigger
> and also the line some thicker.
> I cannot find any macro code except the close command to close a
> window after the measurements are done, with this code all the images
> are done one after another without possible to measure.
>
> w = 4096;
> h = 2160
> dir = getDirectory("Choose Source Directory ");
> list = getFileList(dir);
> for (i=0; i<list.length; i++) {
> showProgress(i+1, list.length);
> open(dir+list[i]);
> run("Canvas Size...", "width=&w height=&h position=Center zero");
> run("Unsharp Mask...", "radius=1 mask=0.60");
> run("Grid...", "grid=Points area=85700 color=yellow
> bold center");
> run("Set... ", "zoom=50");
> //setTool("multipoint");
> run("Point Tool...", "type=Dot color=Red size=[Extra Large] label
> show counter=0");
> run("Measure");
> //close();
> }
>
>
> Thanks for the help in advance,
>
> Kindest regards,
>
> Martin.
> ::DISCLAIMER:: This e-mail is confidential and intended for use by the
> addressee only. If you are not the intended recipient, please notify
> us immediately and delete this e-mail, as well as any attachment.
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html