BoneJ and crop to ROI

I’m trying to calculate trabecular thickness and spacing to a certain area within my bone. I have generated a series of ROIs (one ROI for each image in my stack) in which I want to limit the thickness and spacing calculations. There was once an option to “Crop to ROI” in the BoneJ thickness menu, but I no longer has that option. My FIJI and BoneJ programs are both up to date. How can I get the Crop to ROI function working again?

As an alternative, I’ve tried “clear outside” or “invert the selection” and “set pixels” outside of the selection to 0, but both options crop or clear every single image in my stack to the same ROI, which is not what I want. I need each image cropped to it’s corresponding ROI. Any tips or tricks on how to achieve this would be helpful.


We removed the crop to ROI option from BoneJ2 because it did not replicate the functionality of BoneJ1 - it was if anything a bit misleading in its behaviour if you were used to the BoneJ1 behaviour.

You have some options:

  1. stick with BoneJ1 for now
  2. edit your input images - just delete the stuff you don’t want to measure. (You can do that with ROIs and ‘Clear Outside’ or invert the ROi and delete)

You might have to first select the ROI from the ROI manager, then run clear outside. I’m sure something like this is possible, because we have done it many times. IIRC you may need a macro to go through all the ROIs in the ROI manager, selecting, inverting, and deleting one by one. There are also some ROI manager options that you can try - like associate show ROI with slice, or similar.

  1. Run thickness and separation on the whole image, then restrict your measurements to ROIs in the ROI manager

Thanks, Michael.

Last question!

When generating thickness or spacing, the thickness/spacing mean changes with the mask to thickness map checked or unchecked. I’m not totally clear on the definition that’s listed on BoneJ’s website and what it means to remove thickness map pixels that overhang the input pixels. Any insight would be appreciated.

Also, because checking mask thickness maps changes my means, I want to make sure I’m capturing the most accurate measurement of my bone. This correction is auto-checked in BoneJ1 and not automatically selected in the newest version of BoneJ. So, which is the preferred/most accurate method?

Thanks so much for your help!

Due to the nature of the algorithm, which is fitting continuous-space spheres into discrete-space pixels, the thickness map is typically 1 pixel wider than the foreground features in your image. The Mask option trims off this overhang by setting to NaN (not a number) values in the thickness map that correspond to a background pixel in the input image.

Some time ago someone got in touch with an analysis showing how not trimming the overhang made results biased. The preferred method is to mask/trim the overhang, which is why it was selected by default in BoneJ1. It is also selected by default in BoneJ2, but there has been a change in behaviour of the user dialogs which automatically saves your settings between plugin runs (where BoneJ1 did not). So at some point it’s been turned off in your machine and not turned back on. You should check the masking option and leave it checked.

This has been set back to the old behaviour because users may get inconsistent results if they accidentally leave the Mask option off. It should make it to the next release:

Hello, I think I want the same thing as @emilyb, but I have some questions. I hope you can help me.

The option Clear Outside changes the measurements, doesn’t it?. I have a ROI which is an inclined rectangle, and when I do the measurements the black outside is being considered and the trabecular spacing is much bigger. It is visible in the graphic results as you can see this big white or yellow circles where the black would be. I do not know if I have permission to upload any images. I hope it was a good enough explaination.

How do you do that?
Thank you :smiley: