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.
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?
This capability, to quickly read a series of TIFF, DICOM, or PNG files, for example, into a 3D volume, is already available in the itk 5.0 Python wrapping with itk.imread!
Error message: TypeError: in method 'itkImageFileWriterIF3_SetInput', argument 2 of type 'itkImageF3 const *'
Can you give me some help? Thank you so much
reader.SetFileName(input_filename)
TypeError: in method 'itkImageFileReaderVIF3_SetFileName', argument 2 of type 'std::string const &'
Additional information:
Wrong number or type of arguments for overloaded function 'itkImageFileReaderVIF3_SetFileName'.
Possible C/C++ prototypes are:
itkImageFileReaderVIF3::SetFileName(itkSimpleDataObjectDecoratorstring const *)
itkImageFileReaderVIF3::SetFileName(std::string const &)
The problem was that I got input_filename from argparse: for i, input_filename in enumerate(args.input_image): which made it a list consisting of one item. If I change reader.SetFileName(input_filename) into reader.SetFileName(input_filename[0]), the error goes away.