This is a very specific question so I will give some context:
I’m registering two Images with very different sizes, but the assumption (verified in script) is that the moving image is far smaller and completely contained in the fixed image.
As an initialization step I crop the fixed image around the moving image region to speed up the process and prevent MMI metric errors.
So, at this point I feed the cropped fixed image to the registration method, without success. I must specify that if I write and read the cropped fixed image (as a debug step) the registration is successful.
If I ::Print() the cropped fixed image information the only difference between the written and read back image is that the index is not placed at [0,0,0].
I’m assuming this is the problem, since the origin and all relevant other informations are correct. Do you have any suggestion on why this is happening or if there is a possible solution?
Try using itk::RegionOfInterestImageFilter. It does the same operation as the Crop filter, but with different parameters and sets the starting index to 0 while recomputing the origin.
Issue solved with @blowekamp suggestion, changed the parameters given to the filter to a region with desired size and an index corresponding to the origin of the overlapping region.
Thank you!
Indeed! To be more specific I’m encountered the bug using CropFilterFilter, a child object of ExtractionImageFilter (didn’t mean to correct you, just wanted to be 100% sure we’re on the same page as this could be a bug).
Not surprising. The “starting” index is used in ITK’s image data representation to stream in the pipeline. The image file formats don’t have this notion, so the starting index of a written files is always zero. When writing the origin is adjusted so that the physical location of all pixels remains the same.