Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
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
qim3d
Merge requests
!56
Simple 3d slicer
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Merged
Simple 3d slicer
simple_3D_slicer
into
main
Overview
0
Commits
17
Pipelines
0
Changes
1
Merged
Simple 3d slicer
s184058
requested to merge
simple_3D_slicer
into
main
Feb 28, 2024
Overview
0
Commits
17
Pipelines
0
Changes
1
Implemented slicer function for viewing slices in a single arbitrary dimension with slider
Implemented orthogonal function for viewing slices in all three dimensions with slider
0
0
Merge request reports
Viewing commit
4d659969
Prev
Next
Show latest version
1 file
+
12
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
4d659969
Added type hinting
· 4d659969
Stefan Peter Engelmann Jensen
authored
Feb 18, 2024
qim3d/viz/img.py
+
12
−
2
View file @ 4d659969
Edit in single-file editor
Open in Web IDE
Show full file
"""
Provides a collection of visualization functions.
"""
from
typing
import
List
,
Optional
,
Union
import
matplotlib.pyplot
as
plt
from
matplotlib.colors
import
LinearSegmentedColormap
from
matplotlib
import
colormaps
@@ -203,8 +204,17 @@ def grid_pred(in_targ_preds, num_images=7, cmap_im="gray", cmap_segm="viridis",
return
fig
def
slices
(
vol
,
axis
=
0
,
position
=
None
,
n_slices
=
5
,
cmap
=
"
viridis
"
,
img_height
=
4
,
img_width
=
4
,
show
=
False
,
show_title
=
True
,
interpolation
=
None
):
"""
Displays one or several slices from a 3d volume.
def
slices
(
vol
:
Union
[
np
.
ndarray
,
torch
.
Tensor
],
axis
:
int
=
0
,
position
:
Optional
[
Union
[
str
,
int
,
List
[
int
]]]
=
None
,
n_slices
:
int
=
5
,
cmap
:
str
=
"
viridis
"
,
img_height
:
int
=
4
,
img_width
:
int
=
4
,
show
:
bool
=
False
,
show_title
:
bool
=
True
,
interpolation
:
Optional
[
str
]
=
None
)
->
plt
.
Figure
:
"""
Displays one or several slices from a 3d volume.
By default if `position` is None, slices plots `n_slices` linearly spaced slices.
If `position` is given as a string or integer, slices will plot an overview with `n_slices` figures around that position.
Loading