Information such as pixeltype, dimension, components, is_rgb, etc is not only redundant to what is contained in the pointer, it is also vulnerable to bugs because it is not coupled to the one source of truth (the pointer to the actual image). If someone input the wrong dimension.. it would not be caught.
This PR makes it so ANTsImage instances are created from only the pointer and all that extra info is extracted from the pointer. It is more robust and also makes it eventually easier to refactor the internal import system. The above line would be replaced with this:
img = iio2.from_pointer(itk_image)
All of the info is still available as usual - no changes there.
coverage: 80.907% (+0.07%) from 80.836%
when pulling 264c0ef2881d75bd00115d8b23f6dd1b55461316 on image-from-pointer
into 75f73923702aed09bcc07a328c10f66ad0ed3e01 on master.
Currently, you have to manually input a bunch of extra information when creating an ANTsImage internally from an ITK pointer, e.g.:
Information such as pixeltype, dimension, components, is_rgb, etc is not only redundant to what is contained in the pointer, it is also vulnerable to bugs because it is not coupled to the one source of truth (the pointer to the actual image). If someone input the wrong dimension.. it would not be caught.
This PR makes it so ANTsImage instances are created from only the pointer and all that extra info is extracted from the pointer. It is more robust and also makes it eventually easier to refactor the internal import system. The above line would be replaced with this:
All of the info is still available as usual - no changes there.