scverse / scverse/spatialdata

Shapes element parser should have an easy way to set the axes for the coordinates

Open
#146 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

I think it would be nice if there was an easy way to set the axis label for each coordinate when parsing a numpy array into a Shapes element. Currently, it defaults to xy.

Something like this (similar to image parser)

coordinates = np.array(
    [
        [10, 10],
        [20, 20],
        [50, 30],
        [90, 70],
        [20, 80]
    ]
)

circles = sd.ShapesModel.parse(coordinates, radius=radius, geometry=0, axes=("y", "x")

>>> circles.y
[10, 20, 50, 90, 20]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ShapesModel.parse entry point and compare its coordinate handling with the image parser. Check how the axes argument should map array columns to coordinate labels, then verify that parsing with axes=("y", "x") exposes the expected y values on the Shapes element.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.