Skip to content

Commit 562855f

Browse files
authored
Merge branch 'TissUUmaps:master' into master
2 parents bac7ea9 + f0529e7 commit 562855f

File tree

8 files changed

+27
-6
lines changed

8 files changed

+27
-6
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- Move to PySide6 instead of PyQt6
1818
- Add installers for MacOS X (.dmg) and Linux (.deb)
1919
- Update to OpenSeadragon 4.1.0
20+
- Add dzi support (opening as images directly)
2021
- Lots of minor fixes
2122

2223
## 3.1.1.6

container/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scipy<1.9.0
1+
scipy>=1.10.1
22
Flask>=2.0.0
33
openslide-python>=1.1.2
44
packaging>=21.0

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ install_requires =
2929
pyvips>=2.1.14
3030
pyyaml>=6.0
3131
h5py>=3.6.0
32-
scipy>=1.7.2
32+
scipy>=1.10.1
3333
packaging>=21.0
3434
tissuumaps-schema~=1.2.0
3535

standalone/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ PySide6-Addons==6.4.3
88
matplotlib>=3.2.2
99
pyyaml>=5.0
1010
h5py>=3.6.0
11-
scipy>=1.7.2
11+
scipy>=1.10.1
1212
tissuumaps-schema~=1.2.0

tissuumaps/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2
1+
3.2.0.1

tissuumaps/read_h5ad.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -293,13 +293,19 @@ def h5ad_to_tmap(basedir, path, library_id=None):
293293
obsListNumerical = []
294294
palette = {}
295295

296+
obsIndex = str(adata.get("/obs").attrs["_index"])
296297
for obs in obsList:
297298
if adata.get(f"/obs/{obs}/categories") is not None:
298299
obsListCategorical.append(obs)
299300
p = getPalette(adata, obs)
300301
palette[obs] = p
301-
else:
302+
elif adata.get(f"/obs/{obs}").dtype.kind in "iuf":
302303
obsListNumerical.append(obs)
304+
elif obs == obsIndex:
305+
continue
306+
else:
307+
obsListCategorical.append(obs)
308+
palette[obs] = {}
303309

304310
new_tmap_project["markerFiles"].append(
305311
{

tissuumaps/static/js/utils/glUtils.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ glUtils._regionsVS = `
535535
#define MAX_NUM_IMAGES 192
536536
537537
uniform mat2 u_viewportTransform;
538+
uniform vec2 u_canvasSize;
538539
uniform int u_transformIndex;
539540
uniform vec4 u_imageBounds;
540541
uniform int u_numScanlines;
@@ -551,6 +552,7 @@ glUtils._regionsVS = `
551552
out vec2 v_texCoord;
552553
out vec2 v_localPos;
553554
out float v_scanline;
555+
flat out float v_pixelWidth;
554556
555557
void main()
556558
{
@@ -568,6 +570,13 @@ glUtils._regionsVS = `
568570
ndcPos.y = -ndcPos.y;
569571
ndcPos = u_viewportTransform * ndcPos;
570572
573+
// Calculate pixel width in local coordinates. Need to do it here in the
574+
// vertex shader, because using pixel derivatives in the fragment shader
575+
// can cause broken stroke lines for large coordinates.
576+
vec2 ndcPos2 = ndcPos + 0.7 / u_canvasSize;
577+
mat2 viewportToLocal = inverse(u_viewportTransform * mat2(imageToViewport));
578+
v_pixelWidth = length(viewportToLocal * (ndcPos2 - ndcPos));
579+
571580
gl_Position = vec4(ndcPos, 0.0, 1.0);
572581
}
573582
`;
@@ -599,6 +608,7 @@ glUtils._regionsFS = `
599608
in vec2 v_texCoord;
600609
in vec2 v_localPos;
601610
in float v_scanline;
611+
flat in float v_pixelWidth;
602612
603613
layout(location = 0) out vec4 out_color;
604614
@@ -625,7 +635,9 @@ glUtils._regionsFS = `
625635
vec2 p = v_localPos; // Current sample position
626636
int scanline = int(v_scanline);
627637
628-
float pixelWidth = length(dFdx(p.xy));
638+
// float pixelWidth = length(dFdx(p.xy)); // Can cause precision problems!
639+
float pixelWidth = v_pixelWidth; // Safer
640+
629641
float strokeWidthPixels = u_regionStrokeWidth *
630642
(u_regionFillRule == FILL_RULE_NEVER ? STROKE_WIDTH : STROKE_WIDTH_FILLED);
631643
// For proper anti-aliasing, clamp stroke width to at least 1 pixel, and
@@ -2129,6 +2141,7 @@ glUtils._drawRegionsColorPass = function(gl, viewportTransform) {
21292141

21302142
// Set per-scene uniforms
21312143
gl.uniformMatrix2fv(gl.getUniformLocation(program, "u_viewportTransform"), false, viewportTransform);
2144+
gl.uniform2fv(gl.getUniformLocation(program, "u_canvasSize"), [gl.canvas.width, gl.canvas.height]);
21322145
gl.uniform1i(gl.getUniformLocation(program, "u_transformIndex"), collectionIndex);
21332146
gl.uniform4fv(gl.getUniformLocation(program, "u_imageBounds"), imageBounds);
21342147
gl.uniform1i(gl.getUniformLocation(program, "u_numScanlines"), numScanlines);

tissuumaps/templates/tissuumaps.html

+1
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,7 @@ <h6 class="my-2">List of plugins:</h6>
492492

493493
if (window!=window.top) {
494494
/* I'm in a frame! */
495+
OpenSeadragon.MouseTracker.passiveWheelEvents = false;
495496
document.getElementById("main-navbar").classList.add("collapse");
496497
document
497498
.getElementById("floating-navbar-toggler")

0 commit comments

Comments
 (0)