JACop batch processing

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

JACop batch processing

Interleukin-10
Hello,

I have a collection of several dozen images and I would like to do a colocalisation analysis using JaCoP. Normally I do this manually image-by-image but I believe there must be a way to record the macro for it; I need to open each image, split it into the red and green channel, open JACoP and choose the object-based analysis for the two channels, setting the pixel size and threshold (which remain the same for all the images) and running the analysis.
 
What do you suggest? I would be very grateful for any comments.

Thanks,
Kamal
Reply | Threaded
Open this post in threaded view
|

Re: JACop batch processing

Pariksheet Nanda
Hi Kamal,

On Fri, Aug 1, 2014 at 7:00 PM, Interleukin-10
<[hidden email]> wrote:

>
> I have a collection of several dozen images and I would like to do a
> colocalisation analysis using JaCoP. Normally I do this manually
> image-by-image but I believe there must be a way to record the macro for it;
> I need to open each image, split it into the red and green channel, open
> JACoP and choose the object-based analysis for the two channels, setting the
> pixel size and threshold (which remain the same for all the images) and
> running the analysis.
>
> What do you suggest? I would be very grateful for any comments.

Open your image, then launch the macro recorder using:

   Plugins > Macros > Record...

Then as you perform your usual image processing steps, the
corresponding ImageJ macro commands will be recorded.  When you are
done, in the Recorder window, hit the "Create" button to save the
macro.  You can run it the next time with:

   Plugins > Macros > Run...

Further reading:
http://imagej.nih.gov/ij/docs/guide/146-31.html#toc-Subsection-31.1
http://imagej.nih.gov/ij/developer/macro/macros.html


Pariksheet

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

RE: JACop batch processing

Interleukin-10
Hi Pariksheet,

Thank you for your response. I have figured out how to record the macros, but the problem I am having now is that my macro is specific for one image. How can I apply the macro to all my images? I get an error message saying my image name is different than the one in the macro (since it is specific for the image that I used to record the macro).

I hope this makes sense.

Anyways, any help would be greatly appreciated.

Thanks again,
Kamaldeep

From: Pariksheet Nanda [via ImageJ] [ml-node+[hidden email]]
Sent: Sunday, August 10, 2014 3:50 PM
To: Jawanda, Kamaldeep Kaur
Subject: Re: JACop batch processing

Hi Kamal,

On Fri, Aug 1, 2014 at 7:00 PM, Interleukin-10
<[hidden email]> wrote:

>
> I have a collection of several dozen images and I would like to do a
> colocalisation analysis using JaCoP. Normally I do this manually
> image-by-image but I believe there must be a way to record the macro for it;
> I need to open each image, split it into the red and green channel, open
> JACoP and choose the object-based analysis for the two channels, setting the
> pixel size and threshold (which remain the same for all the images) and
> running the analysis.
>
> What do you suggest? I would be very grateful for any comments.

Open your image, then launch the macro recorder using:

   Plugins > Macros > Record...

Then as you perform your usual image processing steps, the
corresponding ImageJ macro commands will be recorded.  When you are
done, in the Recorder window, hit the "Create" button to save the
macro.  You can run it the next time with:

   Plugins > Macros > Run...

Further reading:
http://imagej.nih.gov/ij/docs/guide/146-31.html#toc-Subsection-31.1
http://imagej.nih.gov/ij/developer/macro/macros.html


Pariksheet

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009084.html
To unsubscribe from JACop batch processing, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: JACop batch processing

Pariksheet Nanda
Hi Kamaldeep,

On Mon, Aug 11, 2014 at 11:38 AM, Interleukin-10
<[hidden email]> wrote:
>
> the problem I am having now is that my macro is specific for one image. How can I apply the macro to all my images? I get an error message saying my image name is different than the one in the macro (since it is specific for the image that I used to record the macro).

Paste your macro in an e-mail and we can have a look.


Pariksheet

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

Re: JACop batch processing

Jasvinder S Ahuja
In reply to this post by Interleukin-10
Hi Kamaldeep,
I have recently learnt how a bit of code can make life so much easier! To
begin I suggest you visit -
http://adm.mri.cnrs.fr/datas/fichiers/articles/60/184.pdf
http://www.sussex.ac.uk/gdsc/intranet/pdfs/ImageJBatchProcessing.pdf

These are nice resources to get you started with batches of images.
Jasvinder


On Mon, Aug 11, 2014 at 11:38 AM, Interleukin-10 <
[hidden email]> wrote:

> Hi Pariksheet,
>
> Thank you for your response. I have figured out how to record the macros,
> but the problem I am having now is that my macro is specific for one image.
> How can I apply the macro to all my images? I get an error message saying
> my image name is different than the one in the macro (since it is specific
> for the image that I used to record the macro).
>
> I hope this makes sense.
>
> Anyways, any help would be greatly appreciated.
>
> Thanks again,
> Kamaldeep
> ________________________________
> From: Pariksheet Nanda [via ImageJ] [[hidden email]
> ]
> Sent: Sunday, August 10, 2014 3:50 PM
> To: Jawanda, Kamaldeep Kaur
> Subject: Re: JACop batch processing
>
> Hi Kamal,
>
> On Fri, Aug 1, 2014 at 7:00 PM, Interleukin-10
> <[hidden email]<UrlBlockedError.aspx>> wrote:
>
> >
> > I have a collection of several dozen images and I would like to do a
> > colocalisation analysis using JaCoP. Normally I do this manually
> > image-by-image but I believe there must be a way to record the macro for
> it;
> > I need to open each image, split it into the red and green channel, open
> > JACoP and choose the object-based analysis for the two channels, setting
> the
> > pixel size and threshold (which remain the same for all the images) and
> > running the analysis.
> >
> > What do you suggest? I would be very grateful for any comments.
>
> Open your image, then launch the macro recorder using:
>
>    Plugins > Macros > Record...
>
> Then as you perform your usual image processing steps, the
> corresponding ImageJ macro commands will be recorded.  When you are
> done, in the Recorder window, hit the "Create" button to save the
> macro.  You can run it the next time with:
>
>    Plugins > Macros > Run...
>
> Further reading:
> http://imagej.nih.gov/ij/docs/guide/146-31.html#toc-Subsection-31.1
> http://imagej.nih.gov/ij/developer/macro/macros.html
>
>
> Pariksheet
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009084.html
> To unsubscribe from JACop batch processing, click here<
> >.
> NAML<
>
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009095.html
> Sent from the ImageJ mailing list archive at 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

Interleukin-10
Hello,

This is the macro that I have been working on: Basically, it is supposed to open my directory that contains all the images I want to apply batch processing to. From these images I want to select cells (by creating a rectangle), crop the cell, split channels, convert to 8-bit format and then apply JaCop. The problem once again, is that y macro is specific for one image that I used to record the macro (ex. you will notice C2-practivComposite in the code).

Thanks again for your help,
Kamaldeep

dir=getDirectory("image");

 

close();

 

list=getFileList(dir);

 

for (i=0;i<list.length;i++){

 

  path = dir+list[i];

 

  if (!endsWith(path,"/")) open(path);

 

  runMacro("Macro2.ijm");

 

}

makeRectangle(173, 282, 48, 46);

run("Crop");

run("Split Channels");

title = getTitle();

     "red=[Edges of " + title + "] green=[" + title + "] blue=[" + title + "] gray=*None*");

selectWindow("C2-practivComposite.tif");

selectWindow("C1-practivComposite.tif");

run("8-bit");

selectWindow("C2-practivComposite.tif");

run("8-bit");

run("JACoP ");

selectWindow("C2-practivComposite.tif");

selectWindow("C1-practivComposite.tif");

selectWindow("C2-practivComposite.tif");

run("JACoP ", "imga=C1-practivComposite.tif imgb=C2-practivComposite.tif thra=43 thrb=24 pearson mm costesthr ccf=20 cytofluo ica costesrand=1-16-100-0.0010-0-false-true-true");

selectWindow("Costes' threshold C1-practivComposite.tif and C2-practivComposite.tif");

selectWindow("Costes' mask");

selectWindow("Van Steensel's CCF between C1-practivComposite.tif and C2-practivComposite.tif");

selectWindow("Cytofluorogram between C1-practivComposite.tif and C2-practivComposite.tif");

selectWindow("ICA A (C1-practivComposite.tif)");

selectWindow("ICA B (C2-practivComposite.tif)");

selectWindow("Randomized images of C2-practivComposite.tif");

selectWindow("Costes' method (C1-practivComposite.tif & C2-practivComposite.tif)");

selectWindow("Costes' threshold C1-practivComposite.tif and C2-practivComposite.tif");

selectWindow("Costes' mask");

selectWindow("C1-practivComposite.tif");

selectWindow("C2-practivComposite.tif");

selectWindow("Van Steensel's CCF between C1-practivComposite.tif and C2-practivComposite.tif");

selectWindow("Cytofluorogram between C1-practivComposite.tif and C2-practivComposite.tif");

selectWindow("ICA A (C1-practivComposite.tif)");

selectWindow("ICA B (C2-practivComposite.tif)");

selectWindow("Randomized images of C2-practivComposite.tif");

selectWindow("C1-practivComposite.tif");

selectWindow("C2-practivComposite.tif");

selectWindow("Costes' method (C1-practivComposite.tif & C2-practivComposite.tif)");

run("Close All");




From: Jasvinder S Ahuja [via ImageJ] [ml-node+[hidden email]]
Sent: Monday, August 11, 2014 8:06 PM
To: Jawanda, Kamaldeep Kaur
Subject: Re: JACop batch processing

Hi Kamaldeep,
I have recently learnt how a bit of code can make life so much easier! To
begin I suggest you visit -
http://adm.mri.cnrs.fr/datas/fichiers/articles/60/184.pdf
http://www.sussex.ac.uk/gdsc/intranet/pdfs/ImageJBatchProcessing.pdf

These are nice resources to get you started with batches of images.
Jasvinder


On Mon, Aug 11, 2014 at 11:38 AM, Interleukin-10 <
[hidden email]> wrote:

> Hi Pariksheet,
>
> Thank you for your response. I have figured out how to record the macros,
> but the problem I am having now is that my macro is specific for one image.
> How can I apply the macro to all my images? I get an error message saying
> my image name is different than the one in the macro (since it is specific
> for the image that I used to record the macro).
>
> I hope this makes sense.
>
> Anyways, any help would be greatly appreciated.
>
> Thanks again,
> Kamaldeep
> ________________________________
> From: Pariksheet Nanda [via ImageJ] [[hidden email]
> ]
> Sent: Sunday, August 10, 2014 3:50 PM
> To: Jawanda, Kamaldeep Kaur
> Subject: Re: JACop batch processing
>
> Hi Kamal,
>
> On Fri, Aug 1, 2014 at 7:00 PM, Interleukin-10
> <[hidden email]<UrlBlockedError.aspx>> wrote:
>
> >
> > I have a collection of several dozen images and I would like to do a
> > colocalisation analysis using JaCoP. Normally I do this manually
> > image-by-image but I believe there must be a way to record the macro for
> it;
> > I need to open each image, split it into the red and green channel, open
> > JACoP and choose the object-based analysis for the two channels, setting
> the
> > pixel size and threshold (which remain the same for all the images) and
> > running the analysis.
> >
> > What do you suggest? I would be very grateful for any comments.
>
> Open your image, then launch the macro recorder using:
>
>    Plugins > Macros > Record...
>
> Then as you perform your usual image processing steps, the
> corresponding ImageJ macro commands will be recorded.  When you are
> done, in the Recorder window, hit the "Create" button to save the
> macro.  You can run it the next time with:
>
>    Plugins > Macros > Run...
>
> Further reading:
> http://imagej.nih.gov/ij/docs/guide/146-31.html#toc-Subsection-31.1
> http://imagej.nih.gov/ij/developer/macro/macros.html
>
>
> Pariksheet
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009084.html
> To unsubscribe from JACop batch processing, click here<
> >.
> NAML<
>
http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009095.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009117.html
To unsubscribe from JACop batch processing, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: JACop batch processing

Neil Fazel
In reply to this post by Interleukin-10
>The problem once again, is that y macro is specific for one image that I used to record the macro

runMacro() takes a 2nd argument which you can use to pass a parameter to the macro being called. Use that to pass the name of the file you would like the macro to process. Then modify the called macro to get the argument via a call to getArgument() and use that to programmatically replace all the hard-coded file names from the Macro Recorder.

Neil

This is from the macro manual:

getArgument()
Returns the string argument passed to macros called by runMacro(macro, arg),eval(macro), IJ.runMacro(macro,
arg) or IJ.runMacroFile(path, arg).

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

RE: JACop batch processing

Interleukin-10
Hi Neil,

From what I understand, I should add getArgument(image name) whereever my original image name appears. I should also add runMacro() to my macro as well. Where do I add this part? Please forgive my lack of undersanding for this language.

Thanks,
Kamaldeep



From: Neil Fazel [via ImageJ] [ml-node+[hidden email]]
Sent: Tuesday, August 12, 2014 12:05 PM
To: Jawanda, Kamaldeep Kaur
Subject: Re: JACop batch processing

>The problem once again, is that y macro is specific for one image that I used to record the macro

runMacro() takes a 2nd argument which you can use to pass a parameter to the macro being called. Use that to pass the name of the file you would like the macro to process. Then modify the called macro to get the argument via a call to getArgument() and use that to programmatically replace all the hard-coded file names from the Macro Recorder.

Neil

This is from the macro manual:

getArgument()
Returns the string argument passed to macros called by runMacro(macro, arg),eval(macro), IJ.runMacro(macro,
arg) or IJ.runMacroFile(path, arg).

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/JACop-batch-processing-tp5009015p5009149.html
To unsubscribe from JACop batch processing, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: JACop batch processing

Pariksheet Nanda
In reply to this post by Interleukin-10
Hi Kamaldeep,

On Tue, Aug 12, 2014 at 1:56 PM, Interleukin-10
<[hidden email]> wrote:
>
> The problem once again, is that y macro is specific for one image that I used to record the macro (ex. you will notice C2-practivComposite in the code).

You can solve this by getting the image titles of the green and blue
channels that you get after splitting your image.  getTitle() only
gets the current images, so instead you need to run selectImage().
See this example macro for getting all open image window titles:
http://imagej.nih.gov/ij/macros/DisplayWindowTitles.txt

You can do something like:

   selectImage(1);
   green = getTitle();
   selectImage(2);
   blue = getTitle();

Then you can replace "C1-practivComposite.tif" with green
"C2-practivComposite.tif" with blue in the rest of your code.


> Kamaldeep

Pariksheet

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