Login  Register

Re: Batch process ROI between two sets of images

Posted by dc1312 on Aug 07, 2014; 9:02am
URL: http://imagej.273.s1.nabble.com/Batch-process-ROI-between-two-sets-of-images-tp5009046p5009055.html

Hi Curtis,

Thank you for the help, much appreciated.

I want to:
1. Open the first "A" image
2. Create a selection
3. Copy this selection to the first "B" image
4. Set selection to "value = NaN"
5. Save the new "B" image
6. Repeat for the second A and B image

Here's what I have but I suspect it's very wrong!

inputA = getDirectory("Choose the A images input folder");
inputB = getDirectory("Choose the B images input folder");      
output = getDirectory("Choose the output folder");
 
setBatchMode(true);
list = getFileList(inputA);
for (i = 0; i < list.length; i++)
        process(inputA, output, list[i]);
setBatchMode(false);
 
function process(inputA, output, filename)
{
    open (inputA + filename);
        run("Create Selection");  
        open (inputB + filename);
    run("Restore Selection");
        run("Set...", "value=NaN");
    saveAs("Tiff", output + filename);        
    close();                  
}

Any help much appreciated.

David