Dynamic intensity scaling for CollectionViewer

19 views
Skip to first unread message

Ferdinand Greiss

unread,
Mar 23, 2015, 1:17:02 PM3/23/15
to scikit...@googlegroups.com, MST Dude
Hallo,

Thanks for your amazing project on image processing.

I was wondering whether it would be straight forward to implement automatic rescaling of intensity (or y axis on LineProfile widget) in order to account for bleaching in image sequences. Otherwise the line plot will vanish below the pre-computed value of the first image and I won't be able to see much after the first few images.

Thanks for any help or/and suggestions.
Ferdinand

Stéfan van der Walt

unread,
Mar 23, 2015, 6:57:11 PM3/23/15
to scikit-image
Hi Ferdinand

On Mon, Mar 23, 2015 at 8:15 AM, Ferdinand Greiss
<ferdinan...@gmail.com> wrote:
> I was wondering whether it would be straight forward to implement automatic
> rescaling of intensity (or y axis on LineProfile widget) in order to account
> for bleaching in image sequences. Otherwise the line plot will vanish below
> the pre-computed value of the first image and I won't be able to see much
> after the first few images.

I think that should be pretty simple. Can you share a code snippet of
how you are using it currently?

Stéfan

Steven Silvester

unread,
Mar 23, 2015, 8:42:29 PM3/23/15
to scikit...@googlegroups.com, Ferdinan...@physik.lmu.de

Ferdinand,

You could pass all of the images through skimage.exposure.rescale_intensity prior to adding them to the ImageCollection. See also http://fiji.sc/Bleach_Correction for a list of other pre-processing ideas.

Regards,

Steve

Ferdinand Greiss

unread,
Mar 24, 2015, 5:17:03 AM3/24/15
to scikit...@googlegroups.com

from skimage.viewer import CollectionViewer

from skimage.viewer.plugins.lineprofile import LineProfile

import numpy as np


stack = np.random.randn(100, 50, 50)

stack *= np.exp(-0.1*np.arange(stack.shape[0]))[:, np.newaxis, np.newaxis]


viewer = CollectionViewer(stack)

viewer += LineProfile()


viewer.show()


I actually did change the source code of tifffile.py written by Christoph Gohlke on line 4660 to include rescaling for min and max of current image in image stack (by pressing r). But it'd be nice to still be able to use your plugins...


Thanks for your prompt answer...

Ferdinand

Thomas Caswell

unread,
Mar 24, 2015, 11:30:18 AM3/24/15
to scikit...@googlegroups.com
I strongly suggest finding a solution that does not involve changing tifffile.py.  Managing those sort of changes will very quickly become unsustainable.

Tom

--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stéfan van der Walt

unread,
Mar 24, 2015, 4:43:51 PM3/24/15
to scikit-image
Hi Ferdinand

On Tue, Mar 24, 2015 at 2:09 AM, Ferdinand Greiss
<ferdinan...@gmail.com> wrote:
> stack = np.random.randn(100, 50, 50)
> stack *= np.exp(-0.1*np.arange(stack.shape[0]))[:, np.newaxis, np.newaxis]

When you construct your stack, you can simple run
``skimage.exposure.rescale_intensity`` on each image as Steven
suggested. If you want that to happen automatically, you can even
specify a loading function in ``skimage.io.ImageCollection``, as the
``load_func`` parameter. Otherwise, simply load the collection and
iterate over it.

Regards
Stéfan
Reply all
Reply to author
Forward
0 new messages