Beispiel #1
0
def vmtkimagereader(path):
    """Read an image and store it in a vtkImageData object.

    Args:
        path: Path to the image file.

    Returns:
        vtkImageData object.

    Note:
        Reads several image formats: vti, vtk, dcm, raw, mha, mhd, tif, png

    """
    reader = vmtkscripts.vmtkImageReader()
    reader.InputFileName = path
    reader.Execute()
    return reader.Image
Beispiel #2
0
def vmtkimagereader(path):
    """Read an image and store it in a vtkImageData object.

    Args:
        path: Path to the image file.

    Returns:
        vtkImageData object.

    Note:
        Reads several image formats: vti, vtk, dcm, raw, mha, mhd, tif, png

    """
    reader = vmtkscripts.vmtkImageReader()
    reader.InputFileName = path
    reader.Execute()
    return reader.Image
Beispiel #3
0
def read_vtifile(path):
    imageReader = vmtkscripts.vmtkImageReader()
    imageReader.InputFileName = path
    imageReader.Execute()

    return imageReader
Beispiel #4
0
    float_path = os.path.join(image_vols_path, post_name_float)
    level_set_path = os.path.join(norm_path, level_set_name)
    
    initial_path = os.path.join(image_vols_path, post_name)
    #print(directory_path, image_vols_path, registration_path, norm_path)
    #print(initial_path)
    
    if do_processing:
        if not os.path.exists(norm_path):
            try:
                os.mkdir(norm_path)
            except:
                print("unable to create directory{0}".fomat(norm_path))
                pass

        image_reader = vmtkscripts.vmtkImageReader()
        
        image_reader.InputFileName = initial_path
        image_reader.Execute()
        
        cast_float = vtk.vtkImageCast()
        cast_float.SetInputData(image_reader.Output)
        cast_float.SetOutputScalarTypeToFloat()
        cast_float.Update()
        float_image = cast_float.GetOutput()
        #cast_float = vmtkscripts.vmtkImageCast()
        #cast_float.Image = image_reader.Output
        #cast_float.OutputType = 'float'
        #cast_float.Execute()
        
        #print(cast_float.Image.GetOrigin(), cast_float.Image.GetSpacing())
def vmtkimagereader(filename):
    reader = vmtkscripts.vmtkImageReader()
    reader.InputFileName = filename
    reader.Execute()
    return reader.Image