Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Hello,
In February last year I submitted a bug report about min/max settings in virtual stacks which was fixed by Wayne, see the below post. I now found another case of what appears to be the same bug: If you duplicate a virtual stack, the min/max settings are lost if you duplicate the entire stack instead of just a subrange. Here is a macro that reproduces the problem: //open sample data, and save as separate images in a folder in order to make a virtual stack run("T1 Head (2.4M, 16-bits)"); File.makeDirectory("C:\\Users\\steinr\\temp\\T1-virtual-stack\\"); run("Image Sequence... ", "format=TIFF save=C:\\Users\\steinr\\temp\\T1-virtual-stack\\"); //close(); run("Image Sequence...", "open=C:\\Users\\steinr\\temp\\T1-virtual-stack\\ sort use"); setSlice(64); setMinAndMax(1, 300); //the brightness was increased because we say we are interested in the darker tissue //extract a substack of a sub-range using Duplicate selectWindow("T1-virtual-stack"); run("Duplicate...", "duplicate range=60-70"); rename("Duplicate range=60-70"); setSlice(nSlices/2); //the min/max setting was kept //extract a substack of the full sub-range using Duplicate selectWindow("T1-virtual-stack"); run("Duplicate...", "duplicate range=1-129"); rename("Duplicate range=1-129"); setSlice(nSlices/2); //the min/max setting was lost //extract a substack of a sub-range using Make Substack selectWindow("T1-virtual-stack"); run("Make Substack...", "slices=60-70"); rename("Substack slices=60-70"); setSlice(nSlices/2); //the min/max setting was kept //extract a substack of the full sub-range using Make Substack selectWindow("T1-virtual-stack"); run("Make Substack...", "slices=1-129"); rename("Substack slices=1-129"); setSlice(nSlices/2); //the min/max setting was kept run("Tile"); Stein -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband Sent: 16. februar 2017 20:32 To: [hidden email] Subject: Re: Min/max constrast values are lost when resampling virtual stacks On Feb 16, 2017, at 7:33 AM, Stein Rørvik <[hidden email]> wrote: > > This is a related issue to that described in my last post: > > When working with virtual stacks, any min/max constrast values that are set after opening the stack, are lost when rescaling or making a substack. Thanks to the very helpful test macro, this bug is fixed in the latest ImageJ daily build (1.51k10). -wayne > It does not occur with real stacks. rescaling or making a substack. This problem occurs both via then GUI and via macros. It does not occur with real stacks. I assume this is because when working with virtual stacks, if the min/max setting was not already saved in the original files, it is forgotten when the files are re-read from files during the rescale or substack operations. > > The reason this (minor) issue is an annoyance for me, is that in my case the virtual stack import is done by a macro that automatically sets the proper min/max values based on material data available in a metafile, so I need to relocate and re-set the proper min/max values whenever I want to scale or make a substack from a virtual stack when using the GUI. In a macro this is not a problem of course, as I then just need to use the getMinAndMax command. > > Anyway, the following macro reproduces the problem: > > //open sample data, and save as separate images in a folder in order > to make a virtual stack > run("T1 Head (2.4M, 16-bits)"); > run("Image Sequence... ", "format=TIFF > save=C:\\Users\\steinr\\T1-virtual-stack\\"); > close(); > > run("Image Sequence...", "open=C:\\Users\\steinr\\T1-virtual-stack\\ > sort use"); setSlice(64); > setMinAndMax(1, 300); //the brightness was increased because we say we are interested in the darker tissue > > //extract a substack > selectWindow("T1-virtual-stack"); > run("Make Substack...", " slices=60-70"); > setSlice(5); //same as original slice 64 > //the min/max setting was lost > > //resample the stack > selectWindow("T1-virtual-stack"); > run("Scale...", "x=.5 y=.5 z=.5 width=128 height=128 depth=64 > interpolation=Bilinear average process create > title=T1-virtual-stack-16bit-scaled"); > setSlice(32); > //the min/max setting was lost > > > //For comparison: When working with true stacks, the min/max constrast values are kept properly: > > run("T1 Head (2.4M, 16-bits)"); > setSlice(64); > setMinAndMax(1, 300); > > //extract a substack > selectWindow("t1-head.tif"); > run("Make Substack...", " slices=60-70"); > setSlice(5); //same as original slice 64 > //the min/max setting was kept > > //resample the stack > selectWindow("t1-head.tif"); > run("Scale...", "x=.5 y=.5 z=.5 width=128 height=128 depth=64 > interpolation=Bilinear average process create > title=T1-virtual-stack-16bit-scaled"); > setSlice(32); > //the min/max setting was kept > > run("Tile"); > > > > Stein > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
> On Jan 8, 2018, at 5:35 AM, Stein Rørvik <[hidden email]> wrote:
> > Hello, > In February last year I submitted a bug report about min/max settings in virtual stacks which was fixed by Wayne, see the below post. > > I now found another case of what appears to be the same bug: > If you duplicate a virtual stack, the min/max settings are lost if you duplicate the entire stack instead of just a subrange. Here is a macro that reproduces the problem: This bug is fixed in the latest ImageJ daily build (1.51u6). -wayne > //open sample data, and save as separate images in a folder in order to make a virtual stack > run("T1 Head (2.4M, 16-bits)"); > File.makeDirectory("C:\\Users\\steinr\\temp\\T1-virtual-stack\\"); > run("Image Sequence... ", "format=TIFF save=C:\\Users\\steinr\\temp\\T1-virtual-stack\\"); > //close(); > > run("Image Sequence...", "open=C:\\Users\\steinr\\temp\\T1-virtual-stack\\ sort use"); > setSlice(64); > setMinAndMax(1, 300); //the brightness was increased because we say we are interested in the darker tissue > > //extract a substack of a sub-range using Duplicate > selectWindow("T1-virtual-stack"); > run("Duplicate...", "duplicate range=60-70"); > rename("Duplicate range=60-70"); > setSlice(nSlices/2); > //the min/max setting was kept > > //extract a substack of the full sub-range using Duplicate > selectWindow("T1-virtual-stack"); > run("Duplicate...", "duplicate range=1-129"); > rename("Duplicate range=1-129"); > setSlice(nSlices/2); > //the min/max setting was lost > > //extract a substack of a sub-range using Make Substack > selectWindow("T1-virtual-stack"); > run("Make Substack...", "slices=60-70"); > rename("Substack slices=60-70"); > setSlice(nSlices/2); > //the min/max setting was kept > > //extract a substack of the full sub-range using Make Substack > selectWindow("T1-virtual-stack"); > run("Make Substack...", "slices=1-129"); > rename("Substack slices=1-129"); > setSlice(nSlices/2); > //the min/max setting was kept > > run("Tile"); > > Stein > > -----Original Message----- > From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband > Sent: 16. februar 2017 20:32 > To: [hidden email] > Subject: Re: Min/max constrast values are lost when resampling virtual stacks > > On Feb 16, 2017, at 7:33 AM, Stein Rørvik <[hidden email]> wrote: >> >> This is a related issue to that described in my last post: >> >> When working with virtual stacks, any min/max constrast values that are set after opening the stack, are lost when rescaling or making a substack. > > Thanks to the very helpful test macro, this bug is fixed in the latest ImageJ daily build (1.51k10). > > -wayne > > >> It does not occur with real stacks. rescaling or making a substack. This problem occurs both via then GUI and via macros. It does not occur with real stacks. I assume this is because when working with virtual stacks, if the min/max setting was not already saved in the original files, it is forgotten when the files are re-read from files during the rescale or substack operations. >> >> The reason this (minor) issue is an annoyance for me, is that in my case the virtual stack import is done by a macro that automatically sets the proper min/max values based on material data available in a metafile, so I need to relocate and re-set the proper min/max values whenever I want to scale or make a substack from a virtual stack when using the GUI. In a macro this is not a problem of course, as I then just need to use the getMinAndMax command. >> >> Anyway, the following macro reproduces the problem: >> >> //open sample data, and save as separate images in a folder in order >> to make a virtual stack >> run("T1 Head (2.4M, 16-bits)"); >> run("Image Sequence... ", "format=TIFF >> save=C:\\Users\\steinr\\T1-virtual-stack\\"); >> close(); >> >> run("Image Sequence...", "open=C:\\Users\\steinr\\T1-virtual-stack\\ >> sort use"); setSlice(64); >> setMinAndMax(1, 300); //the brightness was increased because we say we are interested in the darker tissue >> >> //extract a substack >> selectWindow("T1-virtual-stack"); >> run("Make Substack...", " slices=60-70"); >> setSlice(5); //same as original slice 64 >> //the min/max setting was lost >> >> //resample the stack >> selectWindow("T1-virtual-stack"); >> run("Scale...", "x=.5 y=.5 z=.5 width=128 height=128 depth=64 >> interpolation=Bilinear average process create >> title=T1-virtual-stack-16bit-scaled"); >> setSlice(32); >> //the min/max setting was lost >> >> >> //For comparison: When working with true stacks, the min/max constrast values are kept properly: >> >> run("T1 Head (2.4M, 16-bits)"); >> setSlice(64); >> setMinAndMax(1, 300); >> >> //extract a substack >> selectWindow("t1-head.tif"); >> run("Make Substack...", " slices=60-70"); >> setSlice(5); //same as original slice 64 >> //the min/max setting was kept >> >> //resample the stack >> selectWindow("t1-head.tif"); >> run("Scale...", "x=.5 y=.5 z=.5 width=128 height=128 depth=64 >> interpolation=Bilinear average process create >> title=T1-virtual-stack-16bit-scaled"); >> setSlice(32); >> //the min/max setting was kept >> >> run("Tile"); >> >> >> >> Stein ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |