Login  Register

Re: an odd image ID problem

Posted by Herbie on Oct 05, 2017; 3:43pm
URL: http://imagej.273.s1.nabble.com/an-odd-image-ID-problem-tp5019502p5019504.html

Good day Jeremy,

I hope you are aware of the fact that you create a total of three stacks:
"OriginalStack"
"NewOriginalStack"
"NewOriginalStack-1"

Make sure, the latter two don't get confused...

BTW:
after1ID=afterStacktoIm3ID+2;// 2nd image from stack
should read
after1ID=afterStacktoIm3ID+2;// 1st image from stack

Furthermore, I don't think it is a good idea to compute with image IDs.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 05.10.17 um 10:06 schrieb Jeremy Adler:

>
> A small problem with the IDs of images or maybe my assumption that the last created image is the current image.
>
> The macro code creates a stack of 3 images then splits the stack.
> The IDs of the 3 daughter images are obtained by finding the ID of the top image (3rd and last image in the stack).
> This is  as it should be.
>
> But (second block of code) when I duplicate the stack before splitting the stack, the duplicate stack gets the expected ID.
> But after splitting the stack the IDs of the daughter images are reported incorrectly.
> The problem seems to be that although the final 3rd image in the stack is still the top image, when I check the current ID and title are those of the original stack.
>
> What am I missing ?
>
> run("Close All");
> print("\\Clear");
>
> newImage("OriginalStack", "32-bit ramp", 64, 32, 3);
> origStackID=getImageID();print("origStackID ",origStackID);
> run("Stack to Images");
> print("   stack-images");
> afterStacktoIm3ID=getImageID();// current image
> currentTitle=getTitle();print("after stack-images: current Title: ",currentTitle," ID ",afterStacktoIm3ID);
> after2ID=afterStacktoIm3ID+1;// 2nd image from stack
> after1ID=afterStacktoIm3ID+2;// 2nd image from stack/
> print("IDs  orig ",origStackID," after stack-images ",afterStacktoIm3ID,after2ID,after1ID);
> selectImage(after2ID);
>
> print(" ");
> print("      repeat but include image duplication");
> newImage("NewOriginalStack", "32-bit ramp", 64, 32, 3);
> NeworigStackID=getImageID();print("NeworigStackID ",NeworigStackID);
> run("Duplicate...", "duplicate");
> DupImageID=getImageID();
> print("ID of  duplicate ",DupImageID);
> run("Stack to Images");
> print("   stack-images");
> afterStacktoIm3ID=getImageID();// current image
> currentTitle=getTitle();print("after stack-images: current Title: ",currentTitle," currentID ",afterStacktoIm3ID);
> after2ID=afterStacktoIm3ID+1;// 2nd image from stack
> after1ID=afterStacktoIm3ID+2;// 2nd image from stack/
> print("IDs  orig ",origStackID," after stack-images ",afterStacktoIm3ID,after2ID,after1ID);
> selectImage(after2ID);
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html