Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Return layers from add_registered_image_layers
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jun 27, 2022
1 parent 1bd6a11 commit af19744
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions brainreg_napari/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pathlib
from collections import namedtuple
from enum import Enum
from typing import Dict, List
from typing import Dict, List, Tuple

import napari
from fancylog import fancylog
Expand All @@ -23,10 +23,17 @@

def add_registered_image_layers(
viewer: napari.Viewer, *, registration_directory: pathlib.Path
) -> None:
) -> Tuple[napari.layers.Image, napari.layers.Labels]:
"""
Read in saved registration data and add as layers to the
napari viewer.
Returns
-------
boundaries :
Registered boundaries.
labels :
Registered brain regions.
"""
layers: List[LayerDataTuple] = []

Expand All @@ -40,8 +47,9 @@ def add_registered_image_layers(
f"'brainreg.json' file not found in {registration_directory}"
)

for layer in layers:
viewer.add_layer(napari.layers.Layer.create(*layer))
boundaries = viewer.add_layer(napari.layers.Layer.create(*layers[0]))
labels = viewer.add_layer(napari.layers.Layer.create(*layers[1]))
return boundaries, labels


def get_layer_labels(widget):
Expand Down

0 comments on commit af19744

Please sign in to comment.