diff --git a/src/segment_embryo/_sample_data.py b/src/segment_embryo/_sample_data.py index 4482b89..19fdb7d 100644 --- a/src/segment_embryo/_sample_data.py +++ b/src/segment_embryo/_sample_data.py @@ -20,26 +20,33 @@ def make_sample_data(): # Check the documentation for more information about the # add_image_kwargs # https://napari.org/stable/api/napari.Viewer.html#napari.Viewer.add_image - scale = (1000, 76.0005, 76.0005 ) + scale = (1, 1000, 76.0005, 76.0005) + units = ('pixel', 'nm', 'nm', 'nm') nucleiData = io.imread('https://dev.mri.cnrs.fr/attachments/download/3597/C1-240628_DAPI_MEMBRITE-546_EPHA-488_TBXT-594_OTX-647_SLOWFADE_2.tif') - nuclei = numpy.array(nucleiData) + nuclei = numpy.array([numpy.array(nucleiData)]) spotsData = io.imread('https://dev.mri.cnrs.fr/attachments/download/3595/C4-240628_DAPI_MEMBRITE-546_EPHA-488_TBXT-594_OTX-647_SLOWFADE_2.tif') - spots = numpy.array(spotsData) + spots = numpy.array([numpy.array(spotsData)]) membranesData = io.imread('https://dev.mri.cnrs.fr/attachments/download/3596/C5-240628_DAPI_MEMBRITE-546_EPHA-488_TBXT-594_OTX-647_SLOWFADE_2.tif') - membranes = numpy.array(membranesData) + membranes = numpy.array([numpy.array(membranesData)]) return [(nuclei, {'scale': scale, - 'units': ('nm', 'nm', 'nm'), + 'units': units, + 'colormap': 'bop blue', + 'blending': "additive", 'name': 'nuclei (segment-embryo example image)'}), (spots, {'scale': scale, - 'units': ('nm', 'nm', 'nm'), + 'units': units, + 'colormap': 'red', + 'blending': "additive", 'name': 'spots (segment-embryo example image)'}, ), (membranes, {'scale': scale, - 'units': ('nm', 'nm', 'nm'), + 'units': units, + 'colormap': 'bop orange', + 'blending': "additive", 'name': 'membranes (segment-embryo example image)'}, ) ] diff --git a/src/segment_embryo/_widget.py b/src/segment_embryo/_widget.py index 862a301..cb3a15d 100644 --- a/src/segment_embryo/_widget.py +++ b/src/segment_embryo/_widget.py @@ -1,5 +1,7 @@ import time from typing import TYPE_CHECKING + +import numpy as np from PyQt5.QtWidgets import QGroupBox, QFormLayout, QVBoxLayout from qtpy.QtWidgets import QHBoxLayout, QPushButton, QWidget from segment_embryo.napari_util import NapariUtil @@ -91,10 +93,11 @@ def updateLayerSelectionComboBoxes(self): def _new_segmentation(self, mask): membranesLayerName = self.membranesLayerCombo.currentText() name = "Labels of " + membranesLayerName - self.viewer.add_labels(mask, name=name) - self.viewer.layers[name].scale = self.viewer.layers[membranesLayerName].scale[-3: ] + maskImage = np.array([mask]) + self.viewer.add_labels(maskImage, name=name) + self.viewer.layers[name].scale = self.viewer.layers[membranesLayerName].scale[-4: ] self.viewer.layers[name].translate = self.viewer.layers[membranesLayerName].translate[-3: ] - self.viewer.layers[name].units = self.viewer.layers[membranesLayerName].units[-3: ] + self.viewer.layers[name].units = self.viewer.layers[membranesLayerName].units[-4: ] self.progressThread.stop()