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

Downsampling in Z #261

Open
melissalinkert opened this issue Oct 11, 2024 · 0 comments
Open

Downsampling in Z #261

melissalinkert opened this issue Oct 11, 2024 · 0 comments

Comments

@melissalinkert
Copy link
Member

This follows discussion with @chris-allan in particular; #208 is related.

There are many different ways we could implement downsampling in Z, but a few goals to simplify the scope:

  • limit the addition of new dependencies, and use existing dependencies where possible
  • limit the number and complexity of new command line options (also keeping NGFF-Converter in mind)
  • consider the approaches used by existing tools, and try to adapt one to our use case

In terms of dependencies, we currently use OpenCV. Using something like VTK or nd4j is theoretically an option, but adds substantial complexity. Most of the existing tools considered (e.g. webknossos) are written in Python, and so can make use of scipy/numpy.

In terms of command line options, we already have a --downsample-type option that is used to configure whether "simple" XY downsampling (choose the upper-left corner of a 2x2 tile) is used, or OpenCV.

One proposed path forward:

  • Add a new boolean --downsample-z option which is false by default.
  • Keep the behavior of --downsample-type as-is.
  • If --downsample-z is set to true, downsample first in the XZ plane, then in the XY plane. The value of --downsample-type determines how this is performed. This means OpenCV can be used for both operations. Test code suggests this is fairly straightforward.
  • This also leaves open the possibility of adding new enum values to --downsample-type which are more 3D-aware, if we decide to add a new dependency or implementation of IImageScaler in the future.

Rejected options:

  • Create a 3D matrix in OpenCV and downsample it all at once
  • Simply drop every other Z plane (or equivalently, choose the corner of a 2x2x2 tile) with no other options. This was discussed in the context of how to downsample isotropically #208 and deemed to be inappropriate for the volume EM case at least.

/cc @erindiel, @emilroz

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

No branches or pull requests

1 participant