Method of creating a stack zprojection image using the mode / modal value
Posted by jeremydouglass on Dec 31, 2008; 10:34am
URL: http://imagej.273.s1.nabble.com/Method-of-creating-a-stack-zprojection-image-using-the-mode-modal-value-tp3694140.html
Dear ImageJ experts,
I'm trying to discover a method of using ImageJ to create a modal zprojection image from a stack -- that is, with the resulting image value at each xy being the mode / modal value of z rather than the median or mean. So for example if for pixel 1,1 the values along z in the stack were 0,0,0,96,96,128,128,256,256, I want the resulting zprojection image at 1,1 to have a value of 0 (modal value) rather than 96 (median) or 106.66 (mean).
I've spent a few days searching forums and documentation, and I'd be grateful for any advice on how to proceed.
Background: I'm working with stacks that are actually time series of software screen recordings, so the mode may be much more useful to me than in spectroscopy applications. Bins aren't an issue (most common values recur precisely) and the possibility of multiple modes isn't a concern (if there is more than one mode, returning the first one is fine). I've been investigating writing something as a macro / plugin, which I assume would be nested loops marching through x,y with the inner loop taking the mode a selection line running through the stack along z and then writing the result to a file - but I've been unable to figure out how that inner loop call should look like - should I try to use the existing "modal gray value" functionality that returns a number based on a selection, for example? Is there plugin or macro code that already exists?
Finally, while I'd very much prefer a way of implementing this in ImageJ, suggestions of other methods to create a modal value zprojection would be appreciated as well.
Thanks for your time.