Whole slide image - terminal viewer.
Refactor of wsi-tv
, with focus on clarity, caching.
make
./bin/wsi-tvx <slidepath>
-
q
- quit -
r
- reload -
d
- toggle debug info -
t
- toggle thumbnail -
j
/↓
- down -
k
/↑
- up -
l
/←
- right -
h
/→
- left -
i
- zoom in ( keeps top left constant ) -
o
- zoom out ( keeps top left constant )
- Needs terminal support for kitty image protocol.
- Terminal needs to respond to
\x1b[14t
request for pixel dimensions. - Only tested on Linux.
- Not optimal base64.
- Use race64 for base64 encoding ( with SIMD optimizations ).
- However, we convert RGBA to RGB to send less info ( 25% lesser than original for each tile ).
- Crashes sometimes, use
r
to reset. - Need to somehow make the crashes reproducible.
make test
Load from openslide and print with kitty as fast as possible, including using multiple threads.
NUM_PIXELS : 256 * 256 * 32
NUM_TILES : 4096
NUM_THREADS: 4096
❯ test_serial
Executed in 22.78 secs fish external
usr time 15.23 secs 0.00 millis 15.23 secs
sys time 1.61 secs 1.03 millis 1.61 secs*
❯ test_parallel
Executed in 17.31 secs fish external
usr time 7.40 secs 20.87 millis 7.38 secs
sys time 2.68 secs 8.27 millis 2.67 secs
Major work is done by:
void tiles_load_view(
tiles_t *tiles,
slide_t *slide,
view_t *view,
world_t *world,
int force
)`
Currently:
- Clears all tiles
- Handles full reload (
clear_screen
,slide_provision_thumbnail
) - Handles display and loading of tiles a. display loaded visible tiles b. load and display remaining visible tiles c. load left and right margin ( around visible ) d. load top and bottom margin ( around visible ) e. diplay visible tiles again
Source of issues is no control over which tiles are overwritten. Most probably, tiles that are visible are being overwritten for loading margins, etc.
Possible solutions:
- For each tile, compute 'moves' required to become visible
- Keep track of requested, loading, loaded, old :
- When loading requested tiles, load into
kitty_id
from old. - Works well with threads
- When loading requested tiles, load into
- Assign priorities :
- Maintain arrays for each distance, and load into those far away.
- Try to maintain distribution over distances.
- Keep track of requested, loading, loaded, old :
Testing:
- Using
draw_tiles_debug
- print tiles in each queue
sleep(1)
to simulate slow loading