Skip to content

Default skeleton attributes cannot be turned off and interfere with manual attributes #2

@ceesem

Description

@ceesem

Skeletons have two default attribute values that are hard-coded: radius and vertex_types. If you initialize a skeleton with either of those values set to None, these attributes are created and set to default values. However, if you then try to add an attribute with the same name, for example radius, through add_vertex_attributes it will silently fail because of

if not hasattr(self, name):

This is causing a problem where we are trying to write generic code to add attributes to skeleton files. Our code had previously started with a skeleton with vertices and edges but no attributes, then adds attributes from a dictionary via add_vertex_attributes. In this case, one of the attributes happened to be called "radius". This radius data then failed to be added, even though the existing data was null and we had not intended to create this attribute previously. This creates a situation where it is awkward to use "radius" (or "vertex_types") in any situation other than where you are using exactly default attributes.

I guess one potential solution could be to include a default_attributes boolean parameter that could turn off these values for full control, but it seems more natural to simply not generate properties that are not asked for explicitly in such low-level code.

As an aside, the parameter name radii is a bit funky considering the attribute gets called radius.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions