Login  Register

Re: Images to stack in batch mode

Posted by remi-2-3 on Mar 20, 2009; 9:39am
URL: http://imagej.273.s1.nabble.com/Images-to-stack-in-batch-mode-tp3693222p3693225.html

Gabriel Landini wrote:

> On Friday 20 March 2009 01:25:15 David Webster wrote:
>  
>> setBatchMode(true);
>> newImage("1", "8-bit Black", 100, 100, 1);
>> newImage("2", "8-bit Black", 100, 100, 1);
>> newImage("3", "8-bit Black", 100, 100, 1);
>> // Point 1
>> //setBatchMode(false);
>> // Point 2
>> run("Images to Stack");
>> //setBatchMode(false);
>>
>> If I uncomment the first "setBatchMode(false)" then images 1 and 2 aren't
>> seen and I get the error message "There must be two images open" (image 3
>> is open).
>>    
>
> But that is correct. The documentation states that when you exit batch mode
> with "false", only the last selected image is shown, the others are closed.
>
>  
>>> I am currently trying to do some image analysis with an imageJ macro that
>>> I launch in batch mode from the command line (-batch option and
>>> setBatch(true)). After generating 68 images I would like to run the
>>> 'Images to Stack' command, to 'compile' them. Unfortunately, the stack is
>>> never generated.
>>>      
>
> Does it run without the batchmode?
> Do you by any chance have different types of images, or different sizes?
>
> cheers,
> G.
>  

This code, with a Z-axis plot doesn't work

setBatchMode(true);

//Setting the autoclose options
run("Profile Plot Options...", "width=450 height=200 minimum=0 maximum=0
do auto-close interpolate draw")

//Creating three pictures
newImage("1", "8-bit White", 500, 500, 1);
newImage("2", "8-bit White", 500, 500, 1);
newImage("3", "8-bit White", 500, 500, 1);

//Making a stack
run("Images to Stack");

print("nImages: "+nImages);
print("title: "+getTitle);
print("stack size: "+nSlices);

//Doing some analysis
run("Plot Z-axis Profile");
close(); //On ferme le plot généré par le Z-axis Profile-A

//Closing the stack
selectWindow("Stack");
close();

print("nImages: "+nImages);
print("title: "+getTitle);
print("stack size: "+nSlices);


//Creating three pictures
newImage("1", "8-bit White", 500, 500, 1);
newImage("2", "8-bit White", 500, 500, 1);
newImage("3", "8-bit White", 500, 500, 1);

//    ---> Impossible to make this stack  <---
run("Images to Stack"); //   <--