Thursday, May 1, 2014

Access Denied Error Java Noob




Hello Everyone. So I'm getting an access error denied for my code, from what I can tell by looking at other threads its how I'm saving the output file. I'm using imageJ and to make a macro I have to use java. This is basically an example macro I pulled off the internet. Essentially when I run the plugin "iterative PIV' it outputs a .txt file, and I think when I go to the new loop I try to reuse the filename or something. So if I change the filename for each loop would that work? Also I'm not sure how to do that, I'm only experienced really in matlab.




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("Select Output Folder");




setBatchMode(false);



for(s=1;s<slices;s++){



run("Duplicate...", "title=[seq_"+s+"] duplicate range="+s+"-"+s+1+"");



run("iterative PIV(Cross-correlation)...", " 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();



}



}







No comments:

Post a Comment