def _make_writer(self, filename): "Internal function." extension = None parts = filename.split('.') if len(parts) > 1: extension = parts[-1] else: raise RuntimeError( "Filename has no extension, cannot guess writer to use") if extension == 'png': return vtkPNGWriter() elif extension == 'bmp': return vtkBMPWriter() elif extension == 'ppm': return vtkPNMWriter() elif extension == 'tif' or extension == 'tiff': return vtkTIFFWriter() elif extension == 'jpg' or extension == 'jpeg': return vtkJPEGWriter() elif extension == 'vti': return vtkXMLImageDataWriter() # noqa: F821 else: raise RuntimeError("Cannot infer filetype from extension:", extension)
def _make_writer(self, filename): "Internal function." extension = None parts = filename.split('.') if len(parts) > 1: extension = parts[-1] else: raise RuntimeError( "Filename has no extension, cannot guess writer to use") if extension == 'png': return vtkPNGWriter() elif extension == 'bmp': return vtkBMPWriter() elif extension == 'ppm': return vtkPNMWriter() elif extension == 'tif' or extension == 'tiff': return vtkTIFFWriter() elif extension == 'jpg' or extension == 'jpeg': return vtkJPEGWriter() elif extension == 'vti': return vtkXMLImageDataWriter() # noqa: F821 else: raise RuntimeError( "Cannot infer filetype from extension:", extension)
def _make_writer(filename): "Internal function." extension = None parts = filename.split('.') if len(parts) > 1: extension = parts[-1] else: raise RuntimeError, "Filename has no extension, please specify a write" if extension == 'png': return vtkPNGWriter() elif extension == 'bmp': return vtkBMPWriter() elif extension == 'ppm': return vtkPNMWriter() elif extension == 'tif' or extension == 'tiff': return vtkTIFFWriter() elif extension == 'jpg' or extension == 'jpeg': return vtkJPEGWriter() else: raise RuntimeError, "Cannot infer filetype from extension:", extension