Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 134 additions & 91 deletions docs/assets/js/widget.js

Large diffs are not rendered by default.

28 changes: 19 additions & 9 deletions js/deck-gl/core/calc_viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ export const calc_viewport = async (
return;
}

const tiles_in_view = visibleTiles(
viz_state.bounds.min_x,
viz_state.bounds.max_x,
viz_state.bounds.min_y,
viz_state.bounds.max_y,
tile_size
);

if (tiles_in_view.length < max_tiles_to_view) {
// only calculate the visibleTiles if the technology is not 'point-cloud'
let tiles_in_view
if (viz_state.img.landscape_parameters.technology !== 'point-cloud') {

tiles_in_view = visibleTiles(
viz_state.bounds.min_x,
viz_state.bounds.max_x,
viz_state.bounds.min_y,
viz_state.bounds.max_y,
tile_size
);

} else {
tiles_in_view = []

Copilot AI Oct 8, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing semicolon at the end of the statement. JavaScript statements should end with semicolons for consistency and to avoid potential issues.

Suggested change
tiles_in_view = []
tiles_in_view = [];

Copilot uses AI. Check for mistakes.
}

// load tiles only if technology is not point-cloud and the number of tiles is less than max_tiles_to_view
if (tiles_in_view.length < max_tiles_to_view && viz_state.img.landscape_parameters.technology !== 'point-cloud') {

viz_state.obs_store.deck_check.set({
...viz_state.obs_store.deck_check.get(),
trx_data: false,
Expand Down
2 changes: 1 addition & 1 deletion js/deck-gl/layers/cell_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export const ini_cell_layer = async (base_url, viz_state) => {
cell_layer = new PointCloudLayer({
id: 'cell-layer',
sizeUnits: 'meters',
pointSize: 5,
pointSize: viz_state.cells.point_cloud_radius,
pickable: true,
getColor: (i, d) => get_cell_color(viz_state.cats, i, d),
data: viz_state.spatial.cell_scatter_data_objects,
Expand Down
4 changes: 2 additions & 2 deletions js/ui/sliders.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const tile_slider_callback = async (deck_sst, viz_state, layers_sst) => {
};

const cell_slider_callback = async (deck_ist, layers_obj, viz_state) => {
const scale_down_cell_radius = 5;
const calc_scaled_radius = ((viz_state.sliders.cell.value / 100) + 0.5) * viz_state.cells.point_cloud_radius;

update_cell_layer_radius(
layers_obj,
viz_state.sliders.cell.value / scale_down_cell_radius,
calc_scaled_radius,
viz_state
);

Expand Down
6 changes: 5 additions & 1 deletion js/viz/landscape_ist.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export const landscape_ist = async (
creds = {},
view_change_custom_callback = null,
rotation_orbit = 0,
rotation_x = 0
rotation_x = 0,
point_cloud_radius = 5
) => {
if (width === 0) {
width = '100%';
Expand Down Expand Up @@ -306,6 +307,9 @@ export const landscape_ist = async (
viz_state.img.image_layer_colors = {};
viz_state.img.image_layer_sliders = {};

viz_state.cells = {};
viz_state.cells.point_cloud_radius = point_cloud_radius;

set_options(token);

// move this to landscape_parameters
Expand Down
4 changes: 3 additions & 1 deletion js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const render_landscape_ist = async ({ model, el }) => {
landscape_state = 'spatial';
}
const segmentation = model.get('segmentation');
const point_cloud_radius = model.get('point_cloud_radius');

return landscape_ist(
el,
Expand All @@ -83,7 +84,8 @@ const render_landscape_ist = async ({ model, el }) => {
creds,
null,
rotation_orbit,
rotation_x
rotation_x,
point_cloud_radius
);
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "celldega",
"version": "0.14.0-alpha.2",
"version": "0.14.0-alpha.3",
"type": "module",
"engines": {
"node": ">=16",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "celldega"
version = "0.14.0a2"
version = "0.14.0a3"
readme = "README.md"
dependencies = [
"anndata~=0.11.0",
Expand Down
3 changes: 3 additions & 0 deletions src/celldega/viz/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Landscape(anywidget.AnyWidget):
base_url = traitlets.Unicode("").tag(sync=True)
token = traitlets.Unicode("").tag(sync=True)
creds = traitlets.Dict({}).tag(sync=True)
max_tiles_to_view = traitlets.Int(50).tag(sync=True)
ini_x = traitlets.Float().tag(sync=True)
ini_y = traitlets.Float().tag(sync=True)
ini_z = traitlets.Float().tag(sync=True)
Expand Down Expand Up @@ -109,6 +110,8 @@ class Landscape(anywidget.AnyWidget):
width = traitlets.Int(0).tag(sync=True)
height = traitlets.Int(800).tag(sync=True)

point_cloud_radius = traitlets.Float(5).tag(sync=True)

def __init__(self, **kwargs):
adata = kwargs.pop("adata", None) or kwargs.pop("AnnData", None)
pq_meta_cell = kwargs.pop("meta_cell_parquet", None)
Expand Down
Loading