diff --git a/examples/LabelMap.ipynb b/examples/LabelMap.ipynb index b4de6492..c943d4f8 100644 --- a/examples/LabelMap.ipynb +++ b/examples/LabelMap.ipynb @@ -2,18 +2,9 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: itk-io in /home/matt/bin/miniconda3/envs/itkwidgets/lib/python3.7/site-packages (5.1.0.post1)\r\n", - "Requirement already satisfied: itk-core==5.1.0.post1 in /home/matt/bin/miniconda3/envs/itkwidgets/lib/python3.7/site-packages (from itk-io) (5.1.0.post1)\r\n" - ] - } - ], + "outputs": [], "source": [ "# Install dependencies for this example\n", "# Note: This does not include itkwidgets, itself\n", @@ -23,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 37, "metadata": {}, "outputs": [], "source": [ @@ -31,6 +22,7 @@ "import os\n", "\n", "import itk\n", + "import numpy as np\n", "\n", "from itkwidgets import view\n", "import itkwidgets" @@ -38,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 41, "metadata": {}, "outputs": [], "source": [ @@ -55,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 42, "metadata": {}, "outputs": [], "source": [ @@ -65,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 43, "metadata": { "scrolled": true }, @@ -73,7 +65,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "37dcf1f9c89b4f9c8e7ab039d3f38dde", + "model_id": "a588b530f15c4d3ba2b1b13a04b8d6f5", "version_major": 2, "version_minor": 0 }, @@ -98,20 +90,16 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ - "names = [(0, 'Background'), (1, 'First cell'), (2, 'Second cell')]\n", - "viewer.label_map_names = names" + "label_count = len(np.unique(itk.array_view_from_image(label_map)))\n", + "label_weights = np.ones((label_count,), dtype=np.float32)\n", + "label_weights[1] = 0.1\n", + "label_weights[2] = 0.2\n", + "viewer.label_map_weights = label_weights" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {