Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open an image with Bio-Formats as a numpy array via pyimagej
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'2.0.0-rc-71/1.52i'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import imagej\n",
"ij = imagej.init('sc.fiji:fiji:2.0.0-pre-10')\n",
"ij.getVersion()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"jnius.reflect.net.imglib2.view.IntervalView"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Open the image using ImageJ (more precisely: Bio-Formats via SCIFIO).\n",
"ijImage = ij.io().open('/Users/curtis/Desktop/p3_ipsi.nii')\n",
"# Slice out the Z=37 plane.\n",
"ijSlice = ij.op().transform().hyperSliceView(ijImage, 2, 37)\n",
"# What kind of thing is this?\n",
"type(ijSlice)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"numpy.ndarray"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Convert the thing to a numpy array.\n",
"pySlice = ij.py.from_java(ijSlice)\n",
"type(pySlice)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAU8AAAD8CAYAAAD35CadAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJztnX+QJVd13z/nvdnZRSIqsYCwLCnRrlgRExIb1QZpTSpFIbsMhEKkChKIE6scuTZ2IID5JcmqCvEfjkXACLBBeMtgyykVPyxIUFHEBB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AAAABJRU5ErkJggg==\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"from matplotlib import pyplot\n",
"pyplot.imshow(pySlice, interpolation='nearest')\n",
"pyplot.show()"
]
}
],
"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.1"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": false,
"sideBar": false,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": false,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
@ctrueden

This comment has been minimized.

Copy link
Owner Author

@ctrueden ctrueden commented Mar 8, 2019

@ctrueden

This comment has been minimized.

Copy link
Owner Author

@ctrueden ctrueden commented Mar 8, 2019

For NIFTI specifically, there are much easier ways:

import nibabel as nib
img = nib.load(filename)
data = img.get_fdata()

But the above notebook should work for nearly all the Bio-Formats-supported formats, including ones without convenient Python libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.