|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Installation" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "code", |
| 12 | + "execution_count": 3, |
| 13 | + "metadata": {}, |
| 14 | + "outputs": [ |
| 15 | + { |
| 16 | + "name": "stdout", |
| 17 | + "output_type": "stream", |
| 18 | + "text": [ |
| 19 | + "Obtaining file:///Users/sachaichbiah/Documents/PHD/Gitlab/pip_libraries/foambryo\n", |
| 20 | + " Installing build dependencies ... \u001b[?25ldone\n", |
| 21 | + "\u001b[?25h Checking if build backend supports build_editable ... \u001b[?25ldone\n", |
| 22 | + "\u001b[?25h Getting requirements to build editable ... \u001b[?25ldone\n", |
| 23 | + "\u001b[?25h Installing backend dependencies ... \u001b[?25ldone\n", |
| 24 | + "\u001b[?25h Preparing editable metadata (pyproject.toml) ... \u001b[?25ldone\n", |
| 25 | + "\u001b[?25hRequirement already satisfied: networkx>=2.5.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from foambryo==0.2.3) (2.5.1)\n", |
| 26 | + "Requirement already satisfied: delaunay-watershed-3d>=0.2.0 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from foambryo==0.2.3) (0.2.4)\n", |
| 27 | + "Requirement already satisfied: matplotlib>=3.3.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from foambryo==0.2.3) (3.3.1)\n", |
| 28 | + "Requirement already satisfied: scipy>=1.4.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from foambryo==0.2.3) (1.5.4)\n", |
| 29 | + "Requirement already satisfied: numpy>=1.21.6 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from foambryo==0.2.3) (1.23.5)\n", |
| 30 | + "Requirement already satisfied: polyscope>=1.2.0 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from foambryo==0.2.3) (1.2.0)\n", |
| 31 | + "Requirement already satisfied: robust-laplacian>=0.2.2 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (0.2.2)\n", |
| 32 | + "Requirement already satisfied: edt>=2.2.0 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (2.2.0)\n", |
| 33 | + "Requirement already satisfied: scikit-image>=0.18.3 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (0.19.3)\n", |
| 34 | + "Requirement already satisfied: trimesh>=3.8.12 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (3.10.2)\n", |
| 35 | + "Requirement already satisfied: torch>=1.6.0 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (2.0.0)\n", |
| 36 | + "Requirement already satisfied: kiwisolver>=1.0.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.3.1->foambryo==0.2.3) (1.2.0)\n", |
| 37 | + "Requirement already satisfied: certifi>=2020.06.20 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.3.1->foambryo==0.2.3) (2020.6.20)\n", |
| 38 | + "Requirement already satisfied: cycler>=0.10 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.3.1->foambryo==0.2.3) (0.10.0)\n", |
| 39 | + "Requirement already satisfied: pillow>=6.2.0 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.3.1->foambryo==0.2.3) (9.1.1)\n", |
| 40 | + "Requirement already satisfied: python-dateutil>=2.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.3.1->foambryo==0.2.3) (2.8.1)\n", |
| 41 | + "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.3.1->foambryo==0.2.3) (2.4.7)\n", |
| 42 | + "Requirement already satisfied: decorator<5,>=4.3 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from networkx>=2.5.1->foambryo==0.2.3) (4.4.2)\n", |
| 43 | + "Requirement already satisfied: six in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from cycler>=0.10->matplotlib>=3.3.1->foambryo==0.2.3) (1.16.0)\n", |
| 44 | + "Requirement already satisfied: PyWavelets>=1.1.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from scikit-image>=0.18.3->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (1.1.1)\n", |
| 45 | + "Requirement already satisfied: packaging>=20.0 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from scikit-image>=0.18.3->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (23.0)\n", |
| 46 | + "Requirement already satisfied: tifffile>=2019.7.26 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from scikit-image>=0.18.3->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (2020.9.3)\n", |
| 47 | + "Requirement already satisfied: imageio>=2.4.1 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from scikit-image>=0.18.3->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (2.24.0)\n", |
| 48 | + "Requirement already satisfied: jinja2 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from torch>=1.6.0->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (2.11.2)\n", |
| 49 | + "Requirement already satisfied: typing-extensions in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from torch>=1.6.0->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (4.2.0)\n", |
| 50 | + "Requirement already satisfied: sympy in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from torch>=1.6.0->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (1.6.2)\n", |
| 51 | + "Requirement already satisfied: filelock in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from torch>=1.6.0->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (3.9.0)\n", |
| 52 | + "Requirement already satisfied: MarkupSafe>=0.23 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from jinja2->torch>=1.6.0->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (1.1.1)\n", |
| 53 | + "Requirement already satisfied: mpmath>=0.19 in /Users/sachaichbiah/opt/anaconda3/lib/python3.8/site-packages (from sympy->torch>=1.6.0->delaunay-watershed-3d>=0.2.0->foambryo==0.2.3) (1.1.0)\n", |
| 54 | + "Building wheels for collected packages: foambryo\n", |
| 55 | + " Building editable for foambryo (pyproject.toml) ... \u001b[?25ldone\n", |
| 56 | + "\u001b[?25h Created wheel for foambryo: filename=foambryo-0.2.3-0.editable-py3-none-any.whl size=4703 sha256=55c6cfda93c44e583f1972e2f5afed258668596a0f9efdeba735d18a1c2130a7\n", |
| 57 | + " Stored in directory: /private/var/folders/sc/xm26bhbx7qz8snv1wfmntd800000gq/T/pip-ephem-wheel-cache-ob4d4eit/wheels/7d/69/25/1052cfe7d1e42cda8049079c771544bb68d3ba5e74b84e4302\n", |
| 58 | + "Successfully built foambryo\n", |
| 59 | + "Installing collected packages: foambryo\n", |
| 60 | + " Attempting uninstall: foambryo\n", |
| 61 | + " Found existing installation: foambryo 0.2.3\n", |
| 62 | + " Uninstalling foambryo-0.2.3:\n", |
| 63 | + " Successfully uninstalled foambryo-0.2.3\n", |
| 64 | + "Successfully installed foambryo-0.2.3\n", |
| 65 | + "\n", |
| 66 | + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.1.1\u001b[0m\n", |
| 67 | + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" |
| 68 | + ] |
| 69 | + } |
| 70 | + ], |
| 71 | + "source": [ |
| 72 | + "! cd ../ && pip install -e ." |
| 73 | + ] |
| 74 | + }, |
| 75 | + { |
| 76 | + "cell_type": "markdown", |
| 77 | + "metadata": {}, |
| 78 | + "source": [ |
| 79 | + "# Force Inference from instance segmentation masks" |
| 80 | + ] |
| 81 | + }, |
| 82 | + { |
| 83 | + "cell_type": "code", |
| 84 | + "execution_count": 1, |
| 85 | + "metadata": {}, |
| 86 | + "outputs": [ |
| 87 | + { |
| 88 | + "name": "stdout", |
| 89 | + "output_type": "stream", |
| 90 | + "text": [ |
| 91 | + "Mode == Skimage\n", |
| 92 | + "min_distance = 3\n", |
| 93 | + "Computing EDT ...\n", |
| 94 | + "EDT computed in 0.9\n", |
| 95 | + "Searching local extremas ...\n", |
| 96 | + "Number of local minimas : 1713\n", |
| 97 | + "Number of local maxes : 153\n", |
| 98 | + "Local minimas computed in 0.47\n", |
| 99 | + "Starting triangulation..\n", |
| 100 | + "Triangulation build in 0.03\n", |
| 101 | + "Graph build in 0.396\n", |
| 102 | + "Watershed done in 0.217\n" |
| 103 | + ] |
| 104 | + } |
| 105 | + ], |
| 106 | + "source": [ |
| 107 | + "from dw3d import geometry_reconstruction_3d,DCEL_Data\n", |
| 108 | + "import skimage.io as io \n", |
| 109 | + "\n", |
| 110 | + "def make_idx(n): \n", |
| 111 | + " return((\"000\"+str(n))[-3:])\n", |
| 112 | + "i = 2 \n", |
| 113 | + "dist = 3\n", |
| 114 | + "\n", |
| 115 | + "image_path = \"../data/Segmentations/Benchmark_labels.tif\"\n", |
| 116 | + "image = io.imread(image_path)\n", |
| 117 | + "DW = geometry_reconstruction_3d(image,min_dist = dist, expansion_labels =0,mode='skimage',print_info=True) #Prefer mode='torch' if possible\n", |
| 118 | + "#viewer = DW.plot_in_napari()\n", |
| 119 | + "Mesh = DW.return_dcel()" |
| 120 | + ] |
| 121 | + }, |
| 122 | + { |
| 123 | + "cell_type": "code", |
| 124 | + "execution_count": 2, |
| 125 | + "metadata": {}, |
| 126 | + "outputs": [ |
| 127 | + { |
| 128 | + "name": "stderr", |
| 129 | + "output_type": "stream", |
| 130 | + "text": [ |
| 131 | + "100%|██████████| 18/18 [00:00<00:00, 36.47it/s]\n", |
| 132 | + "100%|██████████| 7/7 [00:00<00:00, 20.35it/s]\n", |
| 133 | + "/Users/sachaichbiah/Documents/PHD/Gitlab/pip_libraries/delaunay-watershed/src/dw3d/Curvature.py:322: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.\n", |
| 134 | + "To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.\n", |
| 135 | + " C, residules, rank, singval = np.linalg.lstsq(A,f)\n" |
| 136 | + ] |
| 137 | + }, |
| 138 | + { |
| 139 | + "name": "stdout", |
| 140 | + "output_type": "stream", |
| 141 | + "text": [ |
| 142 | + "Extremas of the Surface Tensions plotted : 0.5754080134914639 1.5034684011484374\n", |
| 143 | + "Extremas of pressures plotted: 0 0.051650413680045915\n" |
| 144 | + ] |
| 145 | + } |
| 146 | + ], |
| 147 | + "source": [ |
| 148 | + "from foambryo import plot_force_inference\n", |
| 149 | + "plot_force_inference(Mesh)" |
| 150 | + ] |
| 151 | + }, |
| 152 | + { |
| 153 | + "cell_type": "markdown", |
| 154 | + "metadata": {}, |
| 155 | + "source": [ |
| 156 | + "# Force inference from a pre-existing multimaterial mesh" |
| 157 | + ] |
| 158 | + }, |
| 159 | + { |
| 160 | + "cell_type": "code", |
| 161 | + "execution_count": 4, |
| 162 | + "metadata": {}, |
| 163 | + "outputs": [ |
| 164 | + { |
| 165 | + "name": "stdout", |
| 166 | + "output_type": "stream", |
| 167 | + "text": [ |
| 168 | + "Extremas of the Surface Tensions plotted : 0.5377606393017359 1.5579975593845785\n" |
| 169 | + ] |
| 170 | + } |
| 171 | + ], |
| 172 | + "source": [ |
| 173 | + "from foambryo import plot_tension_inference,plot_valid_junctions,plot_residual_junctions, plot_force_inference\n", |
| 174 | + "from dw3d import open_mesh_multitracker,DCEL_Data\n", |
| 175 | + "v,f, _ = open_mesh_multitracker(\"../data/Meshes/Phallusia_Guignard_et_al.rec\")\n", |
| 176 | + "Mesh = DCEL_Data(v,f)\n", |
| 177 | + "plot_tension_inference(Mesh, scattered = True, scatter_coeff=0.3)\n", |
| 178 | + "#OR: \n", |
| 179 | + "#plot_force_inference(Mesh) #This can take some time, up to 20 min. \n", |
| 180 | + "#plot_valid_junctions(Mesh)\n", |
| 181 | + "#plot_residual_junctions(Mesh)" |
| 182 | + ] |
| 183 | + }, |
| 184 | + { |
| 185 | + "cell_type": "code", |
| 186 | + "execution_count": null, |
| 187 | + "metadata": {}, |
| 188 | + "outputs": [], |
| 189 | + "source": [] |
| 190 | + } |
| 191 | + ], |
| 192 | + "metadata": { |
| 193 | + "kernelspec": { |
| 194 | + "display_name": "Python 3 (ipykernel)", |
| 195 | + "language": "python", |
| 196 | + "name": "python3" |
| 197 | + }, |
| 198 | + "language_info": { |
| 199 | + "codemirror_mode": { |
| 200 | + "name": "ipython", |
| 201 | + "version": 3 |
| 202 | + }, |
| 203 | + "file_extension": ".py", |
| 204 | + "mimetype": "text/x-python", |
| 205 | + "name": "python", |
| 206 | + "nbconvert_exporter": "python", |
| 207 | + "pygments_lexer": "ipython3", |
| 208 | + "version": "3.9.6" |
| 209 | + } |
| 210 | + }, |
| 211 | + "nbformat": 4, |
| 212 | + "nbformat_minor": 4 |
| 213 | +} |
0 commit comments