knime-ip / knip

KNIME Image Processing Extension
https://www.knime.com/community/image-processing
49 stars 11 forks source link

Percentile Normalizer #482

Closed HedgehogCode closed 6 years ago

HedgehogCode commented 6 years ago

For our project, we need a percentile normalizer. This means:

Should I write a new node and should this node go into knip? Is there a nice solution using existing nodes?

imagejan commented 6 years ago

You can do it with existing nodes, but it's a bit convoluted: you need to map the actual image min and max to target min and max as follows:

                       max - lowerPercentile
targetMax <=  -------------------------------------
                upperPercentile - lowerPercentile

                            upperPercentile - min
targetMin <=  1 - ( ------------------------------------- )
                      upperPercentile - lowerPercentile

You can use the metanode in the attached workflow to do this:

Percentile Normalization.zip


If you think there should be a dedicated (native) node for it, I'd suggest to create an Op as generic as possible in imagej-ops and just provide an appropriate wrapper node (if at all, provided that KNIP2 is supposed to auto-generate nodes for ops at some point, right?)

HedgehogCode commented 6 years ago

Nice workaround. I didn't think about using the target min and max to avoid clamping. Your workflow works great! For now, I will do the same. And later I will write an Op and maybe get a nice dedicated node from KNIP2. (The thing was, that I have no time waiting for KNIP2)

I think I can close this issue for now. Thank you @imagejan!