<pedant_mode>
These expressions can be simplified:
iif( $T > 0, 1, 0 )
is the same as:
$T > 0
Conversely,
iif( $T > 0, 0, 1 )
is equivalent to:
$T <= 0
This is because the result of a relational operator (==, !=, <, <=, >, >=) is a Boolean value, which in PixelMath is always 0=false or 1=true.
</pedant_mode>
Besides that, both tricks are nice and smart

It would be nice if the histogram buckets could be exported to .csv. Or some complex XML format if Juan prefers that
We have a new 'observer' tool planned which will have this functionality: Histogram. This tool will work like Statistics but showing histograms, with exporting capabilities for text and graphics (e.g., the histogram will be exportable both as an image and in SVG format). The Statistics tool will also have a major revamp by the way. Tabular data will be exported in CSV format, just as DynamicPSF does.