From df4869f629c550ccc1de6487c251db84104179e9 Mon Sep 17 00:00:00 2001 From: Marc Siggel <11818778+MSiggel@users.noreply.github.com> Date: Wed, 1 Nov 2023 14:20:44 +0100 Subject: [PATCH] cleaned colabseg notebook --- colabseg.ipynb | 1077 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1077 insertions(+) create mode 100644 colabseg.ipynb diff --git a/colabseg.ipynb b/colabseg.ipynb new file mode 100644 index 0000000..7e69cc8 --- /dev/null +++ b/colabseg.ipynb @@ -0,0 +1,1077 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "356d32a5", + "metadata": {}, + "source": [ + "# ColabSeg: Interactive Membrane Segmentation and Analysis" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "418cb9e9", + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "from colabseg.tensorvoting_wrapper import *\n", + "from colabseg.segmentation_gui import *" + ] + }, + { + "cell_type": "markdown", + "id": "d71e56de", + "metadata": {}, + "source": [ + "# 1) Tensor Voting\n", + "\n", + "This GUI makes use of the TomoSegMemTV tool.
\n", + "Please download the tool at and add it to the TV path:
\n", + "https://sites.google.com/site/3demimageprocessing/tomosegmemtv
\n", + "**If you use this please Cite:**
\n", + "**Martinez-Sanchez, A.; Garcia, I.; Asano, S.; Lucic, V.; Fernandez, J.-J.
\n", + "Robust Membrane Detection Based on Tensor Voting for Electron Tomography
\n", + "J. Struct. Biol. 2014, 186 (1), 49–61. https://doi.org/10.1016/j.jsb.2014.02.015**" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "f0794f4f", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "8cb42c8f3e1b46149c64d732566ff21a", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "VBox(children=(Text(value='', description='TV Path:', placeholder='PATH/TO/TOMOSEG', style=DescriptionStyle(de…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "ccf039f3b3e14fc5b3e65d3cb0ae74c5", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Button(description='Run TV Pipeline', style=ButtonStyle())" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0cc5db98f21b4882833d1b8119a4ceb3", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Button(description='Set optmized default', style=ButtonStyle())" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "generate_tensor_voting_gui()" + ] + }, + { + "cell_type": "markdown", + "id": "aff76c6f", + "metadata": {}, + "source": [ + "# 2) Load Segmented MRC and Convert to Point Cloud" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "14faa576", + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "81b660d66af64b0c8fb605faa720b990", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "HBox(children=(Text(value='test_file.mrc', description='Input Filename:', placeholder='mrc or h5 file', style=…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui = JupyterFramework()\n", + "gui.gui_elements_loading()" + ] + }, + { + "cell_type": "markdown", + "id": "8e3b1d9f", + "metadata": {}, + "source": [ + "# 3) Visualize & Edit Segmentation 3D" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "d50cf6b8", + "metadata": { + "scrolled": false + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Tab(children=(HBox(children=(SelectMultiple(description='Clusters:', options=(0,), rows=10, value=()), VBox(ch…" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/3dmoljs_load.v0": "", + "text/html": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "application/3dmoljs_load.v0": "
\n

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n jupyter labextension install jupyterlab_3dmol

\n
\n", + "text/html": [ + "
\n", + "

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
\n", + " jupyter labextension install jupyterlab_3dmol

\n", + "
\n", + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "gui.boot_gui()" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "seg_test", + "language": "python", + "name": "seg_test" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.8.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}