ksugar/qupath-extension-sam

Modify to use the rendered view as opposed to the original image

adyprat opened this issue · 1 comments

Hi,

Thank you so much for this extension!

I'm looking for some pointers to figure out how to change the bufferedImage in line 149 below, so this is compatible with multi-channel images that aren't RGB to begin with or single channel tif (like ome.tif, etc):

bufferedImage = qupath.getImageData().getServer().readRegion(downsample, x1, y1, x2 - x1, y2 - y1);

Is there a way to use the RenderedImageServer in QuPath directly? I tried:
bufferedImage = qupath.getViewer().getImageDisplay().getImageData().getServer().readRegion(downsample, x1, y1, x2 - x1, y2 - y1);
but that did not seem to work.

Best,
Ady

Hi @adyprat , thank you for your question.

It can be done as shown here. It's already implemented in v0.2.0.

final ImageServer<BufferedImage> renderedServer = new RenderedImageServer
.Builder(qupath.getViewer().getImageData())
.store(qupath.getViewer().getImageRegionStore())
.renderer(qupath.getViewer().getImageDisplay())
.build();

Please try the latest version and if it works, please close this issue, thanks!