Skip to content

Make image metadata immutable??? #1484

@David-Baddeley

Description

@David-Baddeley

It is currently possible to programatically modify the metadata of an open image in PYMEImage, recipes etc ... This violates the general "data is not mutable" (i.e. make a copy if you want to change it) paradigm of PYMEImage, recipes, etc ... and allows code such as that in #1483 to run without creating a visible error, but to nonetheless cause unpredictable upstream side-effects. So far metadata immutability has been enforced by loose convention, but this makes it hard for new contributors.

Metadata mutability can be very convenient for initial exploration when, e.g. examining data which was loaded with incorrect or missing metadata, but also has the potential to cause confusion - particularly for contributors, but also when, e.g. launching localisation analysis on data for which the metadata has been modified.

I'm not 100% sure that making it immutable is the right way to go, and it would require a change to the code in quite a few places where we create an image and then set it's metadata, but it would certainly make the programming interface more robust. One potential option is to make the .mdh attribute ImageStacks an immutable wrapper, another option would be to have a .mutable flag and a .finalise() method which left the metadata mutable for a while, before locking it e.g. just before the image was returned from a recipe module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions