How does Bone J produce default thresholds?



Hello All,

This may be a simple question, but I have been unable to find a clear answer. I have CT stacks containing bone with a black background, air. When I run Slice Geometry on cropped stacks containing single elements, the program appears to automatically calculate a threshold value for bone minimum grey values. I was planning on calculating my own threshold, but the program seems to already provide a fairly reasonable range of grey values for bone. How does Slice Geometry calculate this default threshold, and could one use this for reliable analysis of CSG?



Thank you,

Ben Osipov


Slice Geometry generates a histogram from the stack’s pixels then applies ImageJ’s ‘default’ threshold to it. The result should be the same or similar to what you get from the Image > Adjust > Threshold command, checking ‘Stack histogram’ and selecting ‘Default’ from the Autothreshold menu.

The code which does it is here and here and here. The histogram utility methods predate ImageJ having an inbuilt stack histogram method, so are a bit redundant these days.

If your images are Hounsfield Unit (HU) calibrated (as many clinical CT images are), Slice Geometry will attempt to detect it and set the min to 0 HU (water, partial bone pixel) and max to 4000 HU (bit more than cortical bone, less than steel).

Yes, if your images are all very similar or HU calibrated. The min and max are sensible suggestions based on our typical use case, but are potentially inappropriate for your images. The best way to check is to see whether the min and max values agree with what you would have chosen, and to do a sensitivity analysis to see how varying them alters your results.

Slice Geometry has a new feature (since BoneJ 1.4.2) which allows you to incorporate partial pixels, so if your pixel is 0.3× the value of a fully dense one, offset a bit for the surrounding air, you can add an 0.3× pixel to the area and second moment of area measurements. It’s described in more detail in the preprint which stimulated its development.


Thank you very much for this explanation! I will investigate the partial pixel issue further and finalize my thresholding.