-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2da3b82
Showing
45 changed files
with
8,088 additions
and
0 deletions.
There are no files selected for viewing
191 changes: 191 additions & 0 deletions
191
CellProfiler/.ipynb_checkpoints/sort_images-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 66, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import glob\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"import os\n", | ||
"\n", | ||
"from pprint import pprint\n", | ||
"\n", | ||
"import skimage.io\n", | ||
"import sklearn.cluster\n", | ||
"import sklearn.preprocessing" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"image_list = glob.glob(\"../images/*.png\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 63, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[array([1382400, 0, 0, 0, 0, 0, 0,\n", | ||
" 0, 0, 0], dtype=int64),\n", | ||
" array([1382400, 0, 0, 0, 0, 0, 0,\n", | ||
" 0, 0, 0], dtype=int64),\n", | ||
" array([1376628, 4927, 697, 110, 23, 15, 0,\n", | ||
" 0, 0, 0], dtype=int64)]\n", | ||
"'break'\n", | ||
"array([[1382400, 0, 0, 0, 0, 0, 0,\n", | ||
" 0, 0, 0],\n", | ||
" [1382400, 0, 0, 0, 0, 0, 0,\n", | ||
" 0, 0, 0],\n", | ||
" [1376628, 4927, 697, 110, 23, 15, 0,\n", | ||
" 0, 0, 0]], dtype=int64)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"category_list = []\n", | ||
"hist_list = []\n", | ||
"\n", | ||
"for im_name in image_list:\n", | ||
" im = skimage.io.imread(im_name)\n", | ||
" data, _ = np.histogram(im, range=(0,32767))\n", | ||
" hist_list.append(data)\n", | ||
"\n", | ||
"hist_list = np.asarray(hist_list)\n", | ||
"pprint(hist_list)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 59, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"kmeans = sklearn.cluster.KMeans(n_clusters=2, random_state=0).fit(hist_list)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 61, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([0, 0, 1])" | ||
] | ||
}, | ||
"execution_count": 61, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"kmeans.labels_" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 73, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"0\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"C:\\Users\\karhohs\\AppData\\Local\\Continuum\\Miniconda3\\envs\\bioimg\\lib\\site-packages\\skimage\\io\\_io.py:132: UserWarning: ../images/class_0\\testing_0.png is a low contrast image\n", | ||
" warn('%s is a low contrast image' % fname)\n" | ||
] | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"0\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"C:\\Users\\karhohs\\AppData\\Local\\Continuum\\Miniconda3\\envs\\bioimg\\lib\\site-packages\\skimage\\io\\_io.py:132: UserWarning: ../images/class_0\\testing_1.png is a low contrast image\n", | ||
" warn('%s is a low contrast image' % fname)\n" | ||
] | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"1\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"C:\\Users\\karhohs\\AppData\\Local\\Continuum\\Miniconda3\\envs\\bioimg\\lib\\site-packages\\skimage\\io\\_io.py:132: UserWarning: ../images/class_1\\testing_2.png is a low contrast image\n", | ||
" warn('%s is a low contrast image' % fname)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"os.makedirs(\"../images/class_0\", exist_ok = True)\n", | ||
"os.makedirs(\"../images/class_1\", exist_ok = True)\n", | ||
"\n", | ||
"for ind, label in enumerate(kmeans.labels_):\n", | ||
" im = skimage.io.imread(image_list[ind])\n", | ||
" _, filename = os.path.split(image_list[ind])\n", | ||
" if label==0:\n", | ||
" skimage.io.imsave(os.path.join(\"../images/class_0\", filename), im)\n", | ||
" if label==1:\n", | ||
" skimage.io.imsave(os.path.join(\"../images/class_1\", filename), im)" | ||
] | ||
}, | ||
{ | ||
"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.6.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# A note about the software and hardware used to run the pipeline | ||
|
||
By Kyle W. Karhohs @karhohs | ||
|
||
## software | ||
* CellProfiler, v3.0.0 | ||
* OS: Microsoft Windows 10 Pro x64 | ||
|
||
## hardware | ||
* Dell XPS 15 9550 | ||
* Intel Core i7-6700HQ CPU @ 2.60GHz 4 Cores 8 Logical Processors | ||
* 16 GB Physical Memory/RAM | ||
|
||
|
Oops, something went wrong.