|
@@ -0,0 +1,187 @@
|
|
|
+{
|
|
|
+ "cells": [
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 1,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "data": {
|
|
|
+ "text/plain": [
|
|
|
+ "155622"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "execution_count": 1,
|
|
|
+ "metadata": {},
|
|
|
+ "output_type": "execute_result"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "from freesurfer_surface import Surface\n",
|
|
|
+ "\n",
|
|
|
+ "SUBJECTS_DIR = '../tests/subjects'\n",
|
|
|
+ "surface = Surface.read_triangular(SUBJECTS_DIR + '/fabian/surf/lh.pial')\n",
|
|
|
+ "surface.load_annotation(SUBJECTS_DIR + '/fabian/label/lh.aparc.annot')\n",
|
|
|
+ "len(surface.vertex_annotation_values)"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 2,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "data": {
|
|
|
+ "text/html": [
|
|
|
+ "<div>\n",
|
|
|
+ "<style scoped>\n",
|
|
|
+ " .dataframe tbody tr th:only-of-type {\n",
|
|
|
+ " vertical-align: middle;\n",
|
|
|
+ " }\n",
|
|
|
+ "\n",
|
|
|
+ " .dataframe tbody tr th {\n",
|
|
|
+ " vertical-align: top;\n",
|
|
|
+ " }\n",
|
|
|
+ "\n",
|
|
|
+ " .dataframe thead th {\n",
|
|
|
+ " text-align: right;\n",
|
|
|
+ " }\n",
|
|
|
+ "</style>\n",
|
|
|
+ "<table border=\"1\" class=\"dataframe\">\n",
|
|
|
+ " <thead>\n",
|
|
|
+ " <tr style=\"text-align: right;\">\n",
|
|
|
+ " <th></th>\n",
|
|
|
+ " <th>annotation_value</th>\n",
|
|
|
+ " <th>vertex_index</th>\n",
|
|
|
+ " </tr>\n",
|
|
|
+ " </thead>\n",
|
|
|
+ " <tbody>\n",
|
|
|
+ " <tr>\n",
|
|
|
+ " <th>0</th>\n",
|
|
|
+ " <td>6558940</td>\n",
|
|
|
+ " <td>0</td>\n",
|
|
|
+ " </tr>\n",
|
|
|
+ " <tr>\n",
|
|
|
+ " <th>1</th>\n",
|
|
|
+ " <td>6558940</td>\n",
|
|
|
+ " <td>1</td>\n",
|
|
|
+ " </tr>\n",
|
|
|
+ " <tr>\n",
|
|
|
+ " <th>2</th>\n",
|
|
|
+ " <td>6558940</td>\n",
|
|
|
+ " <td>2</td>\n",
|
|
|
+ " </tr>\n",
|
|
|
+ " <tr>\n",
|
|
|
+ " <th>3</th>\n",
|
|
|
+ " <td>6558940</td>\n",
|
|
|
+ " <td>3</td>\n",
|
|
|
+ " </tr>\n",
|
|
|
+ " <tr>\n",
|
|
|
+ " <th>4</th>\n",
|
|
|
+ " <td>6558940</td>\n",
|
|
|
+ " <td>4</td>\n",
|
|
|
+ " </tr>\n",
|
|
|
+ " </tbody>\n",
|
|
|
+ "</table>\n",
|
|
|
+ "</div>"
|
|
|
+ ],
|
|
|
+ "text/plain": [
|
|
|
+ " annotation_value vertex_index\n",
|
|
|
+ "0 6558940 0\n",
|
|
|
+ "1 6558940 1\n",
|
|
|
+ "2 6558940 2\n",
|
|
|
+ "3 6558940 3\n",
|
|
|
+ "4 6558940 4"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "execution_count": 2,
|
|
|
+ "metadata": {},
|
|
|
+ "output_type": "execute_result"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "import pandas\n",
|
|
|
+ "\n",
|
|
|
+ "vertex_frame = pandas.DataFrame({'vertex_index': vertex_index, 'annotation_value': annotation_value}\n",
|
|
|
+ " for vertex_index, annotation_value in surface.vertex_annotation_values.items())\n",
|
|
|
+ "vertex_frame.head()"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "cell_type": "code",
|
|
|
+ "execution_count": 3,
|
|
|
+ "metadata": {},
|
|
|
+ "outputs": [
|
|
|
+ {
|
|
|
+ "data": {
|
|
|
+ "text/plain": [
|
|
|
+ "10542100 12532\n",
|
|
|
+ "9221140 9883\n",
|
|
|
+ "9182740 9792\n",
|
|
|
+ "8204875 9484\n",
|
|
|
+ "1351760 8156\n",
|
|
|
+ "0 8062\n",
|
|
|
+ "14423100 7944\n",
|
|
|
+ "1316060 7095\n",
|
|
|
+ "14474380 7006\n",
|
|
|
+ "14433500 6737\n",
|
|
|
+ "9211105 5636\n",
|
|
|
+ "11832480 5560\n",
|
|
|
+ "3302560 5207\n",
|
|
|
+ "9231540 5003\n",
|
|
|
+ "7874740 4756\n",
|
|
|
+ "3296035 4383\n",
|
|
|
+ "6500 4128\n",
|
|
|
+ "2146559 4117\n",
|
|
|
+ "6558940 3033\n",
|
|
|
+ "4924360 3017\n",
|
|
|
+ "9221340 2839\n",
|
|
|
+ "3957880 2734\n",
|
|
|
+ "3988540 2507\n",
|
|
|
+ "1326300 2460\n",
|
|
|
+ "14464220 2352\n",
|
|
|
+ "9180300 1861\n",
|
|
|
+ "9180240 1711\n",
|
|
|
+ "10511485 1362\n",
|
|
|
+ "2647065 1322\n",
|
|
|
+ "3302420 1078\n",
|
|
|
+ "3988500 991\n",
|
|
|
+ "13145750 990\n",
|
|
|
+ "660700 789\n",
|
|
|
+ "11146310 727\n",
|
|
|
+ "6553700 368\n",
|
|
|
+ "Name: annotation_value, dtype: int64"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ "execution_count": 3,
|
|
|
+ "metadata": {},
|
|
|
+ "output_type": "execute_result"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "source": [
|
|
|
+ "vertex_frame['annotation_value'].value_counts()"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "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.7"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "nbformat": 4,
|
|
|
+ "nbformat_minor": 2
|
|
|
+}
|