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

Support for new OME-Codecs options: jpegquality and disableChromaSubsampling #1440

Open
iwbh15 opened this issue Dec 12, 2023 · 0 comments
Open

Comments

@iwbh15
Copy link
Contributor

iwbh15 commented Dec 12, 2023

The ome-codecs-1.0.0 (used in QuPath 0.5.0) supports adjustable jpegquality.
In ome-codecs-1.0.1 the chroma subsampling can be activated/deactivated.

To support these options in QuPath, some changes must be made in QuPath.

Here is a description of the changes required:

  • The parameters jpegquality and disableChromaSubsampling are set in a CodecOptions object.
  • This CodecOptions object is used by the TiffWriter (e.g. in the writeImage() function in the OMEPyramidWriter).
    It must be 'activated' by calling tiffWriter.setCodecOptions(options);
  • In QuPath, a possibility must be created to pass this CodecOptions object to the OMEPyramidWriter and finally to the writeImage() function.

Here is a script that shows how the basic call could look like:

import qupath.lib.images.writers.ome.OMEPyramidWriter
import ome.codecs.CodecOptions

// *** THIS IS NEW ***
CodecOptions options = new CodecOptions()
options.quality = 0.95


def imageData = getCurrentViewer().getImageData()
def server = imageData.getServer()
def name = getProjectEntry().getImageName()

def pathOutput = "E:\\tmp\\" + name + ".ome.tif"

def writer = new OMEPyramidWriter.Builder(server)

   // THIS IS THE MISSING LINK !
   .setCodecOptions(options)
   
   .compression(OMEPyramidWriter.CompressionType.JPEG)
   .tileSize(512)
   .scaledDownsampling(30, 2)
   .build()
   .writePyramid(pathOutput)

println 'Done'

Here are links to the PRs:
ome/ome-codecs#26
ome/ome-codecs#29

Is it useful and feasible to support these two options in QuPath?

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

No branches or pull requests

1 participant