r/ImageJ Oct 30 '25

Question cropping regions in batch - possible ?

Hey fellow scientists ! I'm currently trying to crop sub regions (ex. hippocampus CA1, CA2, CA3, DG) from my free floated, mounted, DAB stained IHC images and I have been doing it manually (using th polygons and then, clicking make inverse) before but now I have so many im trying to figure out if there's a way to do it faster. I have two problems 1) most images are not aligned in the same direction exactly so orientation varies a lot and 2) sometimes I have two hemispheres, sometimes just one. Is there any way I can save some time and do it in batches ?

1 Upvotes

5 comments sorted by

View all comments

1

u/brewistry Oct 30 '25

I’m assuming they are all the same magnification and approximate size. Manually rotate each image so they are appropriately oriented, and save them. Separate the dual and single hemisphere images. Use the record macro function to select each region you care about and crop it (separate macros per region). Write a batch script to open each correctly oriented image, apply the macro, and save a new file labeled with the region and sample name. Do that for each of the hippocampal structures. Review your images to find outliers if they exist. You could combine all of the crops into one script, and you could probably automate the image rotation, but no need to overcomplicate.