Login  Register

beginner macro question - window selection after BioFormats plug-in

Posted by Cath Heyward on May 01, 2014; 11:03am
URL: http://imagej.273.s1.nabble.com/beginner-macro-question-window-selection-after-BioFormats-plug-in-tp5007534.html

Hi all,

I'm trying to write my first macro to open 4-channel Olympus .oib files from a source directory into separate channels, subtract background and resave as separate channels.

So far I have

dir1 = getDirectory("Choose source directory"); // to select folder of files to work on
list = getFileList(dir1);
dir2 = getDirectory("Choose destination directory"); // where to put the saved files

for (i=0; i<list.length; i++){
        path = dir1+list[i];
        open(path);
        title1 = getTitle;
        if(matches(title1,".*C=0.*"))
        run("Subtract Background...", "rolling=10 sliding stack");
        run("8-bit");
        }

but it ignores my attempt to select the channel C=0, and instead processes the C=3 image which was opened last (the name of the file I am trying to select is actually "loc1.oib - C=0" after opening with BioFormats).
What am I doing wrong? Is it something to do with spaces in the filename?

Any help gratefully received. Or if there is a "beginners' common mistakes" thread somewhere then please put me onto it!

Thanks,

Cath