Finding the largest physical region (bounding box) across an arbitrary number of input files (SimpleITK)

I’m working on an arbitrary image averaging script, where I’d like to assume input images are not guaranteed to overlap (completely, or even partially). As such, I need to construct a “common” space which contains all the input images. Finding the voxel dimensions is easy per-image, but before I go about writing something to locate all the “corners” of the data in space manually, is there a more clever solution in ITK I might be able to use?

I don’t know of anything clever, but I did write the code for computing a world space bounding box of a volume.

Here’s my code to ‘regularize’ a volume. It makes a volume with cubic voxels and an orientation of the identity matrix.

3 Likes

Thanks for the code, I can definitely steal some of that.

Since you’re isotropizing images, you might find this useful, Resampling to Isotropic: Signal Processing Theory

1 Like

Interesting thread. Yeah, I don’t do any sort of filtering, so it can result it artifacts.

Thanks very much again @dchen, I stole your code mostly wholesale to sort out the bounding box, now I can combine arbitrary-space images into a common “mega” image covering the full bounding box, as I wanted.

2 Likes

You’re welcome. I’m glad you found my code useful.

1 Like