|
I'll start by saying I'm a beginner with ImageJ and Java, and have mainly only coded in Matlab. I'm trying to make a macro that will run the PIV plugin for multiple images or slices. What the PIV does is basically tracks particles in two images and puts vectors between them based on their movement. I want to run this for multiple images, instead of just 2 which is what the plugin does, and average the vectors. There was an example macro on the website which is posted below, the only change is where it said to enter the output folder.
So I import the images, then when I run it confirms the window sizes I want to use, then asks me to select a folder which I assume is the output folder I'm selecting even though I already put that in the code? It runs for a while and then I get an error
javo.io.FileNotFoundException: C:\Users\MEM\ImageJ_PIV_Output (Access is denied)
I'm logging in as the administrator, so why is access denied? Any help or advice would be great thanks.
id0 = getImageID();
slices = nSlices;
Dialog.create("Multi-slice PIV");
Dialog.addNumber("Interrogation window 1", 128);
Dialog.addNumber("search window 1", 256);
Dialog.addNumber("vector spacing 1", 64);
Dialog.addNumber("Interrogation window 2", 64);
Dialog.addNumber("search window 2", 128);
Dialog.addNumber("vector spacing 2", 32);
Dialog.addNumber("Interrogation window 3", 32);
Dialog.addNumber("search window 3", 64);
Dialog.addNumber("vector spacing 3", 16);
Dialog.addNumber("correlation threshold", 0.8);
Dialog.show;
piv1 = Dialog.getNumber();
sw1 = Dialog.getNumber();
vs1 = Dialog.getNumber();
piv2 = Dialog.getNumber();
sw2 = Dialog.getNumber();
vs2 = Dialog.getNumber();
piv3 = Dialog.getNumber();
sw3 = Dialog.getNumber();
vs3 = Dialog.getNumber();
corr = Dialog.getNumber();
path = getDirectory("C:\Users\MEM\Desktop\ImageJ_PIV_Output");
setBatchMode(true);
for(s=1;s<slices;s++){
run("Duplicate...", "title=[seq_"+s+"] duplicate range="+s+"-"+s+1+"");
run("iterative PIV(Advanced)...", " piv1="+piv1+" sw1="+sw1+" vs1="+vs1+" piv2="+piv2+" sw2="+sw2+" vs2="+vs2+" piv3="+piv3+" sw3="+sw3+" vs3="+vs3+" correlation="+corr+" batch path=["+path+"]");
for(n=1;n<nImages;n++){
selectImage(n);
if(n!=id0)close();
}
}
|