Skip to content

Commit 30f30ea

Browse files
authored
Merge pull request #500 from zivy/updateR
Update the R setup.
2 parents 959533f + 234c9b7 commit 30f30ea

15 files changed

+649
-208
lines changed

R/00_Setup.ipynb

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,32 @@
3232
"cell_type": "code",
3333
"execution_count": null,
3434
"metadata": {
35-
"collapsed": false
35+
"collapsed": false,
36+
"jupyter": {
37+
"outputs_hidden": false
38+
},
39+
"vscode": {
40+
"languageId": "r"
41+
}
3642
},
3743
"outputs": [],
3844
"source": [
3945
"# check that all packages are installed (see requirements.txt file)\n",
40-
"required_packages <- c(\"SimpleITK\", \"rPython\", \"scatterplot3d\", \"tidyr\", \"ggplot2\", \"xtable\", \"purrr\")\n",
46+
"required_packages <- c(\"SimpleITK\", \"reticulate\", \"scatterplot3d\", \"tidyr\", \"ggplot2\", \"xtable\", \"purrr\")\n",
4147
"missing_packages <- required_packages[!unlist(lapply(required_packages, require, character.only = TRUE, quietly = TRUE))]"
4248
]
4349
},
4450
{
4551
"cell_type": "code",
4652
"execution_count": null,
4753
"metadata": {
48-
"collapsed": false
54+
"collapsed": false,
55+
"jupyter": {
56+
"outputs_hidden": false
57+
},
58+
"vscode": {
59+
"languageId": "r"
60+
}
4961
},
5062
"outputs": [],
5163
"source": [
@@ -67,8 +79,14 @@
6779
"cell_type": "code",
6880
"execution_count": null,
6981
"metadata": {
70-
"collapsed": false,
71-
"simpleitk_error_allowed": "Exception in SITK"
82+
"collapsed": false,
83+
"jupyter": {
84+
"outputs_hidden": false
85+
},
86+
"simpleitk_error_allowed": "Exception in SITK",
87+
"vscode": {
88+
"languageId": "r"
89+
}
7290
},
7391
"outputs": [],
7492
"source": [
@@ -91,7 +109,9 @@
91109
"cell_type": "code",
92110
"execution_count": null,
93111
"metadata": {
94-
"collapsed": true
112+
"vscode": {
113+
"languageId": "r"
114+
}
95115
},
96116
"outputs": [],
97117
"source": [
@@ -111,9 +131,9 @@
111131
"mimetype": "text/x-r-source",
112132
"name": "R",
113133
"pygments_lexer": "r",
114-
"version": "3.2.3"
134+
"version": "4.5.1"
115135
}
116136
},
117137
"nbformat": 4,
118-
"nbformat_minor": 2
138+
"nbformat_minor": 4
119139
}

R/22_Transforms.ipynb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,10 @@
482482
{
483483
"cell_type": "markdown",
484484
"metadata": {
485-
"collapsed": true
485+
"collapsed": true,
486+
"jupyter": {
487+
"outputs_hidden": true
488+
}
486489
},
487490
"source": [
488491
"## Similarity to Affine [3D]\n",
@@ -935,7 +938,10 @@
935938
{
936939
"cell_type": "markdown",
937940
"metadata": {
938-
"collapsed": true
941+
"collapsed": true,
942+
"jupyter": {
943+
"outputs_hidden": true
944+
}
939945
},
940946
"source": [
941947
"## Writing and Reading\n",
@@ -980,7 +986,7 @@
980986
"displacement$SetFixedParameters(c(field_size, field_origin, field_spacing, field_direction))\n",
981987
"displacement$SetParameters(runif(length(displacement$GetParameters())))\n",
982988
"\n",
983-
"composite_transform <- Transform(basic_transform)\n",
989+
"composite_transform <- CompositeTransform(basic_transform)\n",
984990
"composite_transform$AddTransform(displacement)\n",
985991
"\n",
986992
"full_file_name <- file.path(OUTPUT_DIR, \"composite.tfm\")\n",
@@ -1030,9 +1036,9 @@
10301036
"mimetype": "text/x-r-source",
10311037
"name": "R",
10321038
"pygments_lexer": "r",
1033-
"version": "3.5.3"
1039+
"version": "4.5.1"
10341040
}
10351041
},
10361042
"nbformat": 4,
1037-
"nbformat_minor": 1
1043+
"nbformat_minor": 4
10381044
}

R/300_Segmentation_Overview.ipynb

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
"cell_type": "code",
1616
"execution_count": null,
1717
"metadata": {
18-
"collapsed": false
18+
"collapsed": false,
19+
"jupyter": {
20+
"outputs_hidden": false
21+
}
1922
},
2023
"outputs": [],
2124
"source": [
@@ -35,7 +38,6 @@
3538
"cell_type": "code",
3639
"execution_count": null,
3740
"metadata": {
38-
"collapsed": true,
3941
"simpleitk_error_allowed": "Exception in SITK"
4042
},
4143
"outputs": [],
@@ -61,7 +63,6 @@
6163
"cell_type": "code",
6264
"execution_count": null,
6365
"metadata": {
64-
"collapsed": true,
6566
"simpleitk_error_allowed": "Exception in SITK"
6667
},
6768
"outputs": [],
@@ -76,7 +77,6 @@
7677
"cell_type": "code",
7778
"execution_count": null,
7879
"metadata": {
79-
"collapsed": true,
8080
"simpleitk_error_allowed": "Exception in SITK"
8181
},
8282
"outputs": [],
@@ -101,6 +101,9 @@
101101
"execution_count": null,
102102
"metadata": {
103103
"collapsed": false,
104+
"jupyter": {
105+
"outputs_hidden": false
106+
},
104107
"simpleitk_error_allowed": "Exception in SITK"
105108
},
106109
"outputs": [],
@@ -137,6 +140,9 @@
137140
"execution_count": null,
138141
"metadata": {
139142
"collapsed": false,
143+
"jupyter": {
144+
"outputs_hidden": false
145+
},
140146
"simpleitk_error_allowed": "Exception in SITK"
141147
},
142148
"outputs": [],
@@ -148,7 +154,7 @@
148154
"seg <- Image(img_T1$GetSize(), \"sitkUInt8\")\n",
149155
"seg$CopyInformation(img_T1)\n",
150156
"seg$SetPixel(seed,1)\n",
151-
"seg <- BinaryDilate(seg, 3)\n",
157+
"seg <- BinaryDilate(seg, c(3,3,3))\n",
152158
"\n",
153159
"Show(LabelOverlay(img_T1_255, seg))"
154160
]
@@ -164,7 +170,6 @@
164170
"cell_type": "code",
165171
"execution_count": null,
166172
"metadata": {
167-
"collapsed": true,
168173
"simpleitk_error_allowed": "Exception in SITK"
169174
},
170175
"outputs": [],
@@ -187,7 +192,6 @@
187192
"cell_type": "code",
188193
"execution_count": null,
189194
"metadata": {
190-
"collapsed": true,
191195
"simpleitk_error_allowed": "Exception in SITK"
192196
},
193197
"outputs": [],
@@ -212,7 +216,6 @@
212216
"cell_type": "code",
213217
"execution_count": null,
214218
"metadata": {
215-
"collapsed": true,
216219
"simpleitk_error_allowed": "Exception in SITK"
217220
},
218221
"outputs": [],
@@ -241,7 +244,6 @@
241244
"cell_type": "code",
242245
"execution_count": null,
243246
"metadata": {
244-
"collapsed": true,
245247
"simpleitk_error_allowed": "Exception in SITK"
246248
},
247249
"outputs": [],
@@ -264,7 +266,6 @@
264266
"cell_type": "code",
265267
"execution_count": null,
266268
"metadata": {
267-
"collapsed": true,
268269
"simpleitk_error_allowed": "Exception in SITK"
269270
},
270271
"outputs": [],
@@ -291,7 +292,6 @@
291292
"cell_type": "code",
292293
"execution_count": null,
293294
"metadata": {
294-
"collapsed": true,
295295
"simpleitk_error_allowed": "Exception in SITK"
296296
},
297297
"outputs": [],
@@ -323,17 +323,15 @@
323323
{
324324
"cell_type": "code",
325325
"execution_count": null,
326-
"metadata": {
327-
"collapsed": true
328-
},
326+
"metadata": {},
329327
"outputs": [],
330328
"source": [
331329
"seed <- c(132,142,96)\n",
332330
"\n",
333331
"seg <- Image(img_T1$GetSize(), \"sitkUInt8\")\n",
334332
"seg$CopyInformation(img_T1)\n",
335333
"seg$SetPixel(seed, 1)\n",
336-
"seg <- BinaryDilate(seg, 3)"
334+
"seg <- BinaryDilate(seg, c(3,3,3))"
337335
]
338336
},
339337
{
@@ -347,7 +345,10 @@
347345
"cell_type": "code",
348346
"execution_count": null,
349347
"metadata": {
350-
"collapsed": false
348+
"collapsed": false,
349+
"jupyter": {
350+
"outputs_hidden": false
351+
}
351352
},
352353
"outputs": [],
353354
"source": [
@@ -365,7 +366,10 @@
365366
"cell_type": "code",
366367
"execution_count": null,
367368
"metadata": {
368-
"collapsed": false
369+
"collapsed": false,
370+
"jupyter": {
371+
"outputs_hidden": false
372+
}
369373
},
370374
"outputs": [],
371375
"source": [
@@ -376,7 +380,10 @@
376380
"cell_type": "code",
377381
"execution_count": null,
378382
"metadata": {
379-
"collapsed": false
383+
"collapsed": false,
384+
"jupyter": {
385+
"outputs_hidden": false
386+
}
380387
},
381388
"outputs": [],
382389
"source": [
@@ -396,7 +403,6 @@
396403
"cell_type": "code",
397404
"execution_count": null,
398405
"metadata": {
399-
"collapsed": true,
400406
"simpleitk_error_allowed": "Exception in SITK"
401407
},
402408
"outputs": [],
@@ -418,9 +424,9 @@
418424
"mimetype": "text/x-r-source",
419425
"name": "R",
420426
"pygments_lexer": "r",
421-
"version": "3.2.3"
427+
"version": "4.5.1"
422428
}
423429
},
424430
"nbformat": 4,
425-
"nbformat_minor": 1
431+
"nbformat_minor": 4
426432
}

0 commit comments

Comments
 (0)