JACoP Batch Processing

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

JACoP Batch Processing

Adingle
Hello,

I am currently running colocalization analysis using the JACoP plugin and
have built a macro to automate this process. After attempting to make it
generic, I keep receiving an error message when attempting to run the macro.
I am hoping someone can spot the error and help me fix it. I have pasted the
macro as well as the error message I am receiving below.

Error: ')' expected in line 13:
       
run ( "JACoP " , "imga=[" <C1> - "+img_name] imgb=[" C2 - "+img_name]
thra=4500 thrb=6500 pearson mm costesthr costesra...


img_name=getTitle();
run("Next Slice [>]");
run("Next Slice [>]");
run("Delete Slice", "delete=channel");
run("Split Channels");
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
run("JACoP ");
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
run("JACoP ", "imga=["C1-"+img_name] imgb=["C2-"+img_name] thra=4500
thrb=6500 pearson mm costesthr costesrand=2-1-200-0.001-0-false-true-true");
selectWindow("Costes' threshold ["C1-"+img_name] and ["C2-"+img_name]");
selectWindow("Costes' mask");
selectWindow("Randomized images of ["C2-"+img_name]");
selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])");
selectWindow("Costes' threshold ["C1-"+img_name] and ["C2-"+img_name]");
selectWindow("Costes' mask");
selectWindow("Randomized images of ["C2-"+img_name]");
selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])");
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);

saveAs("Text", "/Volumes/ALEXIUS_D/Flourescent
Microscopy/DENV2_100xmag/Output/Log.txt");
close();
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("Costes' mask");
close();
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("Randomized images of ["C2-"+img_name]");
close();
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])");
close();
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("C1-"+img_name);
close();
selectWindow("C2-"+img_name);
close();




--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: JACoP Batch Processing

Mark Chopping
Hi Adingle,

You may need to escape the quotes inside strings:

run ( "JACoP " , "imga=[" <C1> - "+img_name] imgb=[" C2 - "+img_name]
... try changing to:
run ( "JACoP " , "imga=[\" <C1> - \"+img_name] imgb=[\" C2 - \"+img_name]

The second argument assigns a concatenated string to imga and that has
quotes that will terminate the argument string unless escaped.

I am not certain this is the issue -- I am not familiar with the JACoP call
syntax -- but it would explain the error message.

Best wishes,

 Mark

Mark Chopping, Ph.D. (he, him, his) <--what's this?
<https://www.glsen.org/activity/pronouns-guide-glsen>
Director, Ph.D. Program in Environmental Science and Management
Professor, Department of Earth and Environmental Studies
Montclair State University, Montclair, NJ 07043
Tel. (973) 655-7384 Fax: (973) 655-4072
https://www.montclair.edu/environmental-management-phd
http://www.montclair.edu/csam/remote-sensing-lab
<https://www.montclair.edu> [image: above.nasa.gov] <http://above.nasa.gov>
             <https://www.majortaylorclub.com/>
<https://misr.jpl.nasa.gov/>
All opinions expressed here are my own and do not represent the views
or policies
of
Montclair State University, NASA, NJ DEP, NACP, USDA, MTCCNJ, or AGU.



On Thu, Mar 25, 2021 at 9:55 PM Adingle <[hidden email]> wrote:

> Hello,
>
> I am currently running colocalization analysis using the JACoP plugin and
> have built a macro to automate this process. After attempting to make it
> generic, I keep receiving an error message when attempting to run the
> macro.
> I am hoping someone can spot the error and help me fix it. I have pasted
> the
> macro as well as the error message I am receiving below.
>
> Error: ')' expected in line 13:
>
> run ( "JACoP " , "imga=[" <C1> - "+img_name] imgb=[" C2 - "+img_name]
> thra=4500 thrb=6500 pearson mm costesthr costesra...
>
>
> img_name=getTitle();
> run("Next Slice [>]");
> run("Next Slice [>]");
> run("Delete Slice", "delete=channel");
> run("Split Channels");
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> run("JACoP ");
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> run("JACoP ", "imga=["C1-"+img_name] imgb=["C2-"+img_name] thra=4500
> thrb=6500 pearson mm costesthr
> costesrand=2-1-200-0.001-0-false-true-true");
> selectWindow("Costes' threshold ["C1-"+img_name] and ["C2-"+img_name]");
> selectWindow("Costes' mask");
> selectWindow("Randomized images of ["C2-"+img_name]");
> selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])");
> selectWindow("Costes' threshold ["C1-"+img_name] and ["C2-"+img_name]");
> selectWindow("Costes' mask");
> selectWindow("Randomized images of ["C2-"+img_name]");
> selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])");
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
>
> saveAs("Text", "/Volumes/ALEXIUS_D/Flourescent
> Microscopy/DENV2_100xmag/Output/Log.txt");
> close();
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> selectWindow("Costes' mask");
> close();
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> selectWindow("Randomized images of ["C2-"+img_name]");
> close();
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])");
> close();
> selectWindow("C1-"+img_name);
> selectWindow("C2-"+img_name);
> selectWindow("C1-"+img_name);
> close();
> selectWindow("C2-"+img_name);
> close();
>
>
>
>
> --
> Sent from: http://imagej.1557.x6.nabble.com/
>
> --
> 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: JACoP Batch Processing

Stein Rørvik
In reply to this post by Adingle
I think you need to skip the first quote in the assignments and add +", like this:

run("JACoP ", "imga=[C1-"+img_name+"] imgb=[C2-"+img_name+"] thra=4500
thrb=6500 pearson mm costesthr costesrand=2-1-200-0.001-0-false-true-true");

A cleaner solution could perhaps be to do it this way instead:
...
selectWindow("C1-"+img_name);
img1 = getTitle;
selectWindow("C2-"+img_name);
img2 = getTitle;
...
run("JACoP ", "imga=[&img1] imgb=[&img2] thra=4500
thrb=6500 pearson mm costesthr costesrand=2-1-200-0.001-0-false-true-true");
...

Stein

-----Original Message-----
Sent: 26. mars 2021 02:45
Subject: JACoP Batch Processing

Hello,

I am currently running colocalization analysis using the JACoP plugin and have built a macro to automate this process. After attempting to make it generic, I keep receiving an error message when attempting to run the macro.
I am hoping someone can spot the error and help me fix it. I have pasted the macro as well as the error message I am receiving below.

Error: ')' expected in line 13:
       
run ( "JACoP " , "imga=[" <C1> - "+img_name] imgb=[" C2 - "+img_name]
thra=4500 thrb=6500 pearson mm costesthr costesra...


img_name=getTitle();
run("Next Slice [>]");
run("Next Slice [>]");
run("Delete Slice", "delete=channel");
run("Split Channels");
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
run("JACoP ");
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
run("JACoP ", "imga=["C1-"+img_name] imgb=["C2-"+img_name] thra=4500
thrb=6500 pearson mm costesthr costesrand=2-1-200-0.001-0-false-true-true");
selectWindow("Costes' threshold ["C1-"+img_name] and ["C2-"+img_name]"); selectWindow("Costes' mask"); selectWindow("Randomized images of ["C2-"+img_name]"); selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])"); selectWindow("Costes' threshold ["C1-"+img_name] and ["C2-"+img_name]"); selectWindow("Costes' mask"); selectWindow("Randomized images of ["C2-"+img_name]"); selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])"); selectWindow("C1-"+img_name); selectWindow("C2-"+img_name); selectWindow("C1-"+img_name); selectWindow("C2-"+img_name);

saveAs("Text", "/Volumes/ALEXIUS_D/Flourescent Microscopy/DENV2_100xmag/Output/Log.txt");
close();
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("Costes' mask");
close();
selectWindow("C1-"+img_name);
selectWindow("C2-"+img_name);
selectWindow("Randomized images of ["C2-"+img_name]"); close(); selectWindow("C1-"+img_name); selectWindow("C2-"+img_name); selectWindow("Costes' method (["C1-"+img_name] & ["C2-"+img_name])"); close(); selectWindow("C1-"+img_name); selectWindow("C2-"+img_name); selectWindow("C1-"+img_name); close(); selectWindow("C2-"+img_name); close();




--
Sent from: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2F&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7Ca776d4e8a406442e8d8108d8effa3d89%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637523205366514571%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=MS0FGKaU6PbIWW3H%2BHTvYG0vcq5i1pO3T6HSqih17P4%3D&amp;reserved=0

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7Ca776d4e8a406442e8d8108d8effa3d89%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637523205366514571%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=AlYwHICEczUaivONIZkwVR4CT5KSTNHQBXDcdBb3Npk%3D&amp;reserved=0

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

Re: JACoP Batch Processing

Adingle
In reply to this post by Mark Chopping
Hello Mark,

Thanks for your suggestion. I made the change but it did not work. I copied
the line here for reference as well as the error message.

run("JACoP ", "imga=[\"C1-\"+img_name] imgb=[\"C2-\"+img_name] thra=4500
thrb=6500 pearson mm costesthr costesrand=2-1-200-0.001-0-false-true-true");

Error: Image not found while running JACoP from a macro
1-Use "open(path)" in your macro to open images
2-Make sure you have called the right image ! in line 13:
       
run ( "JACoP " , "imga=["C1-"+img_name] imgb=["C2-"+img_name] thra=4500
thrb=6500 pearson mm costesthr costesrand=2-1-2...




--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: JACoP Batch Processing

Adingle
In reply to this post by Stein Rørvik
Hello Stein,

Thank you for your suggestion! It fixed the problem that I was having. I
just have one more question. I'm am trying to select the Costes' Threshold
window to close it out, yet I'm am receiving an error saying "No window with
the title "Costes' threshold [C1-Snap-xxx.czi] and [C2-Snap-xxx.czi]"
found."

Do you have any suggestions to fix this as well? Here is how it is written
in the macro.

selectWindow("Costes' threshold [C1-"+img_name+"] and [C2-"+img_name+"]");

Alexius



--
Sent from: http://imagej.1557.x6.nabble.com/

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

Re: JACoP Batch Processing

Stein Rørvik
Are you sure that the window's name is really "Costes' threshold [C1-Snap-xxx.czi] and [C2-Snap-xxx.czi]" ?
If it does not have this exact name, the macro will not find it. Revise the string so it matches.

If all you want to do is to close the window, the command close("Costes*"); would probably be easier to use.

Stein

-----Original Message-----
Sent: 26. mars 2021 14:52
Subject: Re: JACoP Batch Processing

Hello Stein,

Thank you for your suggestion! It fixed the problem that I was having. I just have one more question. I'm am trying to select the Costes' Threshold window to close it out, yet I'm am receiving an error saying "No window with the title "Costes' threshold [C1-Snap-xxx.czi] and [C2-Snap-xxx.czi]"
found."

Do you have any suggestions to fix this as well? Here is how it is written in the macro.

selectWindow("Costes' threshold [C1-"+img_name+"] and [C2-"+img_name+"]");

Alexius



--
Sent from: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.1557.x6.nabble.com%2F&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C44f2eb65872e4c0f90a308d8f05e65bf%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637523635523781942%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=9YytP7G%2F8eOhPmd%2BoodWmCUVLpvtutoUbKGi5XgObz4%3D&amp;reserved=0

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=04%7C01%7Cstein.rorvik%40sintef.no%7C44f2eb65872e4c0f90a308d8f05e65bf%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637523635523791899%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=LJsuFHplo5s0bsvVd7ffd32nzJEULazvgjLjaOOsblY%3D&amp;reserved=0

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