background subtraction does not work

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

background subtraction does not work

juju
hello everyone...

I wrote a macro which processes a sequence of rawimages and backgroundimages. This Macro should subtract every backgroundimage from the corresponding rawimage. Unfortunately this does not work properly: All pixel of the resultimage have the value 0 which is not correct...
Here is the Code...

macro "Macro 2 [b]"  
{
dir1 = getDirectory("Choose a Directory ");
count = 0;
dir2 = getDirectory("Choose a Directory ");


list1 = getFileList(dir1);
list2 = getFileList(dir2);
    for (i=0; i<list.length; i++) {
        if (endsWith(list[i], "/"))
           listFiles(""+dir1+list1[i]);}
        //else
        //   print((count++) + ": " + dir1 + list1[i]);}

    for (i=0; i<fist.length; i++) {
        if (endsWith(fist[i], "/"))
           listFiles(""+dir2+list2[i]);}
        //else
        //   print((count++) + ": " + dir2 + list2[i]);}


sort1 = Array.sort(list1)
sort2 = Array.sort(list2)

    for (i=0;i<1;i++){
        imag1 = dir1 + sort1[i];
        imag2 = dir2 + sort2[i];
        run("Raw...", "open=imag1 image=[16-bit Unsigned] width=512 height=512 offset=68 number=40 gap=0 little-endian");
        a = getImageID();
        run("Raw...", "open=imag2 image=[16-bit Unsigned] width=512 height=512 offset=68 number=1 gap=0 little-endian");
        b = getImageID();
        run("Image Calculator...","selectImage(a) operation=Subtract create selectImage(b)");}

Can someone help me fix this problem??

Thank you

regards
Juju