def readImage(
        filename,
        verbose=1):

    myVTK.myPrint(verbose, "*** readImage: " + filename + " ***")

    if ('vtk' in filename):
        image_reader = vtk.vtkImageDataReader()
    elif ('vti' in filename):
        image_reader = vtk.vtkXMLImageDataReader()
    else:
        assert 0, "File must be .vtk or .vti. Aborting."

    image_reader.SetFileName(filename)
    image_reader.Update()
    image = image_reader.GetOutput()

    if (verbose):
        print "n_points = " + str(image.GetNumberOfPoints())

    return image
Exemplo n.º 2
0
def readImage(filename, verbose=0):

    myVTK.myPrint(verbose, "*** readImage: " + filename + " ***")

    assert (os.path.isfile(filename)
            ), "Wrong filename (\"" + filename + "\"). Aborting."

    if ('vtk' in filename):
        image_reader = vtk.vtkImageDataReader()
    elif ('vti' in filename):
        image_reader = vtk.vtkXMLImageDataReader()
    else:
        assert 0, "File must be .vtk or .vti. Aborting."

    image_reader.SetFileName(filename)
    image_reader.Update()
    image = image_reader.GetOutput()

    myVTK.myPrint(verbose - 1, "n_points = " + str(image.GetNumberOfPoints()))

    return image
Exemplo n.º 3
0
def readImage(
        filename,
        verbose=0):

    myVTK.myPrint(verbose, "*** readImage: "+filename+" ***")

    assert (os.path.isfile(filename)), "Wrong filename (\""+filename+"\"). Aborting."

    if ('vtk' in filename):
        image_reader = vtk.vtkImageDataReader()
    elif ('vti' in filename):
        image_reader = vtk.vtkXMLImageDataReader()
    else:
        assert 0, "File must be .vtk or .vti. Aborting."

    image_reader.SetFileName(filename)
    image_reader.Update()
    image = image_reader.GetOutput()

    myVTK.myPrint(verbose-1, "n_points = "+str(image.GetNumberOfPoints()))

    return image