Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Save cell center points in _seg.py

Aperta
#496 7 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@mrariden ci sta già lavorando.

Dal 9/5/2023.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

enhancement

I was wondering if it would be possible to save more metadata about cells.

I am in need of cell center points for downstream computation and they are already calculated as far as I can understand.

Current workaround

Right now I am trying to do something based on a modification of masks_to_flows_cpu()

# From CellPose docs
dat = np.load('_seg.npy', allow_pickle=True).item()

# Assuming (hoping) this loads the correct information
masks = dat['masks']
centers = calculate_centers(masks)

# Modified from masks_to_flow_cpu()
def calculate_centers(masks):
    slices = scipy.ndimage.find_objects(masks)
    # Initiate centers in appropriate format
    for i,si in enumerate(slices):
        if si is not None:
            sr,sc = si
            y,x = np.nonzero(masks[sr, sc] == (i+1))
            y = y.astype(np.int32) + 1
            x = x.astype(np.int32) + 1
            ymed = np.median(y)
            xmed = np.median(x)
            center = (ymed, xmed)
            # Append center to centers
    return centers

Actual question

Would it be possible to save this in the output _seg.py files and load it into dat['centers']? Or possibly include a function for like calculate_centers()?

Lingua principale
Python
Stelle
2.4k
Fork
651
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MouseLand/cellpose

Tutte le issue di MouseLand/cellpose

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.