Commit 34b8bd09 authored by rhaase's avatar rhaase

added exercise solution

parent eb253d46
{
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 199.127197\n",
"1 469.055176\n",
"2 782.623291\n",
"3 990.295410\n",
"4 1100.158691\n",
"5 1150.970459\n",
"6 1173.553467\n",
"7 1184.692383\n",
"8 1190.338135\n",
"9 1185.302734\n",
"10 1189.270020\n",
"11 1192.169189\n",
"12 1206.970215\n",
"13 1242.980957\n",
"14 1277.008057\n",
"15 1309.814453\n",
"16 1334.838867\n",
"17 1371.765137\n",
"18 1375.122070\n",
"19 1315.155029\n",
"20 1172.790527\n",
"21 917.663574\n",
"22 587.005615\n",
"23 224.304199\n",
"24 128.479004\n",
"Name: # Area, dtype: float64\n",
"0 197.906\n",
"1 468.903\n",
"2 780.640\n",
"3 988.922\n",
"4 1100.159\n",
"5 1152.649\n",
"6 1178.131\n",
"7 1189.575\n",
"8 1197.052\n",
"9 1197.662\n",
"10 1210.632\n",
"11 1222.534\n",
"12 1241.913\n",
"13 1266.785\n",
"14 1292.419\n",
"15 1318.512\n",
"16 1340.637\n",
"17 1371.918\n",
"18 1373.596\n",
"19 1315.308\n",
"20 1172.638\n",
"21 915.527\n",
"22 586.243\n",
"23 222.931\n",
"24 127.411\n",
"Name: Area, dtype: float64\n"
]
}
],
"source": [
"import pandas as pd\n",
"\n",
"# Load data\n",
"table_otsu_python = pd.read_csv(\"otsu_python.csv\", delimiter=',')\n",
"table_otsu_imagej = pd.read_csv(\"otsu_imagej.csv\", delimiter=',')\n",
"\n",
"# read out columns\n",
"measurement_python = table_otsu_python[\"# Area\"];\n",
"measurement_imagej = table_otsu_imagej[\"Area\"];\n",
"\n",
"print(measurement_python)\n",
"print(measurement_imagej)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First we determine the mean of both measurementsand compare them"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Python: 1010.858154296875\n",
"ImageJ: 1017.22412\n",
"Difference: -6.365965703124971\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"mean_python = np.mean(measurement_python)\n",
"mean_imagej = np.mean(measurement_imagej)\n",
"\n",
"print(\"Python: \" + str(mean_python))\n",
"print(\"ImageJ: \" + str(mean_imagej))\n",
"\n",
"print(\"Difference: \" + str(mean_python - mean_imagej))\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then we have a look at the histograms for the measurement"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAM90lEQVR4nO3db4xl9V3H8ffH3dKytARwh0pZ1gFDSIgPBCcKxTQGWqVAoA98QCNKtWYfWWnV1G2INj4DbWprNJoNUNEipKFoCUSF0DaNSV3d5U9ZWBAoW1i6dLdpbFETgfTrg3uwwzA7Mzv3zsz92vcrmdxzfvecez735t7Pnjn3nJ1UFZKkfn5kowNIklbHApekpixwSWrKApekpixwSWpq83pubOvWrTU7O7uem5Sk9vbu3fvtqppZOL6uBT47O8uePXvWc5OS1F6Sbyw27iEUSWrKApekpixwSWrKApekpixwSWrKApekppYt8CS3JDmcZN+8sVOS3J/kqeH25LWNKUlaaCV74H8FXLpgbCfwQFWdDTwwzEuS1tGyBV5VXwG+s2D4KuDWYfpW4H0TziVJWsZqr8R8e1UdAqiqQ0lOPdqCSXYAOwC2b9++ys1J+v9kdue9G7LdAzdcviHbXStr/iVmVe2qqrmqmpuZecOl/JKkVVptgX8ryWkAw+3hyUWSJK3Eagv8buDaYfpa4AuTiSNJW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pixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWrKApekpixwSWpq7AJPsinJQ0numUQgSdLKTGIP/Dpg/wQeR5J0DMYq8CTbgMuBmyYTR5K0UuPugX8K+Cjw/aMtkGRHkj1J9hw5cmTMzUmSXrPqAk9yBXC4qvYutVxV7aqquaqam5mZWe3mJEkLjLMHfhFwZZIDwB3AxUk+O5FUkqRlrbrAq+pjVbWtqmaBq4EvVtU1E0smSVqS54FLUlObJ/EgVfVl4MuTeCxJ0sq4By5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktSUBS5JTVngktTUqgs8yRlJvpRkf5LHklw3yWCSpKVtHmPdV4HfqaoHk7wN2Jvk/qp6fELZJElLWPUeeFUdqqoHh+mXgP3A6ZMKJkla2jh74P8nySxwHrB7kft2ADsAtm/fPonNrbvZnfduyHYP3HD5hmxXPxw26n2tyRn7S8wkbwU+D3y4qr638P6q2lVVc1U1NzMzM+7mJEmDsQo8yZsYlfdtVXXXZCJJklZinLNQAtwM7K+qT04ukiRpJcbZA78I+BXg4iQPDz+XTSiXJGkZq/4Ss6r+GcgEs0iSjoFXYkpSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxa4JDVlgUtSUxP5o8brwT/Aun58raUe3AOXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKYscElqygKXpKbGKvAklyZ5MsnTSXZOKpQkaXmrLvAkm4A/B94LnAu8P8m5kwomSVraOHvgPwM8XVVfr6qXgTuAqyYTS5K0nHH+qPHpwPPz5g8CP7twoSQ7gB3D7H8meXKV29sKfHuV626EsfP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5yX6SNzEq79uq6q5h+FvDr0QMt4eH8Y18DhcBVyY5wOjw08VJPjulWV/b/sGq2j3M38mo0Kcx77uBZ6vqSFW9AtwFvHNKs853rPkO8oNDF/PH10WSa4ErgF8eDjPAdGb9CUb/mD8yfN62AQ8m+THWKG+HAp+6S/aHb4lvBvZX1Sfn3XU3cO0wfS3whXnjVyd5c5IzgbMZfXGx5qrqY1W1rapmGb12X6yqa6Yx65D3ReD5JOcMQ5cAj09p3ueAC5JsGd4TlzD6PmQas853TPmGwywvJblgeJ6/Om+dNZXkUuD3gCur6r8XPIepylpVj1bVqVU1O3zeDjI62eHFNcu7Ft/OTvoHuIzRmR7PANdPQZ6fY/RrzteAh4efy4AfBR4AnhpuT5m3zvVD/idZo2/FV5D75/nBWShTmxX4KWDP8Pr+PXDytOYF/hB4AtgH/A2jswymJitwO6Pj868MhfLB1eQD5obn+AzwZwxXca9D1qcZHTt+7XP2l9OQ9Wh5F9x/gOEslLXK66X0ktRUh0MokqRFWOCS1JQFLklNWeCS1JQFLklNWeCS1JQFLklN/S+XdtUPAYl3EgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWoAAAD4CAYAAADFAawfAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAMQElEQVR4nO3dX4ylhV2H8efrTmlZWgJ1p9rugrOYpgnxQnCiUExjoNGWJeCFFxhR6p/slUqrpi4hsfEOtKnVaGo20EYtQgxFbSC2NLaNMdHV2QXKwoKFsoWli0xjbLEmAunPi/MunA6z7FmYd+Y37PNJNnvmPWdmvjOZffbsOefNpqqQJPX1fRs9QJL0ygy1JDVnqCWpOUMt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nq57p5zsvu3D5ZXH19uvMLnHCU23JrkSeKqq7l9x1Sh7u4R6ptPUN0KSNwOfAT5YVd9+pZuucmzdvoYkVwDPVNX+Wd9llWPrtXeOyT8lP1FVFwDfYfJP8+PZ6O/t2UzuKe0E3gGckeSaV3qXVY61+HkeHG/fhu9OcgPwAnDrsUOr3GxDtybZCtwA/N5qV69y7DXv7RLqlqepJ3kDk0jfWlV3Dof/c/hnDMPvzwzHN/pruAS4MslhJg8dXZrk0/TcewQ4UlX7hrfvYBLujlsB3gs8XlXLVfU8cCfw7sZ7jznZfUd46SGH6ePrIsm1wBXALwwPD0DPrT/M5C/t+4c/bzuAA0l+kJH2dgl1u9PUh2dkbwEOVdXHpq76LHDtcPla4O+njl+d5I1JdgLvZPLkwbqoquurakdVLTD5/n2xqq7puLeqngaeTPKu4dBlwEMdtw6eAC5KsnX4ubiMyXMWXfcec1L7hodHnk1y0fB1/tLU+4wqyfuA3wWurKr/XfE1tNpaVQ9U1duqamH483aEyQsPnh5t7xjPkr7KZ1YvZ/LKiseAGxrs+Ukm/zT5CnDf8Oty4PuBfwS+Ovz+1qn3uWHY/wgjPQM94/af4qVXfbTcC/wosDR8f/8OOLvr1uHz/z7wMHAQ+Csmz+q32QvcxuTx8+eHcPzqq9kHLA5f42PAnzKcvbwOWx9l8tjusT9rf95h6/H2rrj+MMOrPsba6ynkktRcl4c+JEnHYaglqTlDLUnNGWpJas5QS1JzhlqSmjPUktTc/wN1fYHh0UHffwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"def draw_histogram(data):\n",
" counts, bins = np.histogram(data, bins=10, range=(0,1400))\n",
" plt.hist(bins[:-1], bins, weights=counts)\n",
" #plt.axis([0, 10, 0, 4])\n",
" plt.show()\n",
" \n",
"draw_histogram(measurement_python)\n",
"draw_histogram(measurement_imagej)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We should also plot them against each other in a scatter plot to get a first impression on they relate to each other"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3dd3gVZfrG8e+TAqFKV1oEFVGwG8HK2kFFwLoWFNfCpYsVGwi76i5Y1rWhq4KoiwqyqLsKIgJiQ38UQUCKRlAQIiVRREBNQpLn98cMu0cMAmlzTs79ua5z5Zx3Zs7cB5Inb96ZecfcHRERSQ4pUQcQEZGqo6IvIpJEVPRFRJKIir6ISBJR0RcRSSJpUQfYkSZNmnibNm2ijiEiklDmzp37rbs33bY97ot+mzZtmDNnTtQxREQSipl9XVq7hndERJKIir6ISBJR0RcRSSIq+iIiSURFX0Qkieyw6JvZs2aWa2aLSll2i5m5mTWJaRtoZsvMLNvMusa0H25mC8Nlw8zMKu5jiIjIztiZnv4/gW7bNppZa+AUYGVMWwfgAqBjuM0TZpYaLn4S6Au0Cx+/ek8REalcOyz67v4BsL6URQ8DtwGxczP3BMa6e4G7LweWAZ3MrDlQ391neDCX8/NAr3KnFxGpjtYtgbfvhkqY+r5MY/pm1gP4xt0XbLOoJbAq5nVO2NYyfL5t+/bev6+ZzTGzOXl5eWWJKCKSeIoK4b37YHgX+GQUbPymwnexy1fkmlltYBBwammLS2nz32gvlbuPAEYAZGVl6S4vIlIt5W7Mp+8LczGDZ05JodHU/pC7BA48D7rdB3Wa7PhNdlFZpmHYG2gLLAiPxbYCPjGzTgQ9+NYx67YCVoftrUppFxFJWsOmLeXzVevon/YKDUZPgnp7wIX/gvaVd8hzl4u+uy8Emm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2La4jXrXkAe8Fw4HDXSzOrEY153/wb4O7ASWAP84O5T4jHrNnY1X8vw+bbtVe1ygp4wxGlWM+sBfOPuC7ZZVCl5q2PR36mbr0fFzOoCrwI3uvvG31q1lLYq+Rxm1h3Idfe5O7tJKW1V+W+eRvAn85PufijwI8EQxPZE+W/bkKAH1xZoAdQxs96/tUkpbXHz/cz280We28wGAUXA6K1NpawWaVYzqw0MAv5c2uJS2sqdtzoW/bi9+bqZpRMU/NHu/u+weV345xrh19ywPcrPcQzQw8xWEAyPnWhmL8Zp1q37z3H3WeHrVwh+CcRj3pOB5e6e5+5bgH8DR8dp1li7mi+H/w2rxLZXCTPrA3QHLg6HQCA+s+5N0AFYEP68tQI+MbM9qKS81bHox+XN18Oj688An7n7QzGLxgN9wud9gNdj2i8ws5pm1hZoR3DwptK5+0B3b+XubQj+/d5x997xmDXMuxZYZWbtw6aTgCVxmnclcKSZ1Q6/J04iOL4Tj1lj7VK+cAhok5kdGX7OS2O2qVRm1g24Hejh7j9t8xniKqu7L3T3Zu7eJvx5yyE44WNtpeWtjCPUUT+A0wnOjvkSGBR1njDTsQR/gn0KzA8fpwONgWnA0vBro5htBoWfIZtKOptgJ3Ifz//O3onbrMAhwJzw3/c1oGG85gXuBj4HFgEvEJydETdZgZcIjjdsCYvQFWXJB2SFn/FL4HHCGQCqIOsygrHwrT9nT8VD1u3l3Wb5CsKzdyorr6ZhEBFJItVxeEdERLZDRV9EJImo6IuIJBEVfRGRJKKiLyKSRFT0RUSSiIq+iEgS+X9j7OaAb/HUMgAAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"# plot our data\n",
"plt.plot(measurement_python, measurement_imagej, \"*\")\n",
"# plot another line which corresponds to identidy\n",
"plt.plot([0, 1400], [0, 1400])\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let's have a look at the Bland-Altman plot"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"# A function for drawing Bland-Altman plots\n",
"# source https://stackoverflow.com/questions/16399279/bland-altman-plot-in-python\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"def bland_altman_plot(data1, data2, *args, **kwargs):\n",
" data1 = np.asarray(data1)\n",
" data2 = np.asarray(data2)\n",
" mean = np.mean([data1, data2], axis=0)\n",
" diff = data1 - data2 # Difference between data1 and data2\n",
" md = np.mean(diff) # Mean of the difference\n",
" sd = np.std(diff, axis=0) # Standard deviation of the difference\n",
"\n",
" plt.scatter(mean, diff, *args, **kwargs)\n",
" plt.axhline(md, color='gray', linestyle='--')\n",
" plt.axhline(md + 1.96*sd, color='gray', linestyle='--')\n",
" plt.axhline(md - 1.96*sd, color='gray', linestyle='--')"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAWd0lEQVR4nO3df2xV533H8fe34GZ2W6ABWhfbGaYLlgKpTHfJCplgK7S4LYQf0zwqVw1qp/zTSV2nZQ2K1K2aUNIxrd3UdR1qO7rNbWZ1hgSimgQygVRog1PcAElMKG5nm7gBZ0BXW5lDvvvjHtN7udf4x732Ofc+n5dk+d7nOffc55GPP/fc55zzHHN3REQkDG+JuwEiIjJzFPoiIgFR6IuIBEShLyISEIW+iEhAZsfdgEwLFizwxYsXx90MEZGS8txzz11294UTWTZRob948WI6OzvjboaISEkxs59PdFkN74iIBEShLyISEIW+iEhAFPoiIgFR6IuIBEShLyISEIW+iEhAEnWe/uDgIHv37s0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MwLuixWqA3oyX9UVlcfsK6Q3jzYyyUurDEuAS8C/RENU3zOxtlFAf3L0f+Fvgv4FXgKvu/hQl1IcMk21zTfT45vKk+BTpvV4ooT6Y2X1Av7v/5KaqovYhyNA3s7cD/wn8qbtfu9WiecpiPcfVzDYCr7r7cxN9SZ6yuM/TnU36q+0/ufsK4FekhxXGkrg+ROPem0l/3V4EvM3MPnGrl+Qpi/vvMJ6x2pzYvpjZw8AbQOtoUZ7FEtcHM6sCHga+kK86T9mU+xBc6JtZBenAb3X39qj4F9FXJaLfr0blfaTH2EbVkv4KH6d7gfvM7GfAY8AHzezfKa0+9AF97v6j6Pn3SH8IlFIf1gM97n7J3UeAdmA1pdWHUZNtcx+/Hj7JLI+Vmd0PbARaouEOKJ0+vJf0DsRPov/tWuDHZlZNkfsQVOhHR7a/Cbzo7n+XUfUEcH/0+H7g8Yzy7WZ2m5nVA3eSPnASG3ff6e617r4Y2A484+6foLT6MAD0mllDVLQOeIES6gPpYZ0PmFlVtF2tI32MqJT6MGpSbY6GgH5pZh+I+v7JjNfEwsyagM8D97n7UEZVSfTB3U+7+7vcfXH0v91H+qSTgaL3YaaOVifhB/hd0l9/nge6op+PAvOBI8DL0e/bM17zMOmj5d3M4NH9Cfbn9/j12Tsl1QegEeiM/hb7gXeWYB++CLwEnAH+jfTZFYnuA/Bd0scgRqJg+fRU2gykon7/FPgq0dX9MfbhPOlx79H/66+XWh9uqv8Z0dk7xe6DpmEQEQlIUMM7IiKhU+iLiAREoS8iEhCFvohIQBT6IiIBUeiLiAREoS8iEpD/B00CHHJEE5U0AAAAAElFTkSuQmCC\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# draw a Bland-Altman plot\n",
"bland_altman_plot(measurement_python, measurement_imagej)\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The cofindence interval"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[-27.391497299107073, 14.659565892857032]\n"
]
}
],
"source": [
"data1 = measurement_python\n",
"data2 = measurement_imagej\n",
"\n",
"mean = np.mean([data1, data2], axis=0)\n",
"diff = data1 - data2 # Difference between data1 and data2\n",
"md = np.mean(diff) # Mean of the difference\n",
"sd = np.std(diff, axis=0) # Standard deviation of the difference\n",
"\n",
"CI = [md - 2 * sd, md+2*sd]\n",
"\n",
"print(CI)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
// This ImageJ macro analyses a folder of 2D MRI
// images showing a banana slice by slice. It measures
// the area of the banana and writes it in a CSV file.
//
// Usage: run it in Fiji (http://fiji.sc)
//
// Robert Haase, MPI CBG, rhaase@mpi-cbg.de
// April 2019
//
folder = "C:/structure/teaching/lecture_applied_bioimage_analysis_2020/03_Feature_extraction_and_ImageJ_Macro/example_images/banana/"
// access the folder
filelist = getFileList(folder);
for (i = 0; i < lengthOf(filelist); i++) {
// get the nth entry from the filelist array
file = filelist[i];
if (endsWith(file, ".tif")) {
// open the image
open(folder + file);
// segment the object in the image
setAutoThreshold("Otsu dark");
setOption("BlackBackground", true);
run("Convert to Mask");
run("Fill Holes");
// measure the position of this one single object
run("Set Measurements...", "area redirect=None decimal=3");
run("Create Selection");
run("Measure");
// close the image
close();
}
}
// save the positions as CSV to disc
folder = "C:/structure/teaching/lecture_applied_bioimage_analysis_2020/10_Method_comparison/exercise_solution/"
result_filename = "otsu_imagej.csv"
saveAs("Results", folder + result_filename);
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[199.127197265625], [469.05517578125], [782.623291015625], [990.29541015625], [1100.15869140625], [1150.970458984375], [1173.553466796875], [1184.6923828125], [1190.338134765625], [1185.302734375], [1189.27001953125], [1192.169189453125], [1206.97021484375], [1242.98095703125], [1277.008056640625], [1309.814453125], [1334.8388671875], [1371.76513671875], [1375.1220703125], [1315.155029296875], [1172.79052734375], [917.66357421875], [587.005615234375], [224.30419921875], [128.47900390625]]\n"
]
}
],
"source": [
"from skimage.io import imread\n",
"from skimage import filters\n",
"from skimage import measure\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import os\n",
"directory = 'C:/structure/teaching/lecture_applied_bioimage_analysis_2020/03_Feature_extraction_and_ImageJ_Macro/example_images/banana/'\n",
"area_per_pixel = 0.3906250 * 0.3906250\n",
"\n",
"# get list of files in the given folder\n",
"file_list = os.listdir(directory)\n",
"\n",
"# create an empty table\n",
"table = []\n",
"\n",
"# go through the folder file by file\n",
"for filename in file_list:\n",
" if filename.endswith(\".tif\"):\n",
" # open image\n",
" image = imread(directory + filename)\n",
" \n",
" # determine threshold for the image\n",
" threshold = filters.threshold_otsu(image)\n",
" \n",
" # apply the threshold\n",
" thresholded_image = image >= threshold\n",
"\n",
" # area equals the sum of white pixels multiplied with pixel size\n",
" pixel_count = np.sum(thresholded_image)\n",
" area = pixel_count * area_per_pixel\n",
" \n",
" # make a row in our table\n",
" row = [area]\n",
" table = table + [row]\n",
"\n",
"print(table)\n",
"\n",
"np_table = np.asarray(table)\n",
"np.savetxt(\"otsu_python.csv\", np_table, delimiter=',', header=\"Area\")\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAQEAAAD8CAYAAAB3lxGOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxv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eipJc8zZgZsEzTGnuI9MApNJH2leA3wl7nqKmMfPgc1AC+nfENOBk4AFwOroviFr/a9Ec14JXB53/XnM712kN3VfBpZGt8kJm+PZwJ+iOS4DvhqNJ2aOuW46Y1AkcHHvDohIzBQCIoFTCIgETiEgEjiFgEjgFAIigVMIiAROISASuP8Hdq2uaQQY8IsAAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[9012]\n"
]
},
{
"data": {
"text/plain": [
"9012"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from skimage.io import imread\n",
"from skimage import filters\n",
"from skimage import measure\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"# load file\n",
"filename = \"https://git.mpi-cbg.de/rhaase/lecture_applied_bioimage_analysis_2020/raw/master/03_Feature_extraction_and_ImageJ_Macro/example_images/banana/banana0020.tif\"\n",
"image = imread(filename)\n",
"\n",
"# threshold it\n",
"threshold = filters.threshold_otsu(image)\n",
"thresholded_image = image >= threshold\n",
"\n",
"# visualise the thresholded image\n",
"plt.imshow(thresholded_image)\n",
"plt.show()\n",
"\n",
"# assuing white pixels have value 1 and black pixes have value 0,\n",
"# the area in a binary image is equal to the sum of the whole image\n",
"np.sum(thresholded_image)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment