Login  Register

open files error

Posted by vivace219 on Jun 04, 2009; 9:08pm
URL: http://imagej.273.s1.nabble.com/open-files-error-tp3692197.html

Hi. I'm currently trying to write a macros script for Image J that would read the .rawl files for each folder. The code is below.

file1head = "K:\\MicroCT Images\\5-25-09\\C00";

print("i'm the new head "+file1head);
file1tail = ".0000.rawl image=[16-bit Signed] width=512 height=512 offset=0 number=1 gap=0 little-endian open";
starter = 2522;
numFiles = 5;

for(i = 0; i < numFiles; i++){
counter =starter+i;
recounter = toString(counter);
print(recounter);
file1 = file1head+counter+"\\C00"+counter+file1tail;
print(file1);
filechecker = file1head+counter+"\\C00"+counter+".0000.rawl";

tempend = "C:\\Users\\yl49\\Desktop\\temp\\C00";
print("i'm here"+filechecker);
if(File.exists(filechecker)){
        print("i got in"+file1);
        run("Raw...", "open="+file1);
        run("Brightness/Contrast...");
        setMinAndMax(-988, 2136);
        file2 = file1head+counter+".tif";
        tempfile = tempend +counter+".tif";
        print(file2);
        run("Save", "save="+tempfile);
        close();
}

else{
        print("This folder's empty! No starter file! Check Folder!");
}

}




The problem i'm seeing with this code is that when attempting to open the specified file, it also attempts to open other folders that were included in the main K:\\ directory. Then my results show a stack of only 4 images that are of very blurry and messed up material and don't show anything at all. I'm not sure what's wrong with the opening of the files. Can someone shed some light on this?

Thanks!