Add z-stack to yet unexisting hyperstack

Hi all,

Because I cannot read the docs on the site, I put a question over here …

I generate a three dimension stack (x,y,z) in a loop. The loop cycles over frame nrs.

After each cycle I want to add the x,y,z stack to a x,y,z,t stack. This doesn’t exist yet.

What IJM code do I have to use for creation of the hyperstack and then adding each xyz stack to it when it becomes available?

I already tried to use some commands from the menu and use Macros / Record, without success.


1 Like

Hi @Fred_ckx,

I think the Concatenate menu is what you’re looking for:

newImage("Untitled", "8-bit black", 10, 10, 10);
newImage("Untitled1", "8-bit black", 10, 10, 10);
run("Concatenate...", "open image1=Untitled image2=Untitled1");

Let us know if this solves your problem!


1 Like

Thanks @haesleinhuepf

I’ll try something like this. Let you know it it works…

probsStack_avail = false; //in first cycle probsStack is not yet available
for (f=0; f < frames; f++){ 

    ...GPU processing over here...
    ... in the end a probsframe (xyz) is available

    Ext.CLIJ2_pull(probsframe); //pull frame from GPU
    if (!probsStack_avail) {  
    	//first cycle, probsStack not yet available
    	//probsStack to point at currently active probsframe , will be the first element of the stack
    	probsStack = getTitle(); 
    	probsStack_avail = true;
    else {
    	//probsStack was already defined, add the current probsframe to it
    	run("Concatenate...", "open image1="+probsStack +" image2="+probsframe); 	
    Ext.CLIJ2_release(probsframe); //remove probsframe from GPU, a copy is now in probsStack (is this correct?)

} //END of loop over frames

... use probsStack  (x,y,z,t) over here...