I’m working on a short script in which I want to use the stack function “grouped z project” (Image/Stacks/Tools/grouped z project).
There, one can enter the Group size on how much parts one wants to make a maximum intensity projection of a stack. But only valid factors are allowed for input.
Since I want to process a lot of different stacks with different numbers of slices, I cant set a fixed value.
But I don’t want the user to this.
I know I always want 5 groups.
Is there a way to calculate the correct (valid) factor?
If I have 234 slices and I like to have 5 groupes I would calculate 234 / 5 = 46,8.
But I can only use 39 or 78 as a valid factor (they are about in the right range).
How do I get the calculation right?
I hope this is not to silly to ask
I think I need to calculate the next integer.
if nSlices divided with 5 == integer then do grouped z project
else divide nSlices with 6 if the answer is an integeger do z project…
and so on…
do you think this would be the best approach?