Help with ImageThreshold to avoid empty planes in a stack?
Fri, 04/10/2020 - 04:09 pm
I am running ImageThreshold with the adaptive method.
The simage can be an image stack. I am running into cases where I get this error message:
error: Method 3 is not supported for this operation.
I have narrowed this down to the fact that simage contains layers that are entirely ZERO and I am setting /P=(-1) (all planes). No other method fails with an error for such a case even with /P=(-1) (however I now also understand why I am getting nonsense in my thresholding results for those other cases).
I want to do a work-around for the case that some layers in a stack may contain all ZEROs (or all ... whatever values) yet still allow /P=(-1). What is the best method? What is the best value to fill a stack layer so that it is ignored in the ImageThreshold calculations when /P=(-1)? What test should I do on the image stack before the adaptive method (or indeed for all other methods) that would assure that I can either a) report an error message before the operation or b) re-format the image stack (ZERO planes) appropriately to be ignored?
This is part of a sequence of processing steps. The first step is to remove the background. This first step can be done on a layer-by-layer basis. To preserve the stack integrity, when I subtract the background from just one layer, I fill all other layers with ZEROs in the newly created image stack. That way, I can step through the "background" stack to see which layers have yet to be adjusted. Or I can just reprocess a specific plane in the stack and substitute it into the stack.
I tried NaN as the fill ... This gives the same problems.
The images are (primarily) /B/U format.