Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Notebooks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Tools
Notebooks
Commits
d406f412
Commit
d406f412
authored
1 year ago
by
fima
Browse files
Options
Downloads
Patches
Plain Diff
simple sinogram check
parent
088c9931
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
reconstruction/check_sinogram.ipynb
+105
-0
105 additions, 0 deletions
reconstruction/check_sinogram.ipynb
resources/img3d/small_foram.h5
+0
-0
0 additions, 0 deletions
resources/img3d/small_foram.h5
with
105 additions
and
0 deletions
reconstruction/check_sinogram.ipynb
0 → 100644
+
105
−
0
View file @
d406f412
{
"cells": [
{
"cell_type": "markdown",
"id": "f79ab52a",
"metadata": {},
"source": [
"# Simple sinogram check\n",
"author: Felipe Delestro (fima@dtu.dk)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "b5096870",
"metadata": {},
"outputs": [],
"source": [
"import qim3d\n",
"import matplotlib.pyplot as plt\n",
"import ipywidgets"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "6b9a1f66",
"metadata": {},
"outputs": [],
"source": [
"vol = qim3d.io.load(\"../resources/img3d/small_foram.h5\", dataset_name=\"exchange/data\")"
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "99832d5a",
"metadata": {},
"outputs": [],
"source": [
"def plot_sinogram(vol, zpos, ypos):\n",
" fig, axs = plt.subplots(nrows=1, ncols=2, figsize=(8,10), sharey=True)\n",
" \n",
" axs[0].imshow(vol[zpos,:,:])\n",
" axs[0].axhline(ypos, color=\"#FF6633\")\n",
" axs[0].axis(\"off\")\n",
" \n",
" axs[1].imshow(vol[:,ypos,:])\n",
" axs[1].axis(\"off\")\n",
" \n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "0395e573",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b920afa7cc3b47d99cc824b3afad9589",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(IntSlider(value=360, description='zpos', max=720), IntSlider(value=130, description='ypo…"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ipywidgets.interactive(plot_sinogram,\n",
" vol = ipywidgets.fixed(vol),\n",
" zpos = ipywidgets.IntSlider(min=0, max=vol.shape[0]-1, value=int(vol.shape[0]/2)),\n",
" ypos = ipywidgets.IntSlider(min=0, max=vol.shape[1]-1, value=int(vol.shape[1]/2)))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:f79ab52a tags:
# Simple sinogram check
author: Felipe Delestro (fima@dtu.dk)
%% Cell type:code id:b5096870 tags:
```
python
import
qim3d
import
matplotlib.pyplot
as
plt
import
ipywidgets
```
%% Cell type:code id:6b9a1f66 tags:
```
python
vol
=
qim3d
.
io
.
load
(
"
../resources/img3d/small_foram.h5
"
,
dataset_name
=
"
exchange/data
"
)
```
%% Cell type:code id:99832d5a tags:
```
python
def
plot_sinogram
(
vol
,
zpos
,
ypos
):
fig
,
axs
=
plt
.
subplots
(
nrows
=
1
,
ncols
=
2
,
figsize
=
(
8
,
10
),
sharey
=
True
)
axs
[
0
].
imshow
(
vol
[
zpos
,:,:])
axs
[
0
].
axhline
(
ypos
,
color
=
"
#FF6633
"
)
axs
[
0
].
axis
(
"
off
"
)
axs
[
1
].
imshow
(
vol
[:,
ypos
,:])
axs
[
1
].
axis
(
"
off
"
)
plt
.
show
()
```
%% Cell type:code id:0395e573 tags:
```
python
ipywidgets
.
interactive
(
plot_sinogram
,
vol
=
ipywidgets
.
fixed
(
vol
),
zpos
=
ipywidgets
.
IntSlider
(
min
=
0
,
max
=
vol
.
shape
[
0
]
-
1
,
value
=
int
(
vol
.
shape
[
0
]
/
2
)),
ypos
=
ipywidgets
.
IntSlider
(
min
=
0
,
max
=
vol
.
shape
[
1
]
-
1
,
value
=
int
(
vol
.
shape
[
1
]
/
2
)))
```
%% Output
interactive(children=(IntSlider(value=360, description='zpos', max=720), IntSlider(value=130, description='ypo…
This diff is collapsed.
Click to expand it.
resources/img3d/small_foram.h5
0 → 100644
+
0
−
0
View file @
d406f412
File added
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment