question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Shapes data does not conform to LayerDataProtocol

See original GitHub issue

🐛 Bug

Since Shapes is a Layer, its data should fulfill LayerDataProtocol. However, (some) internal ways of populating this don’t preserve the required properties

To Reproduce

Steps to reproduce the behavior:

Run the test:

def test_data_protocol():
    shp = Shapes()
    # Add 2-D ellipse
    data = np.ones((2, 2))
    data[:, 0] = [20, 20] # Center
    data[:, 1] = [10, 10] # Axes
    shp.add_ellipses(data)
    # Check for properties
    assert hasattr(shp.data, 'dtype')
    assert hasattr(shp.data, 'shape')

Expected behavior

I would expect that shp.data would have the shape and dtype properties.

Environment

  • Please copy and paste the information at napari info option in help menubar here:
napari: 0.4.13
Platform: Linux-5.13.0-28-generic-x86_64-with-glibc2.31
System: Ubuntu 20.04.3 LTS
Python: 3.9.10 | packaged by conda-forge | (main, Feb 1 2022, 21:24:11) [GCC 9.4.0]
Qt: 5.12.9
PyQt5: 5.12.3
NumPy: 1.20.3
SciPy: 1.7.3
Dask: 2022.01.1
VisPy: 0.9.4

OpenGL:
- GL version: 4.6 (Compatibility Profile) Mesa 21.0.3
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 2560x1440, scale 1.0
- screen 2: resolution 1920x1080, scale 1.0

Plugins:
- Labeling: 0.1.dev9+g4bf5a30
- console: 0.0.4
- scikit-image: 0.4.13
- svg: 0.1.5

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
gselzercommented, Feb 16, 2022

What do you think of changing the current Shapes.data object then to Shapes.shapeData, and adding throwing an clear NotImplementedError in the Shapes.data getter and setter? That seems preferrable to getting an error saying that the data just doesn’t have these attributes.

While I can understand this - it would be a big breaking change to take away layer.data from shapes, everyone using the layer would have to change.

That’s a great point, yeah. For that reason, we probably shouldn’t do this.

1reaction
tlambert03commented, Feb 16, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tensorflow target shape not matching - how to properly format ...
I'm trying to build NLP classifier, data consists of 2 columns, ... but when running the model.fit() method shapes do not match.
Read more >
The OSI Model – The Layers That Shape Connections
The OSI model is a framework to help engineers develop Internet protocols. Get all the insights of the different layers and understand how ......
Read more >
MGLShapeSource Class Reference - Mapbox docs
MGLShapeSource is a map content source that supplies vector shapes to be shown on the map. The shapes may be instances of MGLShape...
Read more >
OSI Model: The 7 Layers of Network Architecture
The OSI Model is a 7-layer framework for network architecture that doesn't have to be complicated. We break it all down for you...
Read more >
Quizzes Flashcards - Quizlet
Forward and routing are not in the transport layer they are in the network ... they need to signal the end of sending...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found