Skip to content

Instantly share code, notes, and snippets.

@imagejan
Created April 22, 2022 15:03
Show Gist options
  • Save imagejan/5b34af505de190d957c385587bd47a1f to your computer and use it in GitHub Desktop.
Save imagejan/5b34af505de190d957c385587bd47a1f to your computer and use it in GitHub Desktop.
[Fiji/ImgLib2] Create a partial projection of a stack, with a sliding interval of defined size.
#@ Dataset input
#@ OpService ops
#@ Integer (label="Width of sliding window (frames)") window
#@output projected
// Add a new dimension of window size
added = ops.transform().addDimensionView(input, 0, window-1)
extended = ops.transform().extendBorderView(added)
// Shear along time dimension,
// with sliding window dimension as reference
tilted = ops.transform().shearView(extended, added, 2, 3)
// Project along sliding window dimension
projected = ops.create().img(input)
op = ops.op("stats.mean", input)
ops.transform().project(projected, tilted, op, 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment