Napari: singleton dimensions are a problem

Created on 17 Jan 2020  路  3Comments  路  Source: napari/napari

馃悰 Bug

Was working in napari with someone yesterday and one of their images revealed an issue with napari's handling of singleton dimensions:

import napari, numpy

with napari.gui_qt():
    napari.view_image(numpy.random.rand(10,1,10,10))

Screen Shot 2020-01-17 at 8 56 50 AM

(see dimensions sliders 馃枙)
this would be solved visually easily enough by adding np.squeeze somewhere in magic_imread, but i'm not sure that's necessarily what we want to do here. perhaps dealing with them in the dims model is more appropriate? If anyone has a preference on how to tackle this, I'm happy to submit a PR

bug

All 3 comments

That must have crept back in there when adding labels / play buttons as we've had that issue a while back - see #409. I think there the approach was to not call squeeze, but to just change the display logic in the qt_dims, and I lean to still taking that approach here - i.e. if someone has 5D data with a singleton dim I shouldn't convert that to 4D data, I should just know not to show them a slider they don't need, and the sliders should still be numbered by default according to the original dims.

How does that sound @tlambert03? It would be great if you can fix / add better tests / see what the current tests we have (if any) for singletons are doing now

sounds good. will take a look

@tlambert03 I am working on a fix for this now, will make a PR soon. hope that's ok

Was this page helpful?
0 / 5 - 0 ratings

Related issues

royerloic picture royerloic  路  3Comments

kevinyamauchi picture kevinyamauchi  路  4Comments

tlambert03 picture tlambert03  路  3Comments

jni picture jni  路  3Comments

tlambert03 picture tlambert03  路  3Comments