Skip to content

Commit

Permalink
Merge pull request #1799 from girder/girder-5-update-20253101
Browse files Browse the repository at this point in the history
Merge recent changes from `master` into `girder-5`
  • Loading branch information
naglepuff authored Jan 31, 2025
2 parents 8b214e1 + 8383cdf commit 9587bed
Show file tree
Hide file tree
Showing 42 changed files with 1,059 additions and 595 deletions.
9 changes: 4 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ repos:
files: README.rst
name: rst-linter of README.rst
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
args:
- --ignore-words-list
- "hist,indext,pixelx,thex,subtile,slippy,fram"
- "hist,indext,pixelx,thex,subtile,slippy,fram,thet"
exclude: '.*\.ipynb$'
- repo: https://github.com/syntaqx/git-hooks
rev: v0.0.18
Expand All @@ -61,19 +61,18 @@ repos:
rev: v4.0.0
hooks:
- id: stylus-supremacy
language_version: "22.10.0"
args:
- '--options'
- './girder/girder_large_image/web_client/package.json'
- repo: https://github.com/asottile/pyupgrade
rev: v3.18.0
rev: v3.19.1
hooks:
- id: pyupgrade
args:
- --py38-plus
- --keep-percent-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.9.2
hooks:
- id: ruff
args:
Expand Down
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Change Log

## 1.30.7
## 1.31.1

### Improvements

- Improve how we use vips to read lower tile levels ([#1794](../../pull/1794))
- Be more specific in casting when converting images via vips ([#1795](../../pull/1795))

### Bug Fixes

- Fix an issue with lazy tiles that have non power of two scaling ([#1797](../../pull/1797))

## 1.31.0

### Features

- Add utility functions for converting between frame and axes ([#1778](../../pull/1778))
- Jupyter frame selector ([#1738](../../pull/1738), [#1792](../../pull/1792), [#1793](../../pull/1793))

### Improvements

Expand All @@ -13,10 +25,16 @@
- Don't read multiplane ndpi files with openslide ([#1772](../../pull/1772))
- Harden sources based on more fuzz testing ([#1774](../../pull/1774))
- Default to not caching source in notebooks ([#1776](../../pull/1776))
- Automatically set the JUPYTER_PROXY value ([#1781](../../pull/1781))
- Add a general channelNames property to tile sources ([#1783](../../pull/1783))
- Speed up compositing styles ([#1784](../../pull/1784))
- Better repr of large_image classes ([#1787](../../pull/1787))
- Better detect multiframe images in PIL ([#1791](../../pull/1791))

### Changes

- Allow umap-learn for graphing in girder annotations in python 3.13 ([#1780](../../pull/1780))
- List a few more known extensions for different sources ([#1790](../../pull/1790))

### Bug Fixes

Expand Down Expand Up @@ -44,7 +62,7 @@
### Changes

- Suppress a warning about nd2 files that we can't do anything about ([#1749](../../pull/1749))
- Zero empty areas in tile frames ([#1752](../../pull/1752))
- Zero empty areas in tile frames ([#1755](../../pull/1755))
- Don't include cache libraries in [common] deployments ([#1758](../../pull/1758))
- Specify empty_dir=yes when constructing vsicurl parameters ([#1760](../../pull/1760))
- Update how some associated images are read in tiff files ([#1763](../../pull/1763))
Expand Down
15 changes: 5 additions & 10 deletions docs/notebooks/large_image_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"\n",
"# For maximum capabilities in Jupyter, also install ipyleaflet so you can\n",
"# view zoomable images in the notebook\n",
"!pip install ipyleaflet\n",
"!pip install 'ipyleaflet>=0.19'\n",
"\n",
"# If you are accessing files on a Girder server, it is useful to install girder_client\n",
"!pip install girder_client"
Expand Down Expand Up @@ -182,6 +182,10 @@
"to an internal tile server that allows you to view the image in a zoomable viewer. There are more options\n",
"depending on your Jupyter configuration and whether it is running locally or remotely. \n",
"Some environments need different proxy options, like Google CoLab.\n",
"The system will attempt to determine the correct proxy values by default.\n",
"If you needed to, you could ask JupyterLab to locally proxy an internal tile server. As an example:\n",
"\n",
"`large_image.tilesource.jupyter.IPyLeafletMixin.JUPYTER_PROXY = True`\n",
"\n",
"If ipyleaflet isn't installed, inspecting a tile source will just show the thumbnail."
]
Expand All @@ -208,15 +212,6 @@
}
],
"source": [
"# Ask JupyterLab to locally proxy an internal tile server\n",
"import importlib.util\n",
"\n",
"if importlib.util.find_spec('google') and importlib.util.find_spec('google.colab'):\n",
" # colab intercepts localhost\n",
" large_image.tilesource.jupyter.IPyLeafletMixin.JUPYTER_PROXY = 'https://localhost'\n",
"else:\n",
" large_image.tilesource.jupyter.IPyLeafletMixin.JUPYTER_PROXY = True\n",
"\n",
"# Look at our tile source\n",
"ts"
]
Expand Down
2 changes: 1 addition & 1 deletion docs/tilesource_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ A band definition is an object which can contain the following keys:

- ``band``: the band numpy image in a band stage.

- ``mask``: a mask numpy image to use when applying the band.
- ``mask``: a mask numpy image to use when applying the band. None for no mask (this is the equivalent of the mask being all True).

- ``palette``: the normalized palette for a band.

Expand Down
3 changes: 2 additions & 1 deletion girder/girder_large_image/web_client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"promise/no-return-in-finally": "error",
"promise/no-return-wrap": "error",
"vue/require-prop-types": "off",
"vue/multiline-html-element-content-newline": "off"
"vue/multiline-html-element-content-newline": "off",
"vue/html-self-closing": "off"
},
"ignorePatterns": ["dist/**"],
"root": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import Vue from 'vue';

import largeImageConfig from './configView';
import * as viewers from './imageViewerWidget';

import imageViewerSelectWidget from '../templates/imageViewerSelectWidget.pug';
import '../stylesheets/imageViewerSelectWidget.styl';
import FrameSelector from '../vue/components/FrameSelector.vue';

import FrameSelector from '../widgets/FrameSelector.vue';
import DualInput from '../widgets/DualInput.vue';
import CompositeLayers from '../widgets/CompositeLayers.vue';
import HistogramEditor from '../widgets/HistogramEditor.vue';
import colors from '../widgets/colors.json';
import PresetsMenu from '../vue/components/PresetsMenu.vue';

const $ = girder.$;
const _ = girder._;
const {wrap} = girder.utilities.PluginUtils;
const eventStream = girder.utilities.EventStream;
const ItemView = girder.views.body.ItemView;
const View = girder.views.View;
const {restRequest} = girder.rest;

wrap(ItemView, 'render', function (render) {
// ItemView is a special case in which rendering is done asynchronously,
Expand Down Expand Up @@ -72,13 +81,33 @@ var ImageViewerSelectWidget = View.extend({

_createVue(imageMetadata, frameUpdate) {
const el = this.$('#vue-container').get(0);
const vm = new FrameSelector({
const getFrameHistogram = (params) => {
params = Object.assign({}, params);
restRequest({
type: 'GET',
url: 'item/' + this.itemId + '/tiles/histogram',
data: params
}).then((response) => {
const frameHistograms = this.vueApp._props.frameHistograms || {};
frameHistograms[params.frame] = response;
this.vueApp._props.frameHistograms = Object.assign({}, frameHistograms);
return undefined;
});
};
CompositeLayers.components = {HistogramEditor};
FrameSelector.components = {DualInput, CompositeLayers, HistogramEditor, PresetsMenu};
const Component = Vue.extend(FrameSelector);
const vm = new Component({
el,
propsData: {
currentFrame: 0,
itemId: this.itemId,
imageMetadata: imageMetadata,
frameUpdate: frameUpdate,
liConfig: this._liConfig
frameUpdate,
liConfig: this._liConfig,
frameHistograms: undefined,
getFrameHistogram,
colors
}
});
this.vueApp = vm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ var GeojsImageViewerWidget = ImageViewerWidget.extend({
_postRender: function () {
},

frameUpdate: function (frame, style) {
frameUpdate: function ({frame, style}) {
if (this._frame === undefined) {
// don't set up layers until the we access the first non-zero frame
if (frame === 0 && style === undefined) {
Expand Down Expand Up @@ -225,8 +225,8 @@ var GeojsImageViewerWidget = ImageViewerWidget.extend({
this._layer2 = ltemp;
this._updating = false;
this.trigger('g:imageFrameChanged', this, frame);
if (frame !== this._nextframe || style !== this._nextstyle) {
this.frameUpdate(this._nextframe, this._nextstyle);
if (frame !== this._nextframe || JSON.stringify(style) !== JSON.stringify(this._nextstyle)) {
this.frameUpdate({frame: this._nextframe, style: this._nextstyle});
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default {
},
styleToAutoRange(band) {
band = Object.assign({}, band); // new reference
if (band.min && band.min.includes('min:')) {
if (band.min && band.min.toString().includes('min:')) {
band.autoRange = parseFloat(band.min.replace('min:', '')) * 100;
delete band.min;
delete band.max;
Expand Down
8 changes: 4 additions & 4 deletions girder/girder_large_image/web_client/vue/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CompositeLayers from './components/CompositeLayers.vue';
import DualInput from './components/DualInput.vue';
import FrameSelector from './components/FrameSelector.vue';
import HistogramEditor from './components/HistogramEditor.vue';
import CompositeLayers from '../widgets/CompositeLayers.vue';
import DualInput from '../widgets/DualInput.vue';
import FrameSelector from '../widgets/FrameSelector.vue';
import HistogramEditor from '../widgets/HistogramEditor.vue';
import PresetsMenu from './components/PresetsMenu.vue';

export {
Expand Down
3 changes: 0 additions & 3 deletions girder/girder_large_image/web_client/vue/utils/clamp.js

This file was deleted.

86 changes: 0 additions & 86 deletions girder/girder_large_image/web_client/vue/utils/colors.js

This file was deleted.

Loading

0 comments on commit 9587bed

Please sign in to comment.