subtracting median from sets of avi files

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

subtracting median from sets of avi files

chris elliott
Hi (running 1.43n)

I have a directory full of avi files which show fly larva crawling on
varoous backgrounds. By hand, i can calculate and subtract the median
from the avi (which discriminates the larva wonderfully), and save to disk.

So I recorded the action:

open("Q:\\Julia_rpt\\marina\\30min\\ro54\\HL3 30' 1 uncomp.avi");
run("Z Project...", "start=1 stop=12 projection=Median");
imageCalculator("Subtract stack", "HL3 30' 1 uncomp.avi","MED_HL3 30' 1
uncomp.avi");
run("AVI... ", "compression=Uncompressed frame=0.1
save=[Q:\\Julia_rpt\\marina\\30min\\ro54\\test\\HL3 30' 1 uncomp.avi]");

and tried to put it in the batch mode window, modifying it like this to
pass the window id (as per ImageCalculatorDemo.txt)

id1 = getImageID;
run("Z Project...", "start=1 stop=12 projection=Median");
id2 = getImageID;
imageCalculator("Subtract stack", id1, id2);


I've got some problems with this:
1) i don't want to click "convert to grayscale" in the open dialog for
every file
2) how do I set the output for avi  ?  i don't see an option in the
Process > batch > macro dialog?

thanks
chris
Reply | Threaded
Open this post in threaded view
|

Re: subtracting median from sets of avi files

Rasband, Wayne (NIH/NIMH) [E]
On Jan 18, 2010, at 11:01 AM, chris elliott wrote:

> Hi (running 1.43n)
>
> I have a directory full of avi files which show fly larva crawling on
> varoous backgrounds. By hand, i can calculate and subtract the median
> from the avi (which discriminates the larva wonderfully), and save to disk.
>
> So I recorded the action:
>
> open("Q:\\Julia_rpt\\marina\\30min\\ro54\\HL3 30' 1 uncomp.avi");
> run("Z Project...", "start=1 stop=12 projection=Median");
> imageCalculator("Subtract stack", "HL3 30' 1 uncomp.avi","MED_HL3 30' 1
> uncomp.avi");
> run("AVI... ", "compression=Uncompressed frame=0.1
> save=[Q:\\Julia_rpt\\marina\\30min\\ro54\\test\\HL3 30' 1 uncomp.avi]");
>
> and tried to put it in the batch mode window, modifying it
> like this to pass the window id (as per ImageCalculatorDemo.txt)
>
> id1 = getImageID;
> run("Z Project...", "start=1 stop=12 projection=Median");
> id2 = getImageID;
> imageCalculator("Subtract stack", id1, id2);
>
>
> I've got some problems with this:
> 1) i don't want to click "convert to grayscale" in the open
> dialog for every file
> 2) how do I set the output for avi  ?  i don't see an option
> in the Process > batch > macro dialog?
>
> thanks
> chris

Here is a macro that subtracts the median from an AVI and saves the result as another AVI. The &path notation it uses to pass file path variables in run() function calls requires ImageJ 1.43k or later.

  requires("1.43k");
  setBatchMode(true);
  path1 = "/Users/wayne/images/test.avi";
  path2 = "/Users/wayne/images/test2.avi";
  run("AVI...", "select=&path1 convert");
  avi = getImageID;
  run("Z Project...", "projection=Median");
  median = getImageID;
  imageCalculator("Subtract stack", avi, median);
  selectImage(avi);
  run("AVI... ", "compression=Uncompressed frame=5 save=&path2");

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: subtracting median from sets of avi files

chris elliott
Rasband, Wayne (NIH/NIMH) [E] wrote:

>
> Here is a macro that subtracts the median from an AVI and saves the result as another AVI. The &path notation it uses to pass file path variables in run() function calls requires ImageJ 1.43k or later.
>
>   requires("1.43k");
>   setBatchMode(true);
>   path1 = "/Users/wayne/images/test.avi";
>   path2 = "/Users/wayne/images/test2.avi";
>   run("AVI...", "select=&path1 convert");
>   avi = getImageID;
>   run("Z Project...", "projection=Median");
>   median = getImageID;
>   imageCalculator("Subtract stack", avi, median);
>   selectImage(avi);
>   run("AVI... ", "compression=Uncompressed frame=5 save=&path2");
>
> -wayne

Thank you very much for such prompt help - it worked very efficiently
chris