-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8375f1
commit e63bd28
Showing
6 changed files
with
85 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"""Passive visualisation tools for browsing RELION cryo-ET data.""" | ||
|
||
from .tilt_series import view_tilt_series | ||
from .tomograms import view_tomograms | ||
|
||
from ._cli import cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import typer | ||
|
||
CLI_NAME = 'relion_tomo_view' | ||
cli = typer.Typer(name=CLI_NAME, add_completion=False, no_args_is_help=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from pathlib import Path | ||
|
||
import typer | ||
|
||
from .._qt.components.tilt_series_browser import TiltSeriesBrowserWidget | ||
from .._metadata_models.relion.tilt_series_set import RlnTiltSeriesSet | ||
from ..view._cli import cli | ||
|
||
COMMAND_NAME = 'tilt-series' | ||
|
||
|
||
@cli.command(name=COMMAND_NAME, no_args_is_help=True) | ||
def view_tilt_series( | ||
tilt_series_star_file: Path = typer.Option(...), | ||
cache_size: int = typer.Option(5, help='number of cached tilt-series') | ||
): | ||
import napari # local to speedup CLI | ||
viewer = napari.Viewer(ndisplay=3) | ||
relion_metadata = RlnTiltSeriesSet.from_star_file(tilt_series_star_file) | ||
for tilt_series in relion_metadata.tilt_series: | ||
tilt_series.data = tilt_series.data.sort_values( | ||
by='rlnTomoNominalStageTiltAngle') | ||
gui_model = relion_metadata.as_gui_model() | ||
dock_widget = TiltSeriesBrowserWidget(viewer, gui_model, cache_size=cache_size) | ||
viewer.window.add_dock_widget( | ||
dock_widget, name='RELION tilt-series viewer', area='left' | ||
) | ||
viewer.text_overlay.text = """ | ||
keyboard shortcuts | ||
- '[' and ']' for previous/next tilt-series | ||
""" | ||
viewer.text_overlay.visible = True | ||
napari.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from pathlib import Path | ||
import typer | ||
|
||
from .._qt.components.tomogram_browser import TomogramBrowserWidget | ||
from .._metadata_models.relion.tilt_series_set import RlnTiltSeriesSet | ||
from ..view._cli import cli | ||
|
||
COMMAND_NAME = 'tomograms' | ||
|
||
|
||
@cli.command(name=COMMAND_NAME, no_args_is_help=True) | ||
def view_tomograms( | ||
tilt_series_star_file: Path = typer.Option(...), | ||
cache_size: int = typer.Option(3, help='number of cached tomograms') | ||
): | ||
import napari # local to speed up CLI | ||
viewer = napari.Viewer(ndisplay=3) | ||
relion_metadata = RlnTiltSeriesSet.from_star_file(tilt_series_star_file) | ||
gui_model = relion_metadata.as_gui_model() | ||
dock_widget = TomogramBrowserWidget(viewer, gui_model, cache_size=cache_size) | ||
viewer.window.add_dock_widget( | ||
dock_widget, name='RELION tomogram viewer', area='left' | ||
) | ||
viewer.axes.visible = True | ||
viewer.axes.labels = False | ||
viewer.camera.angles = (-15, 30, 150) | ||
viewer.camera.zoom *= 0.7 | ||
viewer.text_overlay.text = """ | ||
keyboard shortcuts | ||
- '[' and ']' for previous/next tomogram | ||
- 'x'/'y'/'z'/'o' to reorient the plane (around the cursor) | ||
mouse controls | ||
- 'Shift' + click + drag to move the plane along its normal | ||
""" | ||
viewer.text_overlay.visible = True | ||
napari.run() |