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. 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 |
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 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thank you for the quick fix!
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 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |