{ "cells": [ { "cell_type": "markdown", "id": "b44cd25f", "metadata": {}, "source": [ "## Deconvolve microtubules phantom\n", "\n", "In this example we use clij2fft richardson lucy to deconvolve the microtubules phantom from here http://bigwww.epfl.ch/deconvolution/data/microtubules/\n", "\n", "The purpose of this example is to show the effect of regularization" ] }, { "cell_type": "code", "execution_count": 1, "id": "cd4303fd", "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "from skimage.io import imread\n", "from tnia.plotting.projections import show_xyz_max" ] }, { "cell_type": "code", "execution_count": 2, "id": "4f2ec717", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "tnia available\n", "stackview available\n" ] } ], "source": [ "from decon_helper import image_path\n", "\n", "image_name = image_path / 'microtubules/input.tif'\n", "psf_name = image_path / 'microtubules/psf.tif'\n", "truth_name = image_path / 'microtubules/ground-truth.tif'\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "fc7384d1", "metadata": {}, "outputs": [], "source": [ "im=imread(image_name)\n", "psf=imread(psf_name)\n", "truth=imread(truth_name)" ] }, { "cell_type": "markdown", "id": "80b100ea", "metadata": {}, "source": [ "# crop PSF to make decon a bit faster " ] }, { "cell_type": "code", "execution_count": 4, "id": "4101e4d3", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(128, 128, 128)" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from tnia.nd.ndutil import centercrop\n", "psf=centercrop(psf, (128,128,128))\n", "psf.shape" ] }, { "cell_type": "code", "execution_count": 5, "id": "0f0cf84a", "metadata": {}, "outputs": [], "source": [ "from clij2fft.richardson_lucy import richardson_lucy, richardson_lucy_nc" ] }, { "cell_type": "code", "execution_count": 6, "id": "f132a3ab", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "get lib\n", "\n", "Richardson Lucy Started\n", "0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 \n", "Richardson Lucy Finishedget lib\n", "\n", "Richardson Lucy Started\n", "0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 \n", "Richardson Lucy Finishedget lib\n", "\n", "Richardson Lucy Started\n", "0 10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 300 310 320 330 340 350 360 370 380 390 400 410 420 430 440 450 460 470 480 490 \n", "Richardson Lucy Finished" ] } ], "source": [ "iterations = 500\n", "decon_tv_0=richardson_lucy_nc(im, psf, iterations, 0)\n", "decon_tv_0001=richardson_lucy_nc(im, psf, iterations, 0.0001)\n", "decon_tv_001=richardson_lucy_nc(im, psf, iterations, 0.001)" ] }, { "cell_type": "code", "execution_count": 14, "id": "f841414a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "
method | \n", "RMSE | \n", "
---|---|
truth | \n", "0.000000 | \n", "
image | \n", "580.465576 | \n", "
decon rf=0 | \n", "398.522888 | \n", "
decon rf=0.0001 | \n", "389.548767 | \n", "
decon rf=0.001 | \n", "411.254181 | \n", "