def _make_reader(self, filename): "Internal function." extension = None parts = filename.split('.') if len(parts) > 1: extension = parts[-1] else: raise RuntimeError( "Filename has no extension, please guess reader to use") if extension == 'png': return vtkPNGReader() elif extension == 'bmp': return vtkBMPReader() elif extension == 'ppm': return vtkPNMReader() elif extension == 'tif' or extension == 'tiff': return vtkTIFFReader() elif extension == 'jpg' or extension == 'jpeg': return vtkJPEGReader() elif extension == 'vti': return vtkXMLImageDataReader() # noqa: F821 else: raise RuntimeError("Cannot infer filetype from extension:", extension)
def _make_reader(self, filename): "Internal function." extension = None parts = filename.split('.') if len(parts) > 1: extension = parts[-1] else: raise RuntimeError( "Filename has no extension, please guess reader to use") if extension == 'png': return vtkPNGReader() elif extension == 'bmp': return vtkBMPReader() elif extension == 'ppm': return vtkPNMReader() elif extension == 'tif' or extension == 'tiff': return vtkTIFFReader() elif extension == 'jpg' or extension == 'jpeg': return vtkJPEGReader() elif extension == 'vti': return vtkXMLImageDataReader() # noqa: F821 else: raise RuntimeError( "Cannot infer filetype from extension:", extension)