diff --git a/R/00_Setup.ipynb b/R/00_Setup.ipynb
index ba1ed783..d95836f0 100644
--- a/R/00_Setup.ipynb
+++ b/R/00_Setup.ipynb
@@ -32,12 +32,18 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
+ "vscode": {
+ "languageId": "r"
+ }
},
"outputs": [],
"source": [
"# check that all packages are installed (see requirements.txt file)\n",
- "required_packages <- c(\"SimpleITK\", \"rPython\", \"scatterplot3d\", \"tidyr\", \"ggplot2\", \"xtable\", \"purrr\")\n",
+ "required_packages <- c(\"SimpleITK\", \"reticulate\", \"scatterplot3d\", \"tidyr\", \"ggplot2\", \"xtable\", \"purrr\")\n",
"missing_packages <- required_packages[!unlist(lapply(required_packages, require, character.only = TRUE, quietly = TRUE))]"
]
},
@@ -45,7 +51,13 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
+ "vscode": {
+ "languageId": "r"
+ }
},
"outputs": [],
"source": [
@@ -67,8 +79,14 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false,
- "simpleitk_error_allowed": "Exception in SITK"
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
+ "simpleitk_error_allowed": "Exception in SITK",
+ "vscode": {
+ "languageId": "r"
+ }
},
"outputs": [],
"source": [
@@ -91,7 +109,9 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "vscode": {
+ "languageId": "r"
+ }
},
"outputs": [],
"source": [
@@ -111,9 +131,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
}
diff --git a/R/22_Transforms.ipynb b/R/22_Transforms.ipynb
index cbed6270..1d8c0e9a 100644
--- a/R/22_Transforms.ipynb
+++ b/R/22_Transforms.ipynb
@@ -482,7 +482,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"## Similarity to Affine [3D]\n",
@@ -935,7 +938,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"## Writing and Reading\n",
@@ -980,7 +986,7 @@
"displacement$SetFixedParameters(c(field_size, field_origin, field_spacing, field_direction))\n",
"displacement$SetParameters(runif(length(displacement$GetParameters())))\n",
"\n",
- "composite_transform <- Transform(basic_transform)\n",
+ "composite_transform <- CompositeTransform(basic_transform)\n",
"composite_transform$AddTransform(displacement)\n",
"\n",
"full_file_name <- file.path(OUTPUT_DIR, \"composite.tfm\")\n",
@@ -1030,9 +1036,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.5.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/300_Segmentation_Overview.ipynb b/R/300_Segmentation_Overview.ipynb
index af479600..3855b012 100644
--- a/R/300_Segmentation_Overview.ipynb
+++ b/R/300_Segmentation_Overview.ipynb
@@ -15,7 +15,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -35,7 +38,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -61,7 +63,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -76,7 +77,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -101,6 +101,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -137,6 +140,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -148,7 +154,7 @@
"seg <- Image(img_T1$GetSize(), \"sitkUInt8\")\n",
"seg$CopyInformation(img_T1)\n",
"seg$SetPixel(seed,1)\n",
- "seg <- BinaryDilate(seg, 3)\n",
+ "seg <- BinaryDilate(seg, c(3,3,3))\n",
"\n",
"Show(LabelOverlay(img_T1_255, seg))"
]
@@ -164,7 +170,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -187,7 +192,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -212,7 +216,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -241,7 +244,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -264,7 +266,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -291,7 +292,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -323,9 +323,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"seed <- c(132,142,96)\n",
@@ -333,7 +331,7 @@
"seg <- Image(img_T1$GetSize(), \"sitkUInt8\")\n",
"seg$CopyInformation(img_T1)\n",
"seg$SetPixel(seed, 1)\n",
- "seg <- BinaryDilate(seg, 3)"
+ "seg <- BinaryDilate(seg, c(3,3,3))"
]
},
{
@@ -347,7 +345,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -365,7 +366,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -376,7 +380,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -396,7 +403,6 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true,
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -418,9 +424,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/33_Segmentation_Thresholding_Edge_Detection.ipynb b/R/33_Segmentation_Thresholding_Edge_Detection.ipynb
index 2738c3be..7eecbb8c 100644
--- a/R/33_Segmentation_Thresholding_Edge_Detection.ipynb
+++ b/R/33_Segmentation_Thresholding_Edge_Detection.ipynb
@@ -22,7 +22,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -43,6 +46,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -63,6 +69,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -104,7 +113,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -180,7 +192,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -215,6 +230,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -244,7 +262,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -259,7 +280,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"Now, solve using R's linear model fitting. We also weigh the edge points based on the gradient magnitude."
@@ -269,7 +293,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -289,7 +316,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"source": [
"## You've made it to the end of the notebook, you deserve to know the correct answer\n",
@@ -301,7 +331,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": []
@@ -319,9 +352,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 4
}
diff --git a/R/34_Segmentation_Evaluation.ipynb b/R/34_Segmentation_Evaluation.ipynb
index fb322573..35f21394 100644
--- a/R/34_Segmentation_Evaluation.ipynb
+++ b/R/34_Segmentation_Evaluation.ipynb
@@ -31,7 +31,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -53,7 +56,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -125,7 +131,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -155,7 +164,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"source": [
"## Derive a reference\n",
@@ -169,7 +181,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -188,7 +203,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -209,7 +227,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"source": [
"## Evaluate segmentations using the reference\n",
@@ -226,7 +247,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -273,7 +297,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -311,7 +338,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -341,7 +371,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -366,9 +399,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/35_Cell_Segmentation.ipynb b/R/35_Cell_Segmentation.ipynb
index 44507917..370289e9 100644
--- a/R/35_Cell_Segmentation.ipynb
+++ b/R/35_Cell_Segmentation.ipynb
@@ -69,7 +69,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -107,7 +110,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -125,7 +131,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -185,7 +194,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -205,7 +217,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -230,7 +245,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -255,7 +273,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -273,7 +294,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -284,7 +308,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -302,7 +329,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -320,7 +350,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -351,7 +384,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -402,7 +438,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -426,9 +465,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
}
diff --git a/R/60_Registration_Introduction.ipynb b/R/60_Registration_Introduction.ipynb
index a2b94a5a..e30e44e8 100644
--- a/R/60_Registration_Introduction.ipynb
+++ b/R/60_Registration_Introduction.ipynb
@@ -3,7 +3,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"
Introduction to SimpleITKv4 Registration
\n",
@@ -119,7 +122,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -148,7 +154,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -240,6 +249,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -254,7 +266,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"## Initial Alignment\n",
@@ -267,6 +282,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -317,7 +335,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -374,7 +395,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -394,6 +418,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -413,7 +440,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -435,9 +465,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/61_Registration_Introduction_Continued.ipynb b/R/61_Registration_Introduction_Continued.ipynb
index f5b4cd2f..ccf1f428 100644
--- a/R/61_Registration_Introduction_Continued.ipynb
+++ b/R/61_Registration_Introduction_Continued.ipynb
@@ -21,7 +21,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -52,7 +55,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -125,7 +131,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -144,7 +153,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -188,7 +200,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -204,7 +219,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"source": [
"Look at the transformation, what type is it?"
@@ -214,7 +232,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -224,7 +245,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"source": [
"## Final registration"
@@ -233,7 +257,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"### Version 1\n",
@@ -261,7 +288,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -287,7 +317,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -309,7 +342,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -346,7 +382,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -367,7 +406,7 @@
" Cast(moving_image, \"sitkFloat32\"))\n",
"\n",
"# Need to compose the transformations after registration.\n",
- "final_transform_v11 <- Transform(optimized_transform)\n",
+ "final_transform_v11 <- CompositeTransform(optimized_transform)\n",
"dev_null <- final_transform_v11$AddTransform(initial_transform)"
]
},
@@ -375,7 +414,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -397,7 +439,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -420,7 +465,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -449,7 +497,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -471,7 +522,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -492,9 +546,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/65_Registration_FFD.ipynb b/R/65_Registration_FFD.ipynb
index 01c438da..8772636d 100644
--- a/R/65_Registration_FFD.ipynb
+++ b/R/65_Registration_FFD.ipynb
@@ -22,7 +22,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -47,7 +50,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -72,6 +78,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -101,7 +110,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"source": [
"### Getting to know your data\n",
@@ -115,7 +127,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -150,7 +165,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -203,7 +221,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -239,7 +260,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"Another option for evaluating the registration is to use segmentation. In this case, we transfer the segmentation from one image to the other and compare the overlaps, both visually, and quantitatively.\n",
@@ -251,7 +275,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -271,6 +298,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -314,7 +344,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": []
@@ -333,9 +366,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.3.2"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/66_Registration_Demons.ipynb b/R/66_Registration_Demons.ipynb
index 407b2452..cc03e456 100644
--- a/R/66_Registration_Demons.ipynb
+++ b/R/66_Registration_Demons.ipynb
@@ -22,7 +22,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -52,7 +55,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -77,6 +83,9 @@
"execution_count": null,
"metadata": {
"collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -119,7 +128,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -165,7 +177,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -204,6 +219,9 @@
"execution_count": null,
"metadata": {
"collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -245,7 +263,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -359,7 +380,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -405,9 +429,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 4
}
diff --git a/R/70_Data_Augmentation.ipynb b/R/70_Data_Augmentation.ipynb
index 8f628117..188624ad 100644
--- a/R/70_Data_Augmentation.ipynb
+++ b/R/70_Data_Augmentation.ipynb
@@ -50,7 +50,7 @@
"execution_count": null,
"metadata": {
"simpleitk_error_allowed": "Exception in SITK"
- },
+ },
"outputs": [],
"source": [
"# The image we will resample (a grid).\n",
@@ -150,7 +150,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -183,7 +186,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -287,7 +293,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -343,7 +352,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -370,7 +382,7 @@
" # Augmentation is done in the reference image space, so we first map the points from \n",
" # the reference image space back onto itself T_aug (e.g. rotate the reference image)\n",
" # and then we map to the original image space T0.\n",
- " T_all <- Transform(T0)\n",
+ " T_all <- CompositeTransform(T0)\n",
" T_all$AddTransform(T_aug)\n",
" aug_image <- Resample(original_image, reference_image, T_all,\n",
" interpolator, default_intensity_value)\n",
@@ -385,7 +397,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"Before we can use the generate_images function we need to compute the transformation which will map points between the reference image and the current image as shown in the code cell below. \n",
@@ -434,7 +449,7 @@
" img_center <- img$TransformContinuousIndexToPhysicalPoint(img$GetSize()/2.0)\n",
" centering_transform$SetOffset(transform$GetInverse()$TransformPoint(img_center) - \n",
" reference_center)\n",
- " centered_transform <- Transform(transform)\n",
+ " centered_transform <- CompositeTransform(transform)\n",
" centered_transform$AddTransform(centering_transform)\n",
"\n",
" # Set the augmenting transform's center so that rotation is around the image center.\n",
@@ -452,7 +467,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"## What about flipping\n",
@@ -474,6 +492,9 @@
"execution_count": null,
"metadata": {
"collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -487,7 +508,7 @@
" centering_transform <- TranslationTransform(dimension)\n",
" img_center <- img$TransformContinuousIndexToPhysicalPoint(img$GetSize()/2.0)\n",
" centering_transform$SetOffset(transform$GetInverse()$TransformPoint(img_center) - reference_center)\n",
- " centered_transform <- Transform(transform)\n",
+ " centered_transform <- CompositeTransform(transform)\n",
" centered_transform$AddTransform(centering_transform)\n",
" \n",
" flipped_transform <- AffineTransform(dimension) \n",
@@ -532,6 +553,9 @@
"execution_count": null,
"metadata": {
"collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -583,7 +607,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"# Augmentation using intensity modifications\n",
@@ -611,7 +638,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -698,6 +728,9 @@
"execution_count": null,
"metadata": {
"collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -727,6 +760,9 @@
"execution_count": null,
"metadata": {
"collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ },
"simpleitk_error_allowed": "Exception in SITK"
},
"outputs": [],
@@ -766,7 +802,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": []
@@ -784,9 +823,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.4.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 2
+ "nbformat_minor": 4
}
diff --git a/R/Image_Basics.ipynb b/R/Image_Basics.ipynb
index c3947421..b72c1464 100644
--- a/R/Image_Basics.ipynb
+++ b/R/Image_Basics.ipynb
@@ -28,7 +28,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": [
@@ -52,7 +55,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -77,7 +83,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -96,7 +105,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -115,7 +127,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -136,7 +151,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -154,7 +172,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -171,7 +192,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"R, like python and MATLAB, has a flexible notation for accessing elements of arrays. SimpleITK adopts the same notation for accessing pixels (or sub images, which will be covered in a subsequent notebook). First, lets get set up so that we can display an image in the notebook."
@@ -181,7 +205,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -229,7 +256,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -240,7 +270,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -259,7 +292,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -279,7 +315,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -300,7 +339,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -311,7 +353,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"outputs": [],
"source": []
@@ -329,9 +374,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 4
}
diff --git a/R/README.md b/R/README.md
index fa8cd96d..45025fcb 100644
--- a/R/README.md
+++ b/R/README.md
@@ -5,7 +5,7 @@
1. Install [R](https://www.r-project.org/) on your machine.
2. [Install](http://jupyter.readthedocs.org/en/latest/install.html) the Jupyter environment.
3. [Install](https://github.com/IRkernel/IRkernel) the R kernel for Jupyter.
-4. Install the following R packages, at the R prompt: install.packages(c("rPython", "scatterplot3d", "tidyr", "ggplot2", "xtable", "purrr")).
+4. Install the following R packages, at the R prompt: install.packages(c("reticulate", "scatterplot3d", "tidyr", "ggplot2", "xtable", "purrr")).
### Install SimpleITK
@@ -14,7 +14,6 @@ A remotes based installer is [available on github](https://github.com/SimpleITK/
A manual approach to compiling and installing SimpleITK with the R wrapping turned on is described [here](https://simpleitk.readthedocs.io/en/latest/building.html).
-
### Downloading Data
The data is automatically downloaded to the "Data" directory when you execute the notebooks.
diff --git a/R/R_style_image.ipynb b/R/R_style_image.ipynb
index ffc3147a..f1344bc6 100644
--- a/R/R_style_image.ipynb
+++ b/R/R_style_image.ipynb
@@ -15,7 +15,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -53,7 +56,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -79,7 +85,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -97,7 +106,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -108,7 +120,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -121,7 +136,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -133,7 +151,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -144,7 +165,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -162,7 +186,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -184,6 +211,9 @@
"execution_count": null,
"metadata": {
"collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ },
"simpleitk_error_expected": "spacing is not uniform"
},
"outputs": [],
@@ -204,7 +234,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -223,7 +256,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -241,9 +277,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"img3d = GaborSource(\"sitkFloat32\", size=rep(64,3), sigma=rep(16, 3), mean=rep(32,3), frequency=.05)"
@@ -253,7 +287,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -264,7 +301,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -282,7 +322,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -301,7 +344,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -316,7 +362,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -327,7 +376,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -340,7 +392,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -360,7 +415,10 @@
"execution_count": null,
"metadata": {
"collapsed": false,
- "simpleitk_error_expected": "Exception in SITK"
+ "jupyter": {
+ "outputs_hidden": false
+ },
+ "simpleitk_error_expected": "Exception thrown in SimpleITK Add"
},
"outputs": [],
"source": [
@@ -379,7 +437,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -398,7 +459,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -409,7 +473,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -419,9 +486,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"m <- (img > 90) != (img > 150)"
@@ -431,7 +496,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
- "collapsed": false
+ "collapsed": false,
+ "jupyter": {
+ "outputs_hidden": false
+ }
},
"outputs": [],
"source": [
@@ -441,7 +509,10 @@
{
"cell_type": "markdown",
"metadata": {
- "collapsed": true
+ "collapsed": true,
+ "jupyter": {
+ "outputs_hidden": true
+ }
},
"source": [
"## It's about time\n",
@@ -454,9 +525,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"sz <- 512\n",
@@ -488,9 +557,7 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {
- "collapsed": true
- },
+ "metadata": {},
"outputs": [],
"source": [
"system.time(((im1 * im2) / im3) > 24)\n",
@@ -511,9 +578,9 @@
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
- "version": "3.2.3"
+ "version": "4.5.1"
}
},
"nbformat": 4,
- "nbformat_minor": 0
+ "nbformat_minor": 4
}
diff --git a/R/downloaddata.R b/R/downloaddata.R
old mode 100644
new mode 100755
index 74d0d764..fce71f83
--- a/R/downloaddata.R
+++ b/R/downloaddata.R
@@ -1,29 +1,42 @@
#
-# This script utilizes the existing Python download script via the R rPython package. To install the package, from the R prompt:
-# install.packages("rPython") and then select the mirror from which to download it.
+# This script utilizes the existing Python download script via the R reticulate package. To install the package, from the R prompt:
+# install.packages("reticulate") and then select the mirror from which to download it.
# Note that all of the feedback with regard to download progress goes to the console and is not visible in the notebook as is
# the case with the Python notebooks.
#
-if (!require(rPython)) {
- stop("rPython library not installed - run install.packages('rPython')\n")
+if (!require(reticulate)) {
+ stop("reticulate library not installed - run install.packages('reticulate')\n")
}
# Find the python script directory, under the Utilities directory in the repository. We are assuming here that this file
# is sourced with chdir equals true [source('ddata.R', chdir=T)]
python_script_dir <- normalizePath("../Utilities")
-python.exec("import os")
-python.exec("import sys")
-python.exec(paste("sys.path.append('", python_script_dir,"')",sep=""))
-python.exec("from downloaddata import fetch_data, fetch_data_all")
+# Import Python's sys module and add the Utilities directory to the path
+sys <- import("sys", convert = FALSE)
-fetch_data<-function(cache_file_name, verify=FALSE, cache_directory_name="../Data"){
- v<- if(verify) 'True' else 'False'
- python.exec( paste("filename = fetch_data(cache_file_name='",cache_file_name,"',verify=",v,", cache_directory_name='",normalizePath(cache_directory_name),"')", sep=""))
- python.get("filename")
+# The Python method returns None, suppress output using invisible() in R
+invisible(sys$path$insert(0L, python_script_dir))
+
+# Import the downloaddata module
+downloaddata <- import("downloaddata")
+
+fetch_data <- function(cache_file_name, verify=FALSE, cache_directory_name="../Data") {
+ # Call Python's fetch_data function directly
+ # reticulate automatically converts R logical to Python bool
+ result <- downloaddata$fetch_data(
+ cache_file_name = cache_file_name,
+ verify = verify,
+ cache_directory_name = normalizePath(cache_directory_name)
+ )
+ return(result)
}
-fetch_data_all<-function(output_directory, manifest_file, verify=TRUE){
- v<- if(verify) 'True' else 'False'
- python.exec(paste("fetch_data_all(output_directory='",output_directory,"',manifest_file='", manifest_file,"', verify=",v,")", sep=""))
+fetch_data_all <- function(output_directory, manifest_file, verify=TRUE) {
+ # Call Python's fetch_data_all function directly
+ downloaddata$fetch_data_all(
+ output_directory = output_directory,
+ manifest_file = manifest_file,
+ verify = verify
+ )
}