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.

Image metadata should be copied when creating a new layer

See original GitHub issue

Hi,

🚀 Feature

Existing metadata of an image should be copied when creating a new non-image layer. E.g. if an image has a certain voxel spacing defined in the metadata dict with the attribute spacing than a newly created labels layer should have the same voxel spacing.

Motivation

Some image formats such as nifti (.nii.gz) have important metadata information such as spacing, affine transform or axis orientation. This information needs to be the same for all non-image layers that correspond to that image. Otherwise this can lead to problems with other software when exporting the new layers.

Pitch

A new non-image layer should copy the metadata dict of an already existing image layer.

Best, Karol

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
jnicommented, Mar 6, 2022

Or is there some other way on how to achieve this with the current version of napari

Nothing seamless, but you can certainly make a plugin to do this, “copy metadata”

from magicgui import magic_factory
import napari

@magic_factory
def copy_meta(src: napari.layers.Layer, dst: napari.layers.Layer):
    for attr in ['scale', 'translate', 'rotation', 'skew', 'affine']:
        setattr(dst, attr, getattr(src, attr))

Then you can make a new layer, open the widget, and copy the attributes.

0reactions
tlambert03commented, Mar 5, 2022

I kind of need this 🙂

Any interest in opening a PR? We can certainly help out if you run into difficulty. Otherwise yes it’s still on the todo list, but waiting for someone to have time.

Thanks for the bump!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Add Metadata to Your Image Files - Artwork Archive
Image metadata can help protect digital images of your original artwork from being ... if the image is copied or exported to another...
Read more >
How to Add Metadata To Photos & Images - Pixsy
Metadata is information hidden inside photos that can be used to prove copyright. Learn how to add metadata to images with Pixsy.
Read more >
Copy or import metadata to an item—ArcGIS Pro
You can copy metadata content from another item. For example, you can copy metadata from one map to another, from a feature class...
Read more >
Photoshop metadata and notes - Adobe Support
You can add notes anywhere on your Photoshop image canvas. When you create a note, an icon appears on the image. Select the...
Read more >
Copying descriptions from feature layers to map im...
Copying descriptions from feature layers to map image layers with ArcGIS ... Feature Service metadata (service level, not item level) can be ...
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