ImageJ will not keep images open in batch mode

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

ImageJ will not keep images open in batch mode

Ryan McCool
Hi All,

I'm currently trying to write an extensive code to analyze some image. I have used bits of this code as individual macros before, however it would be much more productive if I could combine them.

My issue is that the chunk of code I will post below only works as an individual macro and not as a sub segment. The code should open up the desired image from the list and allow me to use the cell counter, however, in batch mode the image is closed before I close the "Cell Counter" dialogue box.

So as its own macro, I can use cell counter on one photo at a time, but when the code is put into a larger, more comprehensive macro none of the photos are visible. They seem to open and close immediately, leaving the cell counter tool and the "Cell Counter" dialogue box open. Does anyone have any ideas on how to get around this? If necessary I can provide the entire code, although it is a bit long.

title = "Select Images";
msg = "Select Merged RFP & GFP Photos";
waitForUser(title, msg);

Merged_image_directory = getDirectory("Choose Source Directory ");
              Merged_images = getFileList(Merged_image_directory);



for (i=0; i<Merged_images.length; i++){

open(Merged_image_directory+Merged_images[i]);
  run("Cell Counter");
   title = "Cell Counter";
    msg = "Count Cells, click result, record to exterior source, then close this dialogue box";
    waitForUser(title, msg);
}

Sincerely,
Ryan McCool
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ will not keep images open in batch mode

Ryan McCool
Hi All,

I moved the text around and it originally seemed to work just fine if it is not contained within brackets, however, as soon as I try to run any program with a Boolean before it, the code does not work.

Any ideas about why a Boolean preceding the code would prevent the image from being visibly open to the user?

Sincerely,
Ryan McCool
Reply | Threaded
Open this post in threaded view
|

Re: ImageJ will not keep images open in batch mode

Ryan McCool
In reply to this post by Ryan McCool
It seems the answer was actually as simple as adding

setBatchMode("True");

before the code. Now the code is:

title = "Select Images";
msg = "Select Merged RFP & GFP Photos";
waitForUser(title, msg);

Merged_image_directory = getDirectory("Choose Source Directory ");
              Merged_images = getFileList(Merged_image_directory);


setBatchMode("True");
for (i=0; i<Merged_images.length; i++){

open(Merged_image_directory+Merged_images[i]);
  run("Cell Counter");
   title = "Cell Counter";
    msg = "Count Cells, click result, record to exterior source, then close this dialogue box";
    waitForUser(title, msg);
}

Hopefully this is useful to someone else who is just starting out using ImageJ.

Sincerely,
Ryan McCool