Skip to content

Commit 4ff934d

Browse files
committed
Update example notebooks
1 parent 1c505eb commit 4ff934d

3 files changed

Lines changed: 104 additions & 61 deletions

File tree

examples/cells.ipynb

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"id": "59e8a2c3",
1717
"metadata": {
1818
"execution": {
19-
"iopub.execute_input": "2025-05-06T14:59:56.209508Z",
20-
"iopub.status.busy": "2025-05-06T14:59:56.209311Z",
21-
"iopub.status.idle": "2025-05-06T14:59:56.625154Z",
22-
"shell.execute_reply": "2025-05-06T14:59:56.624760Z"
19+
"iopub.execute_input": "2025-05-06T15:12:16.535368Z",
20+
"iopub.status.busy": "2025-05-06T15:12:16.535248Z",
21+
"iopub.status.idle": "2025-05-06T15:12:16.949315Z",
22+
"shell.execute_reply": "2025-05-06T15:12:16.948927Z"
2323
},
2424
"vscode": {
2525
"languageId": "plaintext"
@@ -45,10 +45,10 @@
4545
"id": "97c2c4ed",
4646
"metadata": {
4747
"execution": {
48-
"iopub.execute_input": "2025-05-06T14:59:56.626623Z",
49-
"iopub.status.busy": "2025-05-06T14:59:56.626306Z",
50-
"iopub.status.idle": "2025-05-06T14:59:56.695333Z",
51-
"shell.execute_reply": "2025-05-06T14:59:56.695009Z"
48+
"iopub.execute_input": "2025-05-06T15:12:16.950851Z",
49+
"iopub.status.busy": "2025-05-06T15:12:16.950474Z",
50+
"iopub.status.idle": "2025-05-06T15:12:17.020286Z",
51+
"shell.execute_reply": "2025-05-06T15:12:17.019851Z"
5252
},
5353
"vscode": {
5454
"languageId": "plaintext"
@@ -90,10 +90,10 @@
9090
"id": "ed16156a",
9191
"metadata": {
9292
"execution": {
93-
"iopub.execute_input": "2025-05-06T14:59:56.696789Z",
94-
"iopub.status.busy": "2025-05-06T14:59:56.696539Z",
95-
"iopub.status.idle": "2025-05-06T14:59:57.564895Z",
96-
"shell.execute_reply": "2025-05-06T14:59:57.564352Z"
93+
"iopub.execute_input": "2025-05-06T15:12:17.022909Z",
94+
"iopub.status.busy": "2025-05-06T15:12:17.022516Z",
95+
"iopub.status.idle": "2025-05-06T15:12:17.937307Z",
96+
"shell.execute_reply": "2025-05-06T15:12:17.936916Z"
9797
},
9898
"vscode": {
9999
"languageId": "plaintext"
@@ -158,10 +158,10 @@
158158
"id": "d35452de",
159159
"metadata": {
160160
"execution": {
161-
"iopub.execute_input": "2025-05-06T14:59:57.566533Z",
162-
"iopub.status.busy": "2025-05-06T14:59:57.566426Z",
163-
"iopub.status.idle": "2025-05-06T14:59:58.006683Z",
164-
"shell.execute_reply": "2025-05-06T14:59:58.006196Z"
161+
"iopub.execute_input": "2025-05-06T15:12:17.939153Z",
162+
"iopub.status.busy": "2025-05-06T15:12:17.938973Z",
163+
"iopub.status.idle": "2025-05-06T15:12:18.345469Z",
164+
"shell.execute_reply": "2025-05-06T15:12:18.345011Z"
165165
},
166166
"vscode": {
167167
"languageId": "plaintext"
@@ -210,10 +210,10 @@
210210
"id": "c33d38bc",
211211
"metadata": {
212212
"execution": {
213-
"iopub.execute_input": "2025-05-06T14:59:58.010047Z",
214-
"iopub.status.busy": "2025-05-06T14:59:58.009937Z",
215-
"iopub.status.idle": "2025-05-06T14:59:58.015272Z",
216-
"shell.execute_reply": "2025-05-06T14:59:58.014845Z"
213+
"iopub.execute_input": "2025-05-06T15:12:18.349265Z",
214+
"iopub.status.busy": "2025-05-06T15:12:18.349039Z",
215+
"iopub.status.idle": "2025-05-06T15:12:18.354281Z",
216+
"shell.execute_reply": "2025-05-06T15:12:18.353878Z"
217217
},
218218
"vscode": {
219219
"languageId": "plaintext"
@@ -240,10 +240,10 @@
240240
"id": "ea6ed2dd",
241241
"metadata": {
242242
"execution": {
243-
"iopub.execute_input": "2025-05-06T14:59:58.016793Z",
244-
"iopub.status.busy": "2025-05-06T14:59:58.016657Z",
245-
"iopub.status.idle": "2025-05-06T14:59:58.480172Z",
246-
"shell.execute_reply": "2025-05-06T14:59:58.479669Z"
243+
"iopub.execute_input": "2025-05-06T15:12:18.355830Z",
244+
"iopub.status.busy": "2025-05-06T15:12:18.355563Z",
245+
"iopub.status.idle": "2025-05-06T15:12:18.827230Z",
246+
"shell.execute_reply": "2025-05-06T15:12:18.826737Z"
247247
},
248248
"vscode": {
249249
"languageId": "plaintext"
@@ -304,10 +304,10 @@
304304
"id": "b00a9d85",
305305
"metadata": {
306306
"execution": {
307-
"iopub.execute_input": "2025-05-06T14:59:58.482620Z",
308-
"iopub.status.busy": "2025-05-06T14:59:58.482298Z",
309-
"iopub.status.idle": "2025-05-06T14:59:59.040292Z",
310-
"shell.execute_reply": "2025-05-06T14:59:59.039830Z"
307+
"iopub.execute_input": "2025-05-06T15:12:18.830020Z",
308+
"iopub.status.busy": "2025-05-06T15:12:18.829631Z",
309+
"iopub.status.idle": "2025-05-06T15:12:19.375165Z",
310+
"shell.execute_reply": "2025-05-06T15:12:19.374707Z"
311311
},
312312
"vscode": {
313313
"languageId": "plaintext"

examples/cthead.ipynb

Lines changed: 75 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
"id": "94b5ef80",
1717
"metadata": {
1818
"execution": {
19-
"iopub.execute_input": "2025-05-06T15:00:00.606116Z",
20-
"iopub.status.busy": "2025-05-06T15:00:00.605715Z",
21-
"iopub.status.idle": "2025-05-06T15:00:01.032329Z",
22-
"shell.execute_reply": "2025-05-06T15:00:01.031919Z"
19+
"iopub.execute_input": "2025-05-06T15:12:20.953919Z",
20+
"iopub.status.busy": "2025-05-06T15:12:20.953741Z",
21+
"iopub.status.idle": "2025-05-06T15:12:21.377249Z",
22+
"shell.execute_reply": "2025-05-06T15:12:21.376868Z"
2323
},
2424
"vscode": {
2525
"languageId": "plaintext"
@@ -51,10 +51,10 @@
5151
"id": "1ee080d3",
5252
"metadata": {
5353
"execution": {
54-
"iopub.execute_input": "2025-05-06T15:00:01.033832Z",
55-
"iopub.status.busy": "2025-05-06T15:00:01.033665Z",
56-
"iopub.status.idle": "2025-05-06T15:00:01.159986Z",
57-
"shell.execute_reply": "2025-05-06T15:00:01.159598Z"
54+
"iopub.execute_input": "2025-05-06T15:12:21.378734Z",
55+
"iopub.status.busy": "2025-05-06T15:12:21.378466Z",
56+
"iopub.status.idle": "2025-05-06T15:12:21.505526Z",
57+
"shell.execute_reply": "2025-05-06T15:12:21.505139Z"
5858
},
5959
"vscode": {
6060
"languageId": "plaintext"
@@ -112,10 +112,10 @@
112112
"id": "7af5a922",
113113
"metadata": {
114114
"execution": {
115-
"iopub.execute_input": "2025-05-06T15:00:01.161687Z",
116-
"iopub.status.busy": "2025-05-06T15:00:01.161575Z",
117-
"iopub.status.idle": "2025-05-06T15:00:02.113539Z",
118-
"shell.execute_reply": "2025-05-06T15:00:02.113208Z"
115+
"iopub.execute_input": "2025-05-06T15:12:21.507227Z",
116+
"iopub.status.busy": "2025-05-06T15:12:21.506988Z",
117+
"iopub.status.idle": "2025-05-06T15:12:22.456790Z",
118+
"shell.execute_reply": "2025-05-06T15:12:22.456432Z"
119119
},
120120
"vscode": {
121121
"languageId": "plaintext"
@@ -180,10 +180,10 @@
180180
"id": "493f1153",
181181
"metadata": {
182182
"execution": {
183-
"iopub.execute_input": "2025-05-06T15:00:02.114668Z",
184-
"iopub.status.busy": "2025-05-06T15:00:02.114562Z",
185-
"iopub.status.idle": "2025-05-06T15:00:02.593785Z",
186-
"shell.execute_reply": "2025-05-06T15:00:02.593320Z"
183+
"iopub.execute_input": "2025-05-06T15:12:22.458453Z",
184+
"iopub.status.busy": "2025-05-06T15:12:22.458252Z",
185+
"iopub.status.idle": "2025-05-06T15:12:22.955364Z",
186+
"shell.execute_reply": "2025-05-06T15:12:22.955038Z"
187187
},
188188
"vscode": {
189189
"languageId": "plaintext"
@@ -234,10 +234,10 @@
234234
"id": "6e7f236c",
235235
"metadata": {
236236
"execution": {
237-
"iopub.execute_input": "2025-05-06T15:00:02.595470Z",
238-
"iopub.status.busy": "2025-05-06T15:00:02.595160Z",
239-
"iopub.status.idle": "2025-05-06T15:00:03.424846Z",
240-
"shell.execute_reply": "2025-05-06T15:00:03.424373Z"
237+
"iopub.execute_input": "2025-05-06T15:12:22.958009Z",
238+
"iopub.status.busy": "2025-05-06T15:12:22.957852Z",
239+
"iopub.status.idle": "2025-05-06T15:12:23.787774Z",
240+
"shell.execute_reply": "2025-05-06T15:12:23.787334Z"
241241
},
242242
"vscode": {
243243
"languageId": "plaintext"
@@ -297,10 +297,10 @@
297297
"id": "696c040a",
298298
"metadata": {
299299
"execution": {
300-
"iopub.execute_input": "2025-05-06T15:00:03.426239Z",
301-
"iopub.status.busy": "2025-05-06T15:00:03.425947Z",
302-
"iopub.status.idle": "2025-05-06T15:00:04.248022Z",
303-
"shell.execute_reply": "2025-05-06T15:00:04.247639Z"
300+
"iopub.execute_input": "2025-05-06T15:12:23.789629Z",
301+
"iopub.status.busy": "2025-05-06T15:12:23.789521Z",
302+
"iopub.status.idle": "2025-05-06T15:12:24.627322Z",
303+
"shell.execute_reply": "2025-05-06T15:12:24.626880Z"
304304
},
305305
"vscode": {
306306
"languageId": "plaintext"
@@ -384,10 +384,10 @@
384384
"id": "30104594",
385385
"metadata": {
386386
"execution": {
387-
"iopub.execute_input": "2025-05-06T15:00:04.249930Z",
388-
"iopub.status.busy": "2025-05-06T15:00:04.249817Z",
389-
"iopub.status.idle": "2025-05-06T15:00:04.252365Z",
390-
"shell.execute_reply": "2025-05-06T15:00:04.252013Z"
387+
"iopub.execute_input": "2025-05-06T15:12:24.629240Z",
388+
"iopub.status.busy": "2025-05-06T15:12:24.629132Z",
389+
"iopub.status.idle": "2025-05-06T15:12:24.631791Z",
390+
"shell.execute_reply": "2025-05-06T15:12:24.631408Z"
391391
},
392392
"vscode": {
393393
"languageId": "plaintext"
@@ -413,10 +413,10 @@
413413
"id": "2556561b",
414414
"metadata": {
415415
"execution": {
416-
"iopub.execute_input": "2025-05-06T15:00:04.253626Z",
417-
"iopub.status.busy": "2025-05-06T15:00:04.253528Z",
418-
"iopub.status.idle": "2025-05-06T15:00:04.256229Z",
419-
"shell.execute_reply": "2025-05-06T15:00:04.255908Z"
416+
"iopub.execute_input": "2025-05-06T15:12:24.633150Z",
417+
"iopub.status.busy": "2025-05-06T15:12:24.633049Z",
418+
"iopub.status.idle": "2025-05-06T15:12:24.635847Z",
419+
"shell.execute_reply": "2025-05-06T15:12:24.635469Z"
420420
},
421421
"vscode": {
422422
"languageId": "plaintext"
@@ -437,6 +437,49 @@
437437
"source": [
438438
"data[p_bone], data[p_air]"
439439
]
440+
},
441+
{
442+
"cell_type": "markdown",
443+
"id": "45106463",
444+
"metadata": {},
445+
"source": [
446+
"Normalization to HU values now takes a simple Dreisatz:"
447+
]
448+
},
449+
{
450+
"cell_type": "code",
451+
"execution_count": 9,
452+
"id": "36b3ab19",
453+
"metadata": {
454+
"execution": {
455+
"iopub.execute_input": "2025-05-06T15:12:24.637147Z",
456+
"iopub.status.busy": "2025-05-06T15:12:24.637048Z",
457+
"iopub.status.idle": "2025-05-06T15:12:24.680185Z",
458+
"shell.execute_reply": "2025-05-06T15:12:24.679739Z"
459+
},
460+
"vscode": {
461+
"languageId": "plaintext"
462+
}
463+
},
464+
"outputs": [
465+
{
466+
"data": {
467+
"text/plain": [
468+
"(1000.0, -1000.0)"
469+
]
470+
},
471+
"execution_count": 9,
472+
"metadata": {},
473+
"output_type": "execute_result"
474+
}
475+
],
476+
"source": [
477+
"data_huv = data - data[p_air]\n",
478+
"data_huv = (data_huv / data_huv[p_bone]) * 2000 - 1000\n",
479+
"data_huv = data_huv.clip(-1024, 3071)\n",
480+
"\n",
481+
"data_huv[p_bone], data_huv[p_air]"
482+
]
440483
}
441484
],
442485
"metadata": {

misc/libcarna/_transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def point(self, xyz: np.ndarray = np.zeros(3)) -> np.ndarray:
2626
return self.mat @ np.array([*xyz, 1.0])
2727

2828
def intpoint(self, *args, **kwargs) -> tuple[int, int, int]:
29-
return tuple(self.point(*args, **kwargs).rint())[:3]
29+
return tuple(self.point(*args, **kwargs).round().astype(int))[:3]
3030

3131
def direction(self, xyz: np.ndarray = np.zeros(3)) -> np.ndarray:
3232
return self.mat @ np.array([*xyz, 0.0])

0 commit comments

Comments
 (0)