Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 35 additions & 30 deletions Python/02_Pythonic_Image.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@
"\n",
"If you are familiar with numpy, sliced index then this should be cake for the SimpleITK image. The Python standard slice interface for 1-D object:\n",
"\n",
"<table>\n",
" <tr><td>Operation</td>\t<td>Result</td></tr>\n",
" <tr><td>d[i]</td>\t<td>i-th item of d, starting index 0</td></tr>\n",
" <tr><td>d[i:j]</td>\t<td>slice of d from i to j</td></tr>\n",
" <tr><td>d[i:j:k]</td>\t<td>slice of d from i to j with step k</td></tr>\n",
"</table>\n",
"| Operation | Result |\n",
"|------------|---------|\n",
"| d[i] | i-th item of d, starting index 0 |\n",
"| d[i:j] | slice of d from i to j |\n",
"| d[i:j:k] | slice of d from i to j with step k |\n",
"\n",
"With this convenient syntax many basic tasks can be easily done."
]
Expand Down Expand Up @@ -243,15 +242,15 @@
"\n",
"As these operators basically call ITK filter, which just use raw C++ operators, care must be taken to prevent overflow, and divide by zero etc.\n",
"\n",
"<table>\n",
" <tr><td>Operators</td></tr>\n",
" <tr><td>+</td></tr>\n",
" <tr><td>-</td></tr>\n",
" <tr><td>&#42;</td></tr>\n",
" <tr><td>/</td></tr>\n",
" <tr><td>//</td></tr>\n",
" <tr><td>**</td></tr>\n",
"</table>\n"
"\n",
"| Operators |\n",
"|---|\n",
"| + |\n",
"| - |\n",
"| * |\n",
"| / |\n",
"| // |\n",
"| ** |"
]
},
{
Expand Down Expand Up @@ -296,13 +295,14 @@
"source": [
"### Bitwise Logic Operators\n",
"\n",
"<table>\n",
" <tr><td>Operators</td></tr>\n",
" <tr><td>&</td></tr>\n",
" <tr><td>|</td></tr>\n",
" <tr><td>^</td></tr>\n",
" <tr><td>~</td></tr>\n",
"</table>"
"\n",
"\n",
"| Operators |\n",
"|---|\n",
"| & |\n",
"| \\||\n",
"| ^ |\n",
"| ~ |\n"
]
},
{
Expand All @@ -320,19 +320,24 @@
"metadata": {},
"source": [
"## Comparative Operators\n",
"<table>\n",
" <tr><td>Operators</td></tr>\n",
" <tr><td>&gt;</td></tr>\n",
" <tr><td>&gt;=</td></tr>\n",
" <tr><td>&lt;</td></tr>\n",
" <tr><td>&lt;=</td></tr>\n",
" <tr><td>==</td></tr>\n",
"</table>\n",
"\n",
"| Operators |\n",
"|---|\n",
"| > |\n",
"| >= |\n",
"| < |\n",
"| <= |\n",
"| == |\n",
"\n",
"These comparative operators follow the same convention as the reset of SimpleITK for binary images. They have the pixel type of ``sitkUInt8`` with values of 0 and 1. \n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
Expand Down