ITK icon indicating copy to clipboard operation
ITK copied to clipboard

Expose ImageToImageFilter::VerifyInputInformation() as a usable True/False function

Open gdevenyi opened this issue 3 years ago • 3 comments

Description

When checking a large number of images before processing, say by reading just the metadata rather than the voxel data, it would be worthwhile to be able to check if they're all "in the same space" before doing expensive processing.

Exposing the logic of ImageToImageFilter::VerifyInputInformation() as a function for using a test on a pair of images would be helpful in this regard.

Expected behavior

newFunction(img1, img2) returns True if the images would pass the same test in ImageToImage Filter (i.e. same origins, spacings, Directions etc)

Actual behavior

NA

Additional Information

Inspired by question here, https://discourse.itk.org/t/quick-test-for-are-images-in-the-same-space-aka-overalpping-simpleitk/5249/5

gdevenyi avatar Aug 08 '22 21:08 gdevenyi

Possibly add it to ImageBase, as a method named SameImageGridAs(ImageBase* otherImage).

dzenanz avatar Aug 08 '22 21:08 dzenanz

One thing to clarify here, I'd like it to be usable without loading voxel data, as I would intend to use it as a preflight check before heavy IO and computation, which I do in SimpleITK by with ImageFileReader/ReadImageInformation.

gdevenyi avatar Aug 09 '22 00:08 gdevenyi

Possibly add it to ImageBase, as a method named SameImageGridAs(ImageBase* otherImage).

The current implementation in ImageToImageFilter also uses a member variables m_CoordinateTolerance and m_DirectionTolerance so the proposed method would need to have these arguments too.

There are only a 3-5 lines of code to do the comparison, most it is just printing an error message. The error code would not be appropriate for the proposed method IMHO.

blowekamp avatar Aug 11 '22 13:08 blowekamp