clicking the tool icon. So it is an "Action Tool", and you need to use
this keyword in the macro name.
whole thing into the StartupMacros.txt.
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
run("Set... ", "zoom=50");
> Dear Michael,
>
> Thanks a lot now it is working perfectly.
> Can you or anyone else on the forum help me to get this macro in the startupmacro.
> I have made an icon to start the macro, the code you can find below :
> macro "myTool Tool -
>>> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D
>>> 8
>>> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD
>>> 2
>>> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD6
>>> 3
>>> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0
>>> D
>>> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3D
>>> d
>>> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D
>>> 3
>>> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eD
>>> a
>>> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29
>>> D
>>> 33D4fD57D70D8aD9bDa9Dc3"{
>>>
>>> }
>>>
>>> Thank you very much in advance.
>>> Kindest regards,
>>> Martin
>
>
> -----Original Message-----
> From: ImageJ Interest Group <
[hidden email]> On Behalf Of Michael Schmid
> Sent: Monday, January 7, 2019 4:28 PM
> To:
[hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> *first* you need waitForUser (so the user can select the points),
> *thereafter* these lines to analyze the selection that the user has made:
>
> getSelectionCoordinates(xpoints, ypoints);
> count = xpoints.length;
> row = nResults;
> setResult("Label", row, getTitle());
> setResult("Count", row, count);
>
> In case there might be zero points selected by the user, you have to modify the code:
>
> if (selectionType() == -1) { // no selection
> count = 0;
> } else {
> getSelectionCoordinates(xpoints, ypoints);
> count = xpoints.length;
> }
> row = nResults;
> setResult("Label", row, getTitle());
> setResult("Count", row, count);
>
>
>
> Michael
> ________________________________________________________________
> On 07.01.19 15:33, Braekevelt Martin wrote:
>> Dear Michael,
>>
>> Thank you very much but i still get an error with the
>> getSelectionCoordinates, I think the macro runs thru, without the possibility to use the count tool, I guess that is why the error message is "selection required in line 17"
>>
>> 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("Maximize");
>> setLocation(0,0);
>> run("Unsharp Mask...", "radius=1 mask=0.60");
>> run("Grid...", "grid=Crosses area=85700 color=green bold center");
>> run("Set... ", "zoom=50");
>> setTool("multipoint");
>> run("Point Tool...", "type=Dot color=Red size=[Extra Large] label show counter=0");
>> getSelectionCoordinates(xpoints, ypoints);
>> count = xpoints.length;
>> row = nResults;
>> setResult("Label", row, getTitle());
>> setResult("Count", row, count);
>> waitForUser("Your Action Required", "Double click when center point of cross is inside,\n one click when on border or when have doubt.\n Then press OK");
>> close();
>> }
>>
>> saveAs("Results", "C:/Users/Martin.Braekevelt/Desktop/Results.xls");
>>
>> Would it also be possible to help me getting this macro in the startupmacro's with the icon I created mentioned in the first mailing?
>>
>> Thanks in advance,
>> Kindest regards,
>>
>> Martin.
>>
>> -----Original Message-----
>> From: ImageJ Interest Group <
[hidden email]> On Behalf Of Michael
>> Schmid
>> Sent: Monday, January 7, 2019 2:59 PM
>> To:
[hidden email]
>> Subject: Re: macro problem
>>
>> Hi Martin,
>>
>> you don't need the run("Measure") command, and anyhow you would have to measure after the user has selected the points (after the waitForUser statement).
>>
>> The following five lines
>> getSelectionCoordinates(xpoints, ypoints);
>> count = xpoints.length;
>> row = nResults;
>> setResult("Label", row, getTitle());
>> setResult("Count", row, count);
>> should go into the loop, after the "wait for user".
>> The code in this lines writes the name of the image and the number of points selected by the user to the Results table.
>>
>> By the way, there is a semicolon missing at the end of line 2, "h = 2160".
>>
>> Michael
>> ________________________________________________________________
>> On 06.01.19 11:16, Braekevelt Martin wrote:
>>> Dear all,
>>>
>>> I am struggling with this macro, to just open images one by one, closing them after a point count and get the results in exell format from the count results from each image.
>>> I included thee macro code with some adjustments from Michael, but some things are not working :
>>> I don't get the counts/image and the results file doesn't get saved on my desktop.
>>>
>>> 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("Set Measurements...", "display redirect=None decimal=0");
>>> run("Canvas Size...", "width=&w height=&h position=Center zero");
>>> run("Maximize");
>>> setLocation(0,0);
>>> run("Unsharp Mask...", "radius=1 mask=0.60");
>>> run("Grid...", "grid=Crosses area=85700 color=green bold center");
>>> run("Set... ", "zoom=50");
>>> setTool("multipoint");
>>> run("Point Tool...", "type=Dot color=Red size=[Extra Large] label show counter=0");
>>> run("Measure");
>>> waitForUser("Your Action Required", "Double click when point is inside,\n one click when on border or on doubt.\nThen press OK");
>>> close();
>>> }
>>> getSelectionCoordinates(xpoints, ypoints);
>>> count = xpoints.length;
>>> row = nResults;
>>> setResult("Label", row, getTitle());
>>> setResult("Count", row, count);
>>> saveAs("Results", "C:/Users/Martin.Braekevelt/Desktop/Results.xls");
>>>
>>> I would appreciate it very much if someone could help me to get this macro working.
>>> I also made an icon to get it into the ImageJ GUI, I would also like some help for that.
>>> This is the code below
>>> macro "myTool Tool -
>>> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D
>>> 8
>>> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD
>>> 2
>>> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD6
>>> 3
>>> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0
>>> D
>>> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3D
>>> d
>>> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D
>>> 3
>>> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eD
>>> a
>>> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29
>>> D
>>> 33D4fD57D70D8aD9bDa9Dc3"{
>>>
>>> }
>>>
>>> Thank you very much in advance.
>>> Kindest regards,
>>> Martin
>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>