Duplicate Loop Macro Question

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

Duplicate Loop Macro Question

koalaguy
Hi everyone,

I have a problem that I assume is very easy for a lot of you (I'm a total beginner).

I would like to run the following code:

run("Duplicate...", "title=1d-1.cxd duplicate range=1-2");
run("iterative PIV(Basic)...", save=/Users/xxx/Desktop/PIV.txt save=/Users/xxx/Desktop/PIV.txt");

first for the duplicate range 1-2 of the original stack, then 2-3, 3-4 etc. up until 2000. Also all of this data should be saved to the same file - i.e. I don't want 2000 text files! For each of these steps I would like the Iterative PIV plugin to run for each consecutive 2-slice set.

I assume this is done with a while loop? How would I code this? Any advice is appreciated.

Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: Duplicate Loop Macro Question

Kota Miura
On Tue, Oct 23, 2012 at 7:29 PM, koalaguy <[hidden email]> wrote:

> Hi everyone,
>
> I have a problem that I assume is very easy for a lot of you (I'm a total
> beginner).
>
> I would like to run the following code:
>
> run("Duplicate...", "title=1d-1.cxd duplicate range=1-2");
> run("iterative PIV(Basic)...", save=/Users/xxx/Desktop/PIV.txt
> save=/Users/xxx/Desktop/PIV.txt");
>
> first for the duplicate range 1-2 of the original stack, then 2-3, 3-4 etc.
> up until 2000. Also all of this data should be saved to the same file -
> i.e.
> I don't want 2000 text files! For each of these steps I would like the
> Iterative PIV plugin to run for each consecutive 2-slice set.
>
> I assume this is done with a while loop? How would I code this? Any advice
> is appreciated.
>
> Thanks!
>

Hi John,

I have a small javascript that deals with stack PIV using Zong's plugin.

https://github.com/cmci/ijmacros/blob/master/Tina/batchPIV.js

Some of your demands are not implemented, such as

- "cross-correlation" should be replaced with Iterative PIV Basic.
- I did not made it to output a single text file, but multiple.

Maybe modify the code a bit, and then you could do what you need to do.

HTH
Kota
--

-------------------------------------------------------------*Dr. Kota Miura*

Scientist & IT Engineer
Centre for Molecular and Cellular Imaging,
European Molecular Biology Laboratory
Meyerhofstr. 1
69117 Heidelberg
GERMANY

Tel +49 6221 387 404

Mobile +49 160 95001177

Fax +49 6221 387 512

http://cmci.embl.de
-------------------------------------------------------------

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

Re: Duplicate Loop Macro Question

koalaguy
Hi, thanks for your reply. I just tried running your script, but it didn't work, maybe because I'm on a Mac? Shouldn't it be possible to get it to run with a simple for loop, like:

for (i=1; i<2000; i++)
{
      run("Duplicate...", "duplicate range=i-i+1");
   }

?

This doesn't work by the way, as you probably guessed!
Reply | Threaded
Open this post in threaded view
|

Re: Duplicate Loop Macro Question

koalaguy
Hi, realised it's nothing to do with mac or pc, stupid question.
Please could you tell me...

Do I run this as a macro?

Which of the lines you commented out need to be included?

Why are there 2 path input files? Do I need both?

What do I make the imagestack? is this just the file name? or also the path?

Sorry, just really confused!


Reply | Threaded
Open this post in threaded view
|

Re: Duplicate Loop Macro Question

Kota Miura
In reply to this post by koalaguy
On Tue, Oct 23, 2012 at 11:19 PM, koalaguy <[hidden email]> wrote:

> Hi, thanks for your reply. I just tried running your script, but it didn't
> work, maybe because I'm on a Mac? Shouldn't it be possible to get it to run
> with a simple for loop, like:
>
> for (i=1; i<2000; i++)
> {
>       run("Duplicate...", "duplicate range=i-i+1");
>    }
>
> ?
>
> This doesn't work by the way, as you probably guessed!
>
>
Hi John,

I was pointing you to a wrong one.
I actually made more recently that uses Iterative PIV Basic.

https://github.com/cmci/ijmacros/blob/master/Tina/batchPIVtempMatch.js

You need to download, save the file locally then

Plugins > Macros > Edit...

to open the file. Change following three lines according to your file
location. You need to have a new folder ready in the same folder where you
have your stack. Outputs will be saved in that new folder.

path = "/Volumes/D/Matteo/";

savepath = path + "vecdata/";

imagestack = "name_Concatenated_Stacks.tif";

After you change these path and file names,

Macros > Evaluate javascript

Will do the job. Processing will be done silently, as this script was
written to process images using cluster.

If you want to change PIV parameters, then change corresponding numbers

---

piv1 = 128;

piv2 = 64;

piv3 = 48;

cor = 0.60;

noise = 0.20;

threshold = 5;

c1 = 3;

c2 = 1;

----

For the looping question,

for (i=1; i<2000; i++)
      run("Duplicate...", "duplicate range="+i+"-"+i+1);

HTH

Kota

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