macro problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

macro problem

Braekevelt Martin
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 - C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

}

Thank you very much 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
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Michael Schmid
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 - C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>
> }
>
> Thank you very much in advance.
> Kindest regards,
> Martin

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
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 -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D8
> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD2
> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63
> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0D
> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd
> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D3
> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa
> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D
> 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
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Michael Schmid
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 -
>> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D8
>> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD2
>> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63
>> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0D
>> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd
>> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D3
>> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa
>> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
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
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Michael Schmid
Hi Martin,

This is not a macro tool that has to be executed when the user clicks
somewhere on the image (as, e.g., the drawing tools) but simply by
clicking the tool icon. So it is an "Action Tool", and you need to use
this keyword in the macro name.

Then just put the macro code between the curly braces and paste the
whole thing into the StartupMacros.txt.


macro "myTool Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
    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");
       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");
       if (selectionType() == -1) { // no selection
          count = 0;
       } else {
          getSelectionCoordinates(xpoints, ypoints);
          count = xpoints.length;
       }
       row = nResults;
       setResult("Label", row, getTitle());
       setResult("Count", row, count);
      close();
    }
    path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
    saveAs("Results", path);
}


Now it is time for you to learn a bit more on macro programming!
   https://imagej.nih.gov/ij/docs/guide/146-14.html
   https://imagej.nih.gov/ij/developer/macro/macros.html
   https://imagej.nih.gov/ij/developer/macro/functions.html


Michael
________________________________________________________________
On 07.01.19 16:52, Braekevelt Martin wrote:

> 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
Dear Michael,

I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?

Last obstacle I think ?

Kindest regards,
Martin

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Monday, January 7, 2019 5:11 PM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.

Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.


macro "myTool Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
    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");
       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");
       if (selectionType() == -1) { // no selection
          count = 0;
       } else {
          getSelectionCoordinates(xpoints, ypoints);
          count = xpoints.length;
       }
       row = nResults;
       setResult("Label", row, getTitle());
       setResult("Count", row, count);
      close();
    }
    path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
    saveAs("Results", path);
}


Now it is time for you to learn a bit more on macro programming!
   https://imagej.nih.gov/ij/docs/guide/146-14.html
   https://imagej.nih.gov/ij/developer/macro/macros.html
   https://imagej.nih.gov/ij/developer/macro/functions.html


Michael
________________________________________________________________
On 07.01.19 16:52, Braekevelt Martin wrote:

> 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
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Michael Schmid
Hi Martin,

sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses
other files for startup. With plain ImageJ, it works when I put it into
my StartupMacros.txt. You might do some other changes in your
StartupMacros.txt and see whether Fiji does these changes, otherwise it
reads a different file.
You might have a look, e.g., whether "StartupMacros.ijm" or
"StartupMacros.fiji.ijm" exist (and are in use), instead of
"StartupMacros.txt".

Also make sure that you have no additional line breaks introduced by the
mailer, e.g. the first line should include the long string with the code
for the icon (a Strings constant must be given in one line).


Michael
________________________________________________________________
On 08.01.19 09:03, Braekevelt Martin wrote:

> Dear Michael,
>
> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>
> Last obstacle I think ?
>
> Kindest regards,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
> Sent: Monday, January 7, 2019 5:11 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>
> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>
>
> macro "myTool Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

>      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");
>         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");
>         if (selectionType() == -1) { // no selection
>            count = 0;
>         } else {
>            getSelectionCoordinates(xpoints, ypoints);
>            count = xpoints.length;
>         }
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>
>
> Now it is time for you to learn a bit more on macro programming!
>     https://imagej.nih.gov/ij/docs/guide/146-14.html
>     https://imagej.nih.gov/ij/developer/macro/macros.html
>     https://imagej.nih.gov/ij/developer/macro/functions.html
>
>
> Michael

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Rainer M. Engel
In reply to this post by Braekevelt Martin
Hey Micheal,

on Fiji there should be an "AutoRun" sub-folder to the
"macros"-directory. If you put in an *.ijm-file there it will be
executed at startup.
Otherwise, like Martin mentioned, use the "StartupMacros.fiji.ijm".

Regards,
Rainer


Am 08.01.2019 um 09:03 schrieb Braekevelt Martin:

> Dear Michael,
>
> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>
> Last obstacle I think ?
>
> Kindest regards,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
> Sent: Monday, January 7, 2019 5:11 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>
> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>
>
> macro "myTool Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>     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");
>        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");
>        if (selectionType() == -1) { // no selection
>           count = 0;
>        } else {
>           getSelectionCoordinates(xpoints, ypoints);
>           count = xpoints.length;
>        }
>        row = nResults;
>        setResult("Label", row, getTitle());
>        setResult("Count", row, count);
>       close();
>     }
>     path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>     saveAs("Results", path);
> }
>
>
> Now it is time for you to learn a bit more on macro programming!
>    https://imagej.nih.gov/ij/docs/guide/146-14.html
>    https://imagej.nih.gov/ij/developer/macro/macros.html
>    https://imagej.nih.gov/ij/developer/macro/functions.html
>
>
> Michael
> ________________________________________________________________
> On 07.01.19 16:52, Braekevelt Martin wrote:
>> 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
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>


--
Rainer M. Engel, Dipl. Digital Artist

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
In reply to this post by Michael Schmid
Sorry to bother you again,

I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.

I included the new StartupMacros.txt file.
The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
All I get is a blank icon.
The name I change is correct however  (Volume fraction)
When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
Can you please check what is wrong with the icon and why the macro is not running ?
Thanks in advance,
Martin

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Tuesday, January 8, 2019 10:23 AM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".

Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).


Michael
________________________________________________________________
On 08.01.19 09:03, Braekevelt Martin wrote:

> Dear Michael,
>
> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>
> Last obstacle I think ?
>
> Kindest regards,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
> Schmid
> Sent: Monday, January 7, 2019 5:11 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>
> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>
>
> macro "myTool Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

>      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");
>         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");
>         if (selectionType() == -1) { // no selection
>            count = 0;
>         } else {
>            getSelectionCoordinates(xpoints, ypoints);
>            count = xpoints.length;
>         }
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>
>
> Now it is time for you to learn a bit more on macro programming!
>     https://imagej.nih.gov/ij/docs/guide/146-14.html
>     https://imagej.nih.gov/ij/developer/macro/macros.html
>     https://imagej.nih.gov/ij/developer/macro/functions.html
>
>
> Michael
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

icon.tif (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
Sorry forget the StartupMacros.txt file

// "StartupMacros"
// The macros and tools in this file ("StartupMacros.txt") are
// automatically installed in the Plugins>Macros submenu and
// in the toolbar when ImageJ starts up.

// The "AutoRun" macro has been replaced by the Edit>Options>Startup command.

  macro "Command Finder Built-in Tool" {}
  macro "Developer Menu Built-in Tool" {}
  macro "Brush Built-in Tool" {}
  macro "Flood Filler Built-in Tool" {}
  macro "Arrow Built-in Tool" {}

  var pmCmds = newMenu("Popup Menu",
       newArray("Help...", "Rename...", "Duplicate...", "Original Scale",
       "Paste Control...", "-", "Record...", "Capture Screen ", "Monitor Memory...",
       "List Commands...", "Control Panel...", "Startup Macros...", "Search..."));

  macro "Popup Menu" {
      cmd = getArgument();
      if (cmd=="Help...")
           showMessage("About Popup Menu",
               "To customize this menu, edit the line that starts with\n\"var pmCmds\" in ImageJ/macros/StartupMacros.txt.");
      else
          run(cmd);
  }

 macro "-" {} //menu divider

 macro "Volume fraction Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
    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");
       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");
       if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}
       row = nResults;
       setResult("Label", row, getTitle());
       setResult("Count", row, count);
      close();
    }
    path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
    saveAs("Results", path);
}
 macro "About Startup Macros..." {
      path = getDirectory("macros")+"About Startup Macros";
      if (!File.exists(path))
          exit("\"About Startup Macros\" not found in ImageJ/macros/.");
      open(path);
  }

  // This example macro demonstrates how to create a
  // custom command with a keyboard shortcut.
  macro "Save As JPEG... [j]" {
     quality = call("ij.plugin.JpegWriter.getQuality");
     quality = getNumber("JPEG quality (0-100):", quality);
     run("Input/Output...", "jpeg="+quality);
     saveAs("Jpeg");
  }





-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Braekevelt Martin
Sent: Tuesday, January 8, 2019 12:19 PM
To: [hidden email]
Subject: Re: macro problem

This message was sent from outside Bekaert with a Bekaert email address. It has been marked as potential email spoofing. Please do not click links or open attachments unless you recognize the source of this email and know the content is safe.

Sorry to bother you again,

I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.

I included the new StartupMacros.txt file.
The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
All I get is a blank icon.
The name I change is correct however  (Volume fraction) When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
Can you please check what is wrong with the icon and why the macro is not running ?
Thanks in advance,
Martin

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Tuesday, January 8, 2019 10:23 AM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".

Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).


Michael
________________________________________________________________
On 08.01.19 09:03, Braekevelt Martin wrote:

> Dear Michael,
>
> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>
> Last obstacle I think ?
>
> Kindest regards,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
> Schmid
> Sent: Monday, January 7, 2019 5:11 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>
> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>
>
> macro "myTool Action Tool -
C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

>      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");
>         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");
>         if (selectionType() == -1) { // no selection
>            count = 0;
>         } else {
>            getSelectionCoordinates(xpoints, ypoints);
>            count = xpoints.length;
>         }
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>
>
> Now it is time for you to learn a bit more on macro programming!
>     https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdocs%2Fguide%2F146-14.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=zqrZg0mfDkJEszNBhfdqzj1se1gciY4oC22dcQ9I7Jk%3D&amp;reserved=0
>     https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Fmacros.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=eW1A5CSbrh3tAhjC0sp02jH51QQO0eVsU2Y4XaQUGiY%3D&amp;reserved=0
>    
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fima
> gej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html&amp;data=01%7C01
> %7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%
> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=SPRv1HSqaQi4bfRFveq1e
> 3IyurJuWTmvC7sfrrCCMtc%3D&amp;reserved=0
>
>
> Michael
--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=3z2b4CA6uTOaRYYA6tb8%2BrDbzWxsa64LRjOdq0%2FAN14%3D&amp;reserved=0

--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=3z2b4CA6uTOaRYYA6tb8%2BrDbzWxsa64LRjOdq0%2FAN14%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

icon.tif (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Michael Schmid
Hi Martin,

strange, I get a colorful icon with the macro from your StartupMacros.
It seems  that you have used the macro
   https://imagej.nih.gov/ij/macros/tools/Image_To_Tool_Icon.txt
and selected the first red color as transparent, so some red pixels of
your icon.tif file were missing in the icon. If I convert your icon.tif
image without transparency, I get an even longer String:


macro "Volume fraction Action Tool -
Cf00D00D05D06D09D0aD1bD1fD22D24D2aD2eD2fD37D3cD3dD42D43D46D49D4eD55D59D5aD5cD5eD5fD61D62D68D72D75D7fD80D83D84D86D88D8cD8eD8fD90D92D98D9cD9fDa1Da2Da3DabDb8Db9DbbDc6Dc7Dc8DcbDccDd8DdaDdbDdeDe2De3De9DebDf1Df3Df5Df7Df9DfeC3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

Note that all of this must be in one line.

Michael
________________________________________________________________
On 08.01.19 12:31, Braekevelt Martin wrote:

> Sorry forget the StartupMacros.txt file
>
> // "StartupMacros"
> // The macros and tools in this file ("StartupMacros.txt") are
> // automatically installed in the Plugins>Macros submenu and
> // in the toolbar when ImageJ starts up.
>
> // The "AutoRun" macro has been replaced by the Edit>Options>Startup command.
>
>    macro "Command Finder Built-in Tool" {}
>    macro "Developer Menu Built-in Tool" {}
>    macro "Brush Built-in Tool" {}
>    macro "Flood Filler Built-in Tool" {}
>    macro "Arrow Built-in Tool" {}
>
>    var pmCmds = newMenu("Popup Menu",
>         newArray("Help...", "Rename...", "Duplicate...", "Original Scale",
>         "Paste Control...", "-", "Record...", "Capture Screen ", "Monitor Memory...",
>         "List Commands...", "Control Panel...", "Startup Macros...", "Search..."));
>
>    macro "Popup Menu" {
>        cmd = getArgument();
>        if (cmd=="Help...")
>             showMessage("About Popup Menu",
>                 "To customize this menu, edit the line that starts with\n\"var pmCmds\" in ImageJ/macros/StartupMacros.txt.");
>        else
>            run(cmd);
>    }
>
>   macro "-" {} //menu divider
>
>   macro "Volume fraction Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>      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");
>         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");
>         if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>   macro "About Startup Macros..." {
>        path = getDirectory("macros")+"About Startup Macros";
>        if (!File.exists(path))
>            exit("\"About Startup Macros\" not found in ImageJ/macros/.");
>        open(path);
>    }
>
>    // This example macro demonstrates how to create a
>    // custom command with a keyboard shortcut.
>    macro "Save As JPEG... [j]" {
>       quality = call("ij.plugin.JpegWriter.getQuality");
>       quality = getNumber("JPEG quality (0-100):", quality);
>       run("Input/Output...", "jpeg="+quality);
>       saveAs("Jpeg");
>    }
>
>
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Braekevelt Martin
> Sent: Tuesday, January 8, 2019 12:19 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> This message was sent from outside Bekaert with a Bekaert email address. It has been marked as potential email spoofing. Please do not click links or open attachments unless you recognize the source of this email and know the content is safe.
>
> Sorry to bother you again,
>
> I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.
>
> I included the new StartupMacros.txt file.
> The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
> All I get is a blank icon.
> The name I change is correct however  (Volume fraction) When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
> Can you please check what is wrong with the icon and why the macro is not running ?
> Thanks in advance,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
> Sent: Tuesday, January 8, 2019 10:23 AM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
> You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".
>
> Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).
>
>
> Michael
> ________________________________________________________________
> On 08.01.19 09:03, Braekevelt Martin wrote:
>> Dear Michael,
>>
>> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>>
>> Last obstacle I think ?
>>
>> Kindest regards,
>> Martin
>>
>> -----Original Message-----
>> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
>> Schmid
>> Sent: Monday, January 7, 2019 5:11 PM
>> To: [hidden email]
>> Subject: Re: macro problem
>>
>> Hi Martin,
>>
>> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>>
>> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>>
>>
>> macro "myTool Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>>       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");
>>          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");
>>          if (selectionType() == -1) { // no selection
>>             count = 0;
>>          } else {
>>             getSelectionCoordinates(xpoints, ypoints);
>>             count = xpoints.length;
>>          }
>>          row = nResults;
>>          setResult("Label", row, getTitle());
>>          setResult("Count", row, count);
>>         close();
>>       }
>>       path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>>       saveAs("Results", path);
>> }
>>
>>
>> Now it is time for you to learn a bit more on macro programming!
>>      https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdocs%2Fguide%2F146-14.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=zqrZg0mfDkJEszNBhfdqzj1se1gciY4oC22dcQ9I7Jk%3D&amp;reserved=0
>>      https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Fmacros.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=eW1A5CSbrh3tAhjC0sp02jH51QQO0eVsU2Y4XaQUGiY%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fima
>> gej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html&amp;data=01%7C01
>> %7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=SPRv1HSqaQi4bfRFveq1e
>> 3IyurJuWTmvC7sfrrCCMtc%3D&amp;reserved=0
>>
>>
>> Michael
>
> --
> ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=3z2b4CA6uTOaRYYA6tb8%2BrDbzWxsa64LRjOdq0%2FAN14%3D&amp;reserved=0
>
> --
> ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=3z2b4CA6uTOaRYYA6tb8%2BrDbzWxsa64LRjOdq0%2FAN14%3D&amp;reserved=0
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
Dear Michael,

Thank you very much !
this icon is exactly what i wanted, so now the startup is perfect.
I have seen you have changed something in the code also, but this gives an error while running the macro :

Undefined variable in line 51: setResult ( "Count" , row , <count> ) ;

Kindest regards,
Martin.


-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Tuesday, January 8, 2019 6:25 PM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

strange, I get a colorful icon with the macro from your StartupMacros.
It seems  that you have used the macro
   https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fmacros%2Ftools%2FImage_To_Tool_Icon.txt&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=6v3xnDpOQDEmeKlUNnJRC3ygZzXjaUAAAFYQp5azgYA%3D&amp;reserved=0
and selected the first red color as transparent, so some red pixels of your icon.tif file were missing in the icon. If I convert your icon.tif image without transparency, I get an even longer String:


macro "Volume fraction Action Tool -
Cf00D00D05D06D09D0aD1bD1fD22D24D2aD2eD2fD37D3cD3dD42D43D46D49D4eD55D59D5aD5cD5eD5fD61D62D68D72D75D7fD80D83D84D86D88D8cD8eD8fD90D92D98D9cD9fDa1Da2Da3DabDb8Db9DbbDc6Dc7Dc8DcbDccDd8DdaDdbDdeDe2De3De9DebDf1Df3Df5Df7Df9DfeC3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

Note that all of this must be in one line.

Michael
________________________________________________________________
On 08.01.19 12:31, Braekevelt Martin wrote:

> Sorry forget the StartupMacros.txt file
>
> // "StartupMacros"
> // The macros and tools in this file ("StartupMacros.txt") are //
> automatically installed in the Plugins>Macros submenu and // in the
> toolbar when ImageJ starts up.
>
> // The "AutoRun" macro has been replaced by the Edit>Options>Startup command.
>
>    macro "Command Finder Built-in Tool" {}
>    macro "Developer Menu Built-in Tool" {}
>    macro "Brush Built-in Tool" {}
>    macro "Flood Filler Built-in Tool" {}
>    macro "Arrow Built-in Tool" {}
>
>    var pmCmds = newMenu("Popup Menu",
>         newArray("Help...", "Rename...", "Duplicate...", "Original Scale",
>         "Paste Control...", "-", "Record...", "Capture Screen ", "Monitor Memory...",
>         "List Commands...", "Control Panel...", "Startup Macros...",
> "Search..."));
>
>    macro "Popup Menu" {
>        cmd = getArgument();
>        if (cmd=="Help...")
>             showMessage("About Popup Menu",
>                 "To customize this menu, edit the line that starts with\n\"var pmCmds\" in ImageJ/macros/StartupMacros.txt.");
>        else
>            run(cmd);
>    }
>
>   macro "-" {} //menu divider
>
>   macro "Volume fraction Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>      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");
>         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");
>         if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>   macro "About Startup Macros..." {
>        path = getDirectory("macros")+"About Startup Macros";
>        if (!File.exists(path))
>            exit("\"About Startup Macros\" not found in ImageJ/macros/.");
>        open(path);
>    }
>
>    // This example macro demonstrates how to create a
>    // custom command with a keyboard shortcut.
>    macro "Save As JPEG... [j]" {
>       quality = call("ij.plugin.JpegWriter.getQuality");
>       quality = getNumber("JPEG quality (0-100):", quality);
>       run("Input/Output...", "jpeg="+quality);
>       saveAs("Jpeg");
>    }
>
>
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of
> Braekevelt Martin
> Sent: Tuesday, January 8, 2019 12:19 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> This message was sent from outside Bekaert with a Bekaert email address. It has been marked as potential email spoofing. Please do not click links or open attachments unless you recognize the source of this email and know the content is safe.
>
> Sorry to bother you again,
>
> I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.
>
> I included the new StartupMacros.txt file.
> The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
> All I get is a blank icon.
> The name I change is correct however  (Volume fraction) When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
> Can you please check what is wrong with the icon and why the macro is not running ?
> Thanks in advance,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
> Schmid
> Sent: Tuesday, January 8, 2019 10:23 AM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
> You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".
>
> Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).
>
>
> Michael
> ________________________________________________________________
> On 08.01.19 09:03, Braekevelt Martin wrote:
>> Dear Michael,
>>
>> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>>
>> Last obstacle I think ?
>>
>> Kindest regards,
>> Martin
>>
>> -----Original Message-----
>> From: ImageJ Interest Group <[hidden email]> On Behalf Of
>> Michael Schmid
>> Sent: Monday, January 7, 2019 5:11 PM
>> To: [hidden email]
>> Subject: Re: macro problem
>>
>> Hi Martin,
>>
>> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>>
>> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>>
>>
>> macro "myTool Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D8
> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD2
> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63
> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0D
> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd
> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D3
> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa
> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D
> 33D4fD57D70D8aD9bDa9Dc3"{
>>       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");
>>          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");
>>          if (selectionType() == -1) { // no selection
>>             count = 0;
>>          } else {
>>             getSelectionCoordinates(xpoints, ypoints);
>>             count = xpoints.length;
>>          }
>>          row = nResults;
>>          setResult("Label", row, getTitle());
>>          setResult("Count", row, count);
>>         close();
>>       }
>>       path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>>       saveAs("Results", path);
>> }
>>
>>
>> Now it is time for you to learn a bit more on macro programming!
>>      https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fdocs%2Fguide%2F146-14.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=KZFfXQtmddEgANPszgfYY5BH1xM9j%2FAKdtQ1t5%2FuW40%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> agej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Fmacros.html&amp;data=01%7C01%
>> 7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=C0Bt8e1%2BDkphlsL0e%
>> 2FfLqgP8X5CDGgRPJ5aSOSpyqkE%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> a
>> gej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html&amp;data=01%7C0
>> 1
>> %7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9
>> %
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=SPRv1HSqaQi4bfRFveq1
>> e
>> 3IyurJuWTmvC7sfrrCCMtc%3D&amp;reserved=0
>>
>>
>> Michael
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>

--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Cardone, Giovanni
My guess is that  you need to spread this line

if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}

over multiples ones, i.e.

if (selectionType() == -1) {
    // no selection
    count = 0;
} else {
    getSelectionCoordinates(xpoints, ypoints);
    count = xpoints.length;
}

Giovanni

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Braekevelt Martin
Sent: Mittwoch, 9. Januar 2019 10:20
To: [hidden email]
Subject: Re: macro problem

Dear Michael,

Thank you very much !
this icon is exactly what i wanted, so now the startup is perfect.
I have seen you have changed something in the code also, but this gives an error while running the macro :

Undefined variable in line 51: setResult ( "Count" , row , <count> ) ;

Kindest regards,
Martin.


-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Tuesday, January 8, 2019 6:25 PM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

strange, I get a colorful icon with the macro from your StartupMacros.
It seems  that you have used the macro
   https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fmacros%2Ftools%2FImage_To_Tool_Icon.txt&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=6v3xnDpOQDEmeKlUNnJRC3ygZzXjaUAAAFYQp5azgYA%3D&amp;reserved=0
and selected the first red color as transparent, so some red pixels of your icon.tif file were missing in the icon. If I convert your icon.tif image without transparency, I get an even longer String:


macro "Volume fraction Action Tool -
Cf00D00D05D06D09D0aD1bD1fD22D24D2aD2eD2fD37D3cD3dD42D43D46D49D4eD55D59D5aD5cD5eD5fD61D62D68D72D75D7fD80D83D84D86D88D8cD8eD8fD90D92D98D9cD9fDa1Da2Da3DabDb8Db9DbbDc6Dc7Dc8DcbDccDd8DdaDdbDdeDe2De3De9DebDf1Df3Df5Df7Df9DfeC3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

Note that all of this must be in one line.

Michael
________________________________________________________________
On 08.01.19 12:31, Braekevelt Martin wrote:

> Sorry forget the StartupMacros.txt file
>
> // "StartupMacros"
> // The macros and tools in this file ("StartupMacros.txt") are //
> automatically installed in the Plugins>Macros submenu and // in the
> toolbar when ImageJ starts up.
>
> // The "AutoRun" macro has been replaced by the Edit>Options>Startup command.
>
>    macro "Command Finder Built-in Tool" {}
>    macro "Developer Menu Built-in Tool" {}
>    macro "Brush Built-in Tool" {}
>    macro "Flood Filler Built-in Tool" {}
>    macro "Arrow Built-in Tool" {}
>
>    var pmCmds = newMenu("Popup Menu",
>         newArray("Help...", "Rename...", "Duplicate...", "Original Scale",
>         "Paste Control...", "-", "Record...", "Capture Screen ", "Monitor Memory...",
>         "List Commands...", "Control Panel...", "Startup Macros...",
> "Search..."));
>
>    macro "Popup Menu" {
>        cmd = getArgument();
>        if (cmd=="Help...")
>             showMessage("About Popup Menu",
>                 "To customize this menu, edit the line that starts with\n\"var pmCmds\" in ImageJ/macros/StartupMacros.txt.");
>        else
>            run(cmd);
>    }
>
>   macro "-" {} //menu divider
>
>   macro "Volume fraction Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>      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");
>         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");
>         if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>   macro "About Startup Macros..." {
>        path = getDirectory("macros")+"About Startup Macros";
>        if (!File.exists(path))
>            exit("\"About Startup Macros\" not found in ImageJ/macros/.");
>        open(path);
>    }
>
>    // This example macro demonstrates how to create a
>    // custom command with a keyboard shortcut.
>    macro "Save As JPEG... [j]" {
>       quality = call("ij.plugin.JpegWriter.getQuality");
>       quality = getNumber("JPEG quality (0-100):", quality);
>       run("Input/Output...", "jpeg="+quality);
>       saveAs("Jpeg");
>    }
>
>
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of
> Braekevelt Martin
> Sent: Tuesday, January 8, 2019 12:19 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> This message was sent from outside Bekaert with a Bekaert email address. It has been marked as potential email spoofing. Please do not click links or open attachments unless you recognize the source of this email and know the content is safe.
>
> Sorry to bother you again,
>
> I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.
>
> I included the new StartupMacros.txt file.
> The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
> All I get is a blank icon.
> The name I change is correct however  (Volume fraction) When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
> Can you please check what is wrong with the icon and why the macro is not running ?
> Thanks in advance,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
> Schmid
> Sent: Tuesday, January 8, 2019 10:23 AM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
> You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".
>
> Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).
>
>
> Michael
> ________________________________________________________________
> On 08.01.19 09:03, Braekevelt Martin wrote:
>> Dear Michael,
>>
>> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>>
>> Last obstacle I think ?
>>
>> Kindest regards,
>> Martin
>>
>> -----Original Message-----
>> From: ImageJ Interest Group <[hidden email]> On Behalf Of
>> Michael Schmid
>> Sent: Monday, January 7, 2019 5:11 PM
>> To: [hidden email]
>> Subject: Re: macro problem
>>
>> Hi Martin,
>>
>> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>>
>> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>>
>>
>> macro "myTool Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D8
> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD2
> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63
> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0D
> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd
> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D3
> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa
> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D
> 33D4fD57D70D8aD9bDa9Dc3"{
>>       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");
>>          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");
>>          if (selectionType() == -1) { // no selection
>>             count = 0;
>>          } else {
>>             getSelectionCoordinates(xpoints, ypoints);
>>             count = xpoints.length;
>>          }
>>          row = nResults;
>>          setResult("Label", row, getTitle());
>>          setResult("Count", row, count);
>>         close();
>>       }
>>       path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>>       saveAs("Results", path);
>> }
>>
>>
>> Now it is time for you to learn a bit more on macro programming!
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> agej.nih.gov%2Fij%2Fdocs%2Fguide%2F146-14.html&amp;data=01%7C01%7Cmar
>> tin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e
>> 53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=KZFfXQtmddEgANPszgfYY5BH1
>> xM9j%2FAKdtQ1t5%2FuW40%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> agej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Fmacros.html&amp;data=01%7C01%
>> 7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=C0Bt8e1%2BDkphlsL0e%
>> 2FfLqgP8X5CDGgRPJ5aSOSpyqkE%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> a
>> gej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html&amp;data=01%7C0
>> 1
>> %7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9
>> %
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=SPRv1HSqaQi4bfRFveq1
>> e
>> 3IyurJuWTmvC7sfrrCCMtc%3D&amp;reserved=0
>>
>>
>> Michael
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>

--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: macro problem

Braekevelt Martin
Thanks Giovanni and Michael,

I adjusted as recommended and now the macroo runs fine,
Thanks once again, I learned a lot from it.

Kindest regards,
Martin.

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Cardone, Giovanni
Sent: Wednesday, January 9, 2019 2:44 PM
To: [hidden email]
Subject: Re: macro problem

My guess is that  you need to spread this line

if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}

over multiples ones, i.e.

if (selectionType() == -1) {
    // no selection
    count = 0;
} else {
    getSelectionCoordinates(xpoints, ypoints);
    count = xpoints.length;
}

Giovanni

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Braekevelt Martin
Sent: Mittwoch, 9. Januar 2019 10:20
To: [hidden email]
Subject: Re: macro problem

Dear Michael,

Thank you very much !
this icon is exactly what i wanted, so now the startup is perfect.
I have seen you have changed something in the code also, but this gives an error while running the macro :

Undefined variable in line 51: setResult ( "Count" , row , <count> ) ;

Kindest regards,
Martin.


-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael Schmid
Sent: Tuesday, January 8, 2019 6:25 PM
To: [hidden email]
Subject: Re: macro problem

Hi Martin,

strange, I get a colorful icon with the macro from your StartupMacros.
It seems  that you have used the macro
   https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fimagej.nih.gov%2Fij%2Fmacros%2Ftools%2FImage_To_Tool_Icon.txt&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7Cdfdb5ac593d946f942b508d6763a4919%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=2nDXoQthyR64VRVG6IVMn4Gi%2FPKaxwz8ChfZpbyZe50%3D&amp;reserved=0
and selected the first red color as transparent, so some red pixels of your icon.tif file were missing in the icon. If I convert your icon.tif image without transparency, I get an even longer String:


macro "Volume fraction Action Tool -
Cf00D00D05D06D09D0aD1bD1fD22D24D2aD2eD2fD37D3cD3dD42D43D46D49D4eD55D59D5aD5cD5eD5fD61D62D68D72D75D7fD80D83D84D86D88D8cD8eD8fD90D92D98D9cD9fDa1Da2Da3DabDb8Db9DbbDc6Dc7Dc8DcbDccDd8DdaDdbDdeDe2De3De9DebDf1Df3Df5Df7Df9DfeC3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{

Note that all of this must be in one line.

Michael
________________________________________________________________
On 08.01.19 12:31, Braekevelt Martin wrote:

> Sorry forget the StartupMacros.txt file
>
> // "StartupMacros"
> // The macros and tools in this file ("StartupMacros.txt") are //
> automatically installed in the Plugins>Macros submenu and // in the
> toolbar when ImageJ starts up.
>
> // The "AutoRun" macro has been replaced by the Edit>Options>Startup command.
>
>    macro "Command Finder Built-in Tool" {}
>    macro "Developer Menu Built-in Tool" {}
>    macro "Brush Built-in Tool" {}
>    macro "Flood Filler Built-in Tool" {}
>    macro "Arrow Built-in Tool" {}
>
>    var pmCmds = newMenu("Popup Menu",
>         newArray("Help...", "Rename...", "Duplicate...", "Original Scale",
>         "Paste Control...", "-", "Record...", "Capture Screen ", "Monitor Memory...",
>         "List Commands...", "Control Panel...", "Startup Macros...",
> "Search..."));
>
>    macro "Popup Menu" {
>        cmd = getArgument();
>        if (cmd=="Help...")
>             showMessage("About Popup Menu",
>                 "To customize this menu, edit the line that starts with\n\"var pmCmds\" in ImageJ/macros/StartupMacros.txt.");
>        else
>            run(cmd);
>    }
>
>   macro "-" {} //menu divider
>
>   macro "Volume fraction Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D87D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD21D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0Da8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D38D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D33D4fD57D70D8aD9bDa9Dc3"{
>      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");
>         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");
>         if (selectionType() == -1) { // no selection count = 0;} else {getSelectionCoordinates(xpoints, ypoints); count = xpoints.length;}
>         row = nResults;
>         setResult("Label", row, getTitle());
>         setResult("Count", row, count);
>        close();
>      }
>      path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>      saveAs("Results", path);
> }
>   macro "About Startup Macros..." {
>        path = getDirectory("macros")+"About Startup Macros";
>        if (!File.exists(path))
>            exit("\"About Startup Macros\" not found in ImageJ/macros/.");
>        open(path);
>    }
>
>    // This example macro demonstrates how to create a
>    // custom command with a keyboard shortcut.
>    macro "Save As JPEG... [j]" {
>       quality = call("ij.plugin.JpegWriter.getQuality");
>       quality = getNumber("JPEG quality (0-100):", quality);
>       run("Input/Output...", "jpeg="+quality);
>       saveAs("Jpeg");
>    }
>
>
>
>
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of
> Braekevelt Martin
> Sent: Tuesday, January 8, 2019 12:19 PM
> To: [hidden email]
> Subject: Re: macro problem
>
> This message was sent from outside Bekaert with a Bekaert email address. It has been marked as potential email spoofing. Please do not click links or open attachments unless you recognize the source of this email and know the content is safe.
>
> Sorry to bother you again,
>
> I have downloaded the latest version of ImageJ instead of the Fiji version and copied paste like you have done for me Michael.
>
> I included the new StartupMacros.txt file.
> The position of the icon is where I wanted it, but I don't see the icon I constructed (the very long code), the icon should look like this (see attachment).
> All I get is a blank icon.
> The name I change is correct however  (Volume fraction) When I click on the icon I get an error (it says a { is expected at line 31),when I check the code however I think the correct of open close {} is there,...
> Can you please check what is wrong with the icon and why the macro is not running ?
> Thanks in advance,
> Martin
>
> -----Original Message-----
> From: ImageJ Interest Group <[hidden email]> On Behalf Of Michael
> Schmid
> Sent: Tuesday, January 8, 2019 10:23 AM
> To: [hidden email]
> Subject: Re: macro problem
>
> Hi Martin,
>
> sorry, I have plain ImageJ, not Fiji; I can't say whether Fiji uses other files for startup. With plain ImageJ, it works when I put it into my StartupMacros.txt. You might do some other changes in your StartupMacros.txt and see whether Fiji does these changes, otherwise it reads a different file.
> You might have a look, e.g., whether "StartupMacros.ijm" or "StartupMacros.fiji.ijm" exist (and are in use), instead of "StartupMacros.txt".
>
> Also make sure that you have no additional line breaks introduced by the mailer, e.g. the first line should include the long string with the code for the icon (a Strings constant must be given in one line).
>
>
> Michael
> ________________________________________________________________
> On 08.01.19 09:03, Braekevelt Martin wrote:
>> Dear Michael,
>>
>> I have done as you mentioned, tried 2 times to copy/paste in the macros folder in the StartupMacros.Fiji.ijm file, at 2 different positions in that file, restarted Fiji and even my computer but the macro is not there, neither the icon. Do I need to copy/paste the macro in another location ?
>>
>> Last obstacle I think ?
>>
>> Kindest regards,
>> Martin
>>
>> -----Original Message-----
>> From: ImageJ Interest Group <[hidden email]> On Behalf Of
>> Michael Schmid
>> Sent: Monday, January 7, 2019 5:11 PM
>> To: [hidden email]
>> Subject: Re: macro problem
>>
>> Hi Martin,
>>
>> This is not a macro tool that has to be executed when the user clicks somewhere on the image (as, e.g., the drawing tools) but simply by clicking the tool icon. So it is an "Action Tool", and you need to use this keyword in the macro name.
>>
>> Then just put the macro code between the curly braces and paste the whole thing into the StartupMacros.txt.
>>
>>
>> macro "myTool Action Tool -
> C3f0D34D36D45D94DacDf0C0f0D02D04D11D18D25D26D27D28D30D31D41D64D6dD78D8
> 7D8dDc2Dc9DceDe1DffCff0D01D08D0bD0cD0dD0eD10D12D14D15D16D17D19D1aD1dD2
> 1D23D2bD2cD32D39D3aD3bD3eD3fD44D47D4aD4cD4dD50D51D52D53D54D56D58D5bD63
> D66D67D69D6aD6eD6fD71D73D74D76D79D7cD7eD82D89D91D93D96D97D99D9aD9dDa0D
> a8DadDaeDafDb0Db1Db2Db3Db5Db6DbaDbcDbdDbeDc0Dc1Dc4DcaDcdDd0Dd1Dd2Dd3Dd
> 4Dd5DdcDddDdfDe0De4De5De6De7De8DedDeeDefDf2Df4Df6Df8DfaDfbDfdCcf0D35D3
> 8D48D4bD5dD65D7aDa4DcfCf90D03D07D0fD1cD1eD20D6cD7bD7dD81D85D8bD95D9eDa
> 5Da6Da7DaaDb4Db7DbfDc5Dd6Dd7Dd9DeaDecDfcC7f0D2dD40D60D6bD77Cf20D13D29D
> 33D4fD57D70D8aD9bDa9Dc3"{
>>       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");
>>          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");
>>          if (selectionType() == -1) { // no selection
>>             count = 0;
>>          } else {
>>             getSelectionCoordinates(xpoints, ypoints);
>>             count = xpoints.length;
>>          }
>>          row = nResults;
>>          setResult("Label", row, getTitle());
>>          setResult("Count", row, count);
>>         close();
>>       }
>>       path = "C:/Users/Martin.Braekevelt/Desktop/Results.xls"
>>       saveAs("Results", path);
>> }
>>
>>
>> Now it is time for you to learn a bit more on macro programming!
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> agej.nih.gov%2Fij%2Fdocs%2Fguide%2F146-14.html&amp;data=01%7C01%7Cmar
>> tin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e
>> 53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=KZFfXQtmddEgANPszgfYY5BH1
>> xM9j%2FAKdtQ1t5%2FuW40%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> agej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Fmacros.html&amp;data=01%7C01%
>> 7Cmartin.braekevelt%40bekaert.com%7C8b7090b1caf04546451d08d6758e4e2b%
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=C0Bt8e1%2BDkphlsL0e%
>> 2FfLqgP8X5CDGgRPJ5aSOSpyqkE%3D&amp;reserved=0
>>      
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fim
>> a
>> gej.nih.gov%2Fij%2Fdeveloper%2Fmacro%2Ffunctions.html&amp;data=01%7C0
>> 1
>> %7Cmartin.braekevelt%40bekaert.com%7C295840124e07420b292008d6755b4cf9
>> %
>> 7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=SPRv1HSqaQi4bfRFveq1
>> e
>> 3IyurJuWTmvC7sfrrCCMtc%3D&amp;reserved=0
>>
>>
>> Michael
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>
> --
> ImageJ mailing list:
> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimag
> ej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bek
> aert.com%7C8b7090b1caf04546451d08d6758e4e2b%7Cd9e53fd413d74ca7a6021417
> 3f4df0c8%7C1&amp;sdata=2pb15ERsCuLIdzH9YTJ8KgprCt6T11XIi7PDZbYLxbQ%3D&
> amp;reserved=0
>

--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7Cdfdb5ac593d946f942b508d6763a4919%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=q4jjVi1NiEKvIL69Jro34FSQQex8zvPZKiRaQpTC2Sc%3D&amp;reserved=0

--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7Cdfdb5ac593d946f942b508d6763a4919%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=q4jjVi1NiEKvIL69Jro34FSQQex8zvPZKiRaQpTC2Sc%3D&amp;reserved=0

--
ImageJ mailing list: https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=01%7C01%7Cmartin.braekevelt%40bekaert.com%7Cdfdb5ac593d946f942b508d6763a4919%7Cd9e53fd413d74ca7a60214173f4df0c8%7C1&amp;sdata=q4jjVi1NiEKvIL69Jro34FSQQex8zvPZKiRaQpTC2Sc%3D&amp;reserved=0

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html