stupid question: Why is imshow in io module?

I just stumbled over the 3 lines of code on scikits' title page: from skimage import data, io, filter image = data.coins() # or any NumPy array! edges = filter.sobel(image) io.imshow(edges) and wondered: Isn't it a bit funny to require an I/O module to show an image that is already loaded? My apologies if that has been discussed before. Michael

I would argue that showing an image is the 'out' part of I/O. On Mon, Nov 25, 2013 at 4:24 PM, Michael Aye <kmichael.aye@gmail.com> wrote:
I just stumbled over the 3 lines of code on scikits' title page:
from skimage import data, io, filter image = data.coins() # or any NumPy array! edges = filter.sobel(image) io.imshow(edges)
and wondered: Isn't it a bit funny to require an I/O module to show an image that is already loaded?
My apologies if that has been discussed before.
Michael
-- 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+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
-- Thomas A Caswell PhD Candidate University of Chicago Nagel and Gardel labs tcaswell@uchicago.edu jfi.uchicago.edu/~tcaswell o: 773.702.7204

Working with scikit image recently has changed my perception of images. While the visualization is what we normally take for granted as the image itself, scikit has made me appreciate that the canonical image datastructure is an ndarray. I too had wondered why imshow was in IO, but the more I use with this excellent library, the more I can appreciate this design choice. On Monday, November 25, 2013 5:24:18 PM UTC-5, Michael Aye wrote:
I just stumbled over the 3 lines of code on scikits' title page:
from skimage import data, io, filter image = data.coins() # or any NumPy array! edges = filter.sobel(image) io.imshow(edges)
and wondered: Isn't it a bit funny to require an I/O module to show an image that is already loaded?
My apologies if that has been discussed before.
Michael

To answer this question and potentially shine a bit more light on the issue: The example images shipped with the package and exposed by skimage.dataactually are shipped as raw files in that directory. Upon import of skimage.data, these convenience functions (e.g. skimage.data.lena()) are actually wrapping skimage.io.imread for the fixed, known local path to each image file and returning the result. Take a look<https://github.com/scikit-image/scikit-image/blob/master/skimage/data/__init__.py>at the __init__.py file for skimage.data to see what’s going on. So, the io module *is* required - we just handle that behind the scenes for these examples. Hope that helps someone, Josh On Monday, November 25, 2013 4:24:18 PM UTC-6, Michael Aye wrote: I just stumbled over the 3 lines of code on scikits' title page:
from skimage import data, io, filter image = data.coins() # or any NumPy array! edges = filter.sobel(image) io.imshow(edges)
and wondered: Isn't it a bit funny to require an I/O module to show an image that is already loaded?
My apologies if that has been discussed before.
Michael

@Josh, there's two issues here: whether the import io is wasteful (which, as you demonstrated, it isn't), and whether it makes sense to stick imshow under io, which is certainly not clear to me, despite the rationalisations posted to this thread. =P I would argue that we rename the "viewer" package to "view" and include a simple imshow in there *in addition to* the viewer. Juan. On Tue, Nov 26, 2013 at 10:45 AM, Josh Warner <silvertrumpet999@gmail.com>wrote:
To answer this question and potentially shine a bit more light on the issue:
The example images shipped with the package and exposed by skimage.dataactually are shipped as raw files in that directory. Upon import of skimage.data, these convenience functions (e.g. skimage.data.lena()) are actually wrapping skimage.io.imread for the fixed, known local path to each image file and returning the result.
Take a look<https://github.com/scikit-image/scikit-image/blob/master/skimage/data/__init__.py>at the __init__.py file for skimage.data to see what’s going on.
So, the io module *is* required - we just handle that behind the scenes for these examples.
Hope that helps someone, Josh
On Monday, November 25, 2013 4:24:18 PM UTC-6, Michael Aye wrote:
I just stumbled over the 3 lines of code on scikits' title page:
from skimage import data, io, filter image = data.coins() # or any NumPy array! edges = filter.sobel(image) io.imshow(edges)
and wondered: Isn't it a bit funny to require an I/O module to show an image that is already loaded?
My apologies if that has been discussed before.
Michael
--
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+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
participants (5)
-
Adam Hughes
-
Josh Warner
-
Juan Nunez-Iglesias
-
Michael Aye
-
Thomas A Caswell