brainglobe / brainglobe-template-builder

Build unbiased anatomical templates from individual images
https://brainglobe.github.io/brainglobe-template-builder
BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

[Feature] Utilities for downsampling images #17

Open niksirbi opened 4 months ago

niksirbi commented 4 months ago

Some of the imaging data is very large and of higher resolution than what we need for building an average template. Would be useful to have utilities for cropping and for downsampling/resizing images in an efficient way.

A basic chunked downsampling by 2 (producing a pyramid of resolutions) has been implemented in the stack-to-chunk package.

Some preliminary work on more generalised resizing can be found in this branch of our stack-to-chunk fork.

We may start adding some utilities to that effect here, but if they end up being more generally useful, they may be moved to stack-to-chunk or to brainglobe-utils over time.

alessandrofelder commented 1 month ago

Downsampling addressed in #21 Cropping maybe best done in napari? Or via mask that was estimated in napari widget?

niksirbi commented 1 month ago

If we trust the brain masks we estimate, cropping can be automated by leaving a fixed margin of empty planes on each face of the mask extents. This would result in cropping if the image extends beyond the margin, and in padding where the mask touches the image edge. On one hand, having a "standard" small margin around the brain is beneficial for registration and on the other hand, it would ensure we don't carry around too many unnecessary voxels (those outside of the brain).

alessandrofelder commented 1 month ago

Functionality for cropping implemented in #32 - can we close this @niksirbi ?