|
16 | 16 | "id": "94b5ef80", |
17 | 17 | "metadata": { |
18 | 18 | "execution": { |
19 | | - "iopub.execute_input": "2025-05-06T13:25:47.189228Z", |
20 | | - "iopub.status.busy": "2025-05-06T13:25:47.189129Z", |
21 | | - "iopub.status.idle": "2025-05-06T13:25:47.602866Z", |
22 | | - "shell.execute_reply": "2025-05-06T13:25:47.602362Z" |
| 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" |
23 | 23 | }, |
24 | 24 | "vscode": { |
25 | 25 | "languageId": "plaintext" |
|
51 | 51 | "id": "1ee080d3", |
52 | 52 | "metadata": { |
53 | 53 | "execution": { |
54 | | - "iopub.execute_input": "2025-05-06T13:25:47.604220Z", |
55 | | - "iopub.status.busy": "2025-05-06T13:25:47.604051Z", |
56 | | - "iopub.status.idle": "2025-05-06T13:25:47.730606Z", |
57 | | - "shell.execute_reply": "2025-05-06T13:25:47.730148Z" |
| 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" |
58 | 58 | }, |
59 | 59 | "vscode": { |
60 | 60 | "languageId": "plaintext" |
|
112 | 112 | "id": "7af5a922", |
113 | 113 | "metadata": { |
114 | 114 | "execution": { |
115 | | - "iopub.execute_input": "2025-05-06T13:25:47.731665Z", |
116 | | - "iopub.status.busy": "2025-05-06T13:25:47.731561Z", |
117 | | - "iopub.status.idle": "2025-05-06T13:25:48.684375Z", |
118 | | - "shell.execute_reply": "2025-05-06T13:25:48.683911Z" |
| 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" |
119 | 119 | }, |
120 | 120 | "vscode": { |
121 | 121 | "languageId": "plaintext" |
|
145 | 145 | "\n", |
146 | 146 | "# Create and configure scene\n", |
147 | 147 | "root = libcarna.node()\n", |
148 | | - "libcarna.volume(\n", |
| 148 | + "volume = libcarna.volume(\n", |
149 | 149 | " GEOMETRY_TYPE_VOLUME,\n", |
150 | 150 | " data / data.max(),\n", |
151 | 151 | " parent=root,\n", |
|
180 | 180 | "id": "493f1153", |
181 | 181 | "metadata": { |
182 | 182 | "execution": { |
183 | | - "iopub.execute_input": "2025-05-06T13:25:48.685887Z", |
184 | | - "iopub.status.busy": "2025-05-06T13:25:48.685780Z", |
185 | | - "iopub.status.idle": "2025-05-06T13:25:49.177131Z", |
186 | | - "shell.execute_reply": "2025-05-06T13:25:49.176690Z" |
| 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" |
187 | 187 | }, |
188 | 188 | "vscode": { |
189 | 189 | "languageId": "plaintext" |
|
234 | 234 | "id": "6e7f236c", |
235 | 235 | "metadata": { |
236 | 236 | "execution": { |
237 | | - "iopub.execute_input": "2025-05-06T13:25:49.179468Z", |
238 | | - "iopub.status.busy": "2025-05-06T13:25:49.179339Z", |
239 | | - "iopub.status.idle": "2025-05-06T13:25:50.011254Z", |
240 | | - "shell.execute_reply": "2025-05-06T13:25:50.010793Z" |
| 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" |
241 | 241 | }, |
242 | 242 | "vscode": { |
243 | 243 | "languageId": "plaintext" |
|
297 | 297 | "id": "696c040a", |
298 | 298 | "metadata": { |
299 | 299 | "execution": { |
300 | | - "iopub.execute_input": "2025-05-06T13:25:50.012839Z", |
301 | | - "iopub.status.busy": "2025-05-06T13:25:50.012725Z", |
302 | | - "iopub.status.idle": "2025-05-06T13:25:50.855577Z", |
303 | | - "shell.execute_reply": "2025-05-06T13:25:50.855025Z" |
| 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" |
304 | 304 | }, |
305 | 305 | "vscode": { |
306 | 306 | "languageId": "plaintext" |
|
328 | 328 | "ball = libcarna.mesh_factory.create_ball(10)\n", |
329 | 329 | "\n", |
330 | 330 | "# Add a marker for bone (red)\n", |
331 | | - "libcarna.geometry(\n", |
| 331 | + "marker_bone = libcarna.geometry(\n", |
332 | 332 | " GEOMETRY_TYPE_OPAQUE,\n", |
333 | 333 | " parent=root,\n", |
334 | 334 | " local_transform=libcarna.translate(-43, 20, 0),\n", |
|
340 | 340 | ")\n", |
341 | 341 | "\n", |
342 | 342 | "# Add a marker for air (green)\n", |
343 | | - "libcarna.geometry(\n", |
| 343 | + "marker_air = libcarna.geometry(\n", |
344 | 344 | " GEOMETRY_TYPE_OPAQUE,\n", |
345 | 345 | " parent=root,\n", |
346 | 346 | " local_transform=libcarna.translate(-80, 0, 0),\n", |
|
373 | 373 | "Note that we use `dvr.replicate()` when adding the previously defined DVR to the renderer. This is because each\n", |
374 | 374 | "rendering stage can only be added to one renderer, hence, we replicate it this time. Of course, we could have used the\n", |
375 | 375 | "`dvr.replicate()` method the first time that we added the DVR to a renderer, too, but this is not mandatory. All\n", |
376 | | - "rendering stages provide such a method." |
| 376 | + "rendering stages provide such a method.\n", |
| 377 | + "\n", |
| 378 | + "Next, we compute the voxel coordinates of the markers:" |
| 379 | + ] |
| 380 | + }, |
| 381 | + { |
| 382 | + "cell_type": "code", |
| 383 | + "execution_count": 7, |
| 384 | + "id": "30104594", |
| 385 | + "metadata": { |
| 386 | + "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" |
| 391 | + }, |
| 392 | + "vscode": { |
| 393 | + "languageId": "plaintext" |
| 394 | + } |
| 395 | + }, |
| 396 | + "outputs": [], |
| 397 | + "source": [ |
| 398 | + "p_bone = volume.transform_into_voxels_from(marker_bone).intpoint()\n", |
| 399 | + "p_air = volume.transform_into_voxels_from(marker_air ).intpoint()" |
| 400 | + ] |
| 401 | + }, |
| 402 | + { |
| 403 | + "cell_type": "markdown", |
| 404 | + "id": "5449dd14", |
| 405 | + "metadata": {}, |
| 406 | + "source": [ |
| 407 | + "Now we can directy read out the image intensities of the markers:" |
| 408 | + ] |
| 409 | + }, |
| 410 | + { |
| 411 | + "cell_type": "code", |
| 412 | + "execution_count": 8, |
| 413 | + "id": "2556561b", |
| 414 | + "metadata": { |
| 415 | + "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" |
| 420 | + }, |
| 421 | + "vscode": { |
| 422 | + "languageId": "plaintext" |
| 423 | + } |
| 424 | + }, |
| 425 | + "outputs": [ |
| 426 | + { |
| 427 | + "data": { |
| 428 | + "text/plain": [ |
| 429 | + "(2105, 53)" |
| 430 | + ] |
| 431 | + }, |
| 432 | + "execution_count": 8, |
| 433 | + "metadata": {}, |
| 434 | + "output_type": "execute_result" |
| 435 | + } |
| 436 | + ], |
| 437 | + "source": [ |
| 438 | + "data[p_bone], data[p_air]" |
377 | 439 | ] |
378 | 440 | } |
379 | 441 | ], |
|
0 commit comments