I’m looking for a simple solution to the following:
I’d like to generate an image type template parameter to use in order to construct an ImageSeriesReader class (python) by interrogating one of the files in the series first and extracting the component type (PixelType) without reading it fully first.The component type in this file is not known in advance but will be one of the types I’ve provided python wrappings for.
I’ve seen some examples that partially show how I can do this via the use of ReadImageInformation() from an ImageIO object created from a given file, https://discourse.itk.org/t/error-while-reading-an-image-with-itk-python/1560/2
Also, I’ve seen the solution given in ReadUnknownImageType
However, I can’t see a simple method that maps the value or string returned by GetComponentType() or GetComponentTypeAsString() that can be utilised to construct the tuple for the template parameter. Ie, in itk.ctype() etc, without writing a whole lot of manual matching code as per the second example.
I know I can get around this by fully reading the image first and extracting the template directly with itk.template(image), however in my particular case I’d like to avoid this due to the extremely large size of the images involved.
Does anyone know of a better way of achieving this?