Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit bounds in openslide source #1470

Closed
nipeone opened this issue Feb 29, 2024 · 7 comments · Fixed by #1543
Closed

limit bounds in openslide source #1470

nipeone opened this issue Feb 29, 2024 · 7 comments · Fixed by #1543

Comments

@nipeone
Copy link
Contributor

nipeone commented Feb 29, 2024

In the sources of openslide, is it considered to make full use of the four properties

  • openslide.bounds-x
  • openslide.bounds-y
  • openslide.bounds-width
  • openslide.bounds-height

to render the non-empty slide region?

some slides have a large sizeX and sizeY, e.g. (78786, 180026),but the actual non-empty area is very small,e.g. (62526, 61395), such as the following mirax's slide.
image

@manthey
Copy link
Member

manthey commented Apr 1, 2024

It looks like this only ever set for Mirax and Leica SCN. We'd want to adjust the sizeX and sizeY parameters to the width and height in the tile source and add the appropriate x and y offsets.

The drawback is that any existing sources that end up getting cropped will look different in Girder and annotations may not be lined up in the expected manner.

@nipeone
Copy link
Contributor Author

nipeone commented Apr 3, 2024

Maybe you're right to consider the drawback, but wouldn't it make more sense to allow an option like this?

@nipeone
Copy link
Contributor Author

nipeone commented May 30, 2024

It looks like this only ever set for Mirax and Leica SCN. We'd want to adjust the sizeX and sizeY parameters to the width and height in the tile source and add the appropriate x and y offsets.

The drawback is that any existing sources that end up getting cropped will look different in Girder and annotations may not be lined up in the expected manner.↳

@manthey hi, how to add x and y offsets, is there any examples in doc?

@nipeone
Copy link
Contributor Author

nipeone commented May 30, 2024

is there any method to change tile backgroud color in tile serving?When I open it with histomicsUI, it presents a black background,but it's white background when i open it using qupath or openslide.DeepzoomGenerator

image

@nipeone
Copy link
Contributor Author

nipeone commented May 31, 2024

is there any method to change tile backgroud color in tile serving?When I open it with histomicsUI, it presents a black background,but it's white background when i open it using qupath or openslide.DeepzoomGenerator↳

image

@manthey i found some code in openslide.deepzoom to change tile background.

  tile = self._osr.read_region(*args)
  profile = tile.info.get('icc_profile')

  # Apply on solid background
  bg = Image.new('RGB', tile.size, self._bg_color)
  tile = Image.composite(tile, bg, tile)

Is there a corresponding operation or document in large_image?

@manthey
Copy link
Member

manthey commented Jun 3, 2024

is there any method to change tile backgroud color in tile serving?When I open it with histomicsUI, it presents a black background,but it's white background when i open it using qupath or openslide.DeepzoomGenerator↳
image

@manthey i found some code in openslide.deepzoom to change tile background.

  tile = self._osr.read_region(*args)
  profile = tile.info.get('icc_profile')

  # Apply on solid background
  bg = Image.new('RGB', tile.size, self._bg_color)
  tile = Image.composite(tile, bg, tile)

Is there a corresponding operation or document in large_image?

Is this what you are looking for:
https://girder.github.io/large_image/tilesource_options.html#edges
Or, in the rest call to the tiles/zxy endpoint add ?edge=<color>. If you need more control, the style parameter can be used to modify the image tiles themselves.

@nipeone
Copy link
Contributor Author

nipeone commented Jun 4, 2024

is there any method to change tile backgroud color in tile serving?When I open it with histomicsUI, it presents a black background,but it's white background when i open it using qupath or openslide.DeepzoomGenerator↳
image

@manthey i found some code in openslide.deepzoom to change tile background.

  tile = self._osr.read_region(*args)
  profile = tile.info.get('icc_profile')

  # Apply on solid background
  bg = Image.new('RGB', tile.size, self._bg_color)
  tile = Image.composite(tile, bg, tile)

Is there a corresponding operation or document in large_image?

Is this what you are looking for: https://girder.github.io/large_image/tilesource_options.html#edges Or, in the rest call to the tiles/zxy endpoint add ?edge=<color>. If you need more control, the style parameter can be used to modify the image tiles themselves.↳

thanks, finally i solve the problem use this style.

style = {'bands': [
        {"band": 1, "palette": ["#000", "#f00"]},
        {"band": 2, "palette": ["#000", "#0f0"]}, 
        {"band": 3, "palette": ["#000", "#00f"]},
        {"band": 4, "palette": ["#fff", "#000"]}
    ]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants