Automatically Select Portion of Radiograph

Hi everyone,

I am new to ImageJ and have been going through some of the materials provided to gain a better understanding of the software. I currently have a large set of radiographs of which I am only concerned with a small rectangular window, so I would like to find a way to crop the images down to the size of the window for further processing. This window, however, is not entirely static throughout the set of images. I have messed around with thresholding the image, however there are similar values outside the window as well as inside, so this is not entirely helpful. Can anyone provide me with some advice for moving forwards? I have attached an example of the radiographs.



You could try running this little macro on your images:

id = getImageID();
run("Duplicate...", " ");

setAutoThreshold("Default dark");

run("Create Mask");

run("Fill Holes");

run("Analyze Particles...", "size=100000-Infinity exclude clear add");

roiManager("Show All");

roiManager("Select", 0);

This assumes those background, light regions are always touching the edges of the image and that your rectangular region of interest never does. It also assumes the relative size of your rectangle region is consistent from image-to-image.

If you are interested in learning more on batch processing check out this old forum post.

And of course - if you have more questions - be sure to ask us - we are here to help!

eta :slight_smile:


So speedy! Thank you so much! It seems to be working, I will see how it holds up with the other images.

1 Like

A post was split to a new topic: How to create an animated gif or a video?

This I am not sure of… but i’ll split it to a new topic so you can find someone who can answer that question. :slight_smile: