I have mention this data stack I have before, but just had an epiphany and am looking for additional insight.
I wan to register a sparse stack of images to a 3d volume. fixed 3d volume.
I have a set of ordered 2d images that have been registered and re-sampled to each other, however in reality the images are separated by some distance and the distance between images is not uniform.
I found it easy to stack the images with non-uniform spacing by adding blank slices inbetween.
Can I mask the blank slices in the moving volume and let the rest of the registration pipeline do its thing?
I guess there are really a few phases that could be going on.
- fix each 2d image in a sparse stack and have a rigid transform to the 3D volume to get close ish to the correct feature in the 3d volume
- re-register each 2d image independently in the 3d volume ( which could be done as another rigid registration or could that also be broken up into stages, e.g. iteratively register with different degrees of freedom
- Translation in the 2d image plane (x and y and no z relative to the 2d image plane in 3d space.
- rotation about the 2d image center in 3d space
- translation in the z direction.
Is there a SimpleITK exmple of registering a 2d image (moving) of set thickness to a 3D volume (fixed)?
We do not have an example of a 2D image to 3D volume registration in SimpleITK, contributions are welcome (if you choose to follow this path).
If you have a simpleitk volume with some slices that contain data (your original slices) and some that don’t (artificially added to create a uniform spacing) you can definitely use a mask. The only thing is that the mask is the other way round than what you were thinking. It should identify where you want to sample, so it should be one for the slices with data and zero for the artificial slices. This Jupyter notebook illustrates how to use a mask on the fixed image, you can also have a mask on the moving image if you need to.
As you know the spatial relationship between your non-uniformly distributed slices, I would recommend the registration with masks approach as it uses all of the information from all slices in a combined manner. Independently working with each slice is likely to be less stable as you have less information for each “sub-registration”.
I only want to mask the moving image, will that work? I will give it a try this evening.
If you perform multi-slice to 3D registration by creating a single sparse volume from multiple slices then the sparse image must be the fixed image. Otherwise you would spend a lot of time with (and potentially still not being able to find) enough matching samples in the moving image (the moving image mask would keep rejecting most of the samples).
You may also modify the error metric to take multiple slices instead of a single sparse volume. This way you can avoid creating a sparse volume (which may take a lot of memory, especially if you have high-resolution frames in various orientations). Even in this case, you would use the slices as fixed image and the 3D volume as moving image.
If registration is successful then the resulting transform should be invertible, so it should not matter much which volume was fixed and which one was moving.
See some more information about this in our paper from a couple of years ago.