'The fourth part of legacy VTK files is the dataset structure. The
geometry part describes the geometry and topology of the dataset.
This part begins with a line containing the keyword DATASET followed
by a keyword describing the type of dataset.  Then, depending upon
the type of dataset, other keyword/ data combinations define the
actual data.'

def set_structure_metadata(self, line, dataset, dataset_type):

    if ((dataset_type is None) and line.startswith('DATASET')):
        dataset_type = line.split()[1]
        dataset.metadata.dataset_type = dataset_type
    if (dataset_type == 'STRUCTURED_GRID'):
        if line.startswith('DIMENSIONS'):
            dataset.metadata.dimensions = [line.split()[1:]]
        elif line.startswith('ORIGIN'):
            dataset.metadata.origin = [line.split()[1:]]
        elif line.startswith('SPACING'):
            dataset.metadata.spacing = [line.split()[1:]]
    elif (dataset_type == 'POLYDATA'):
        if line.startswith('POINTS'):
            dataset.metadata.points = int(line.split()[1])
        elif line.startswith('VERTICES'):
            dataset.metadata.vertices = int(line.split()[1])
        elif line.startswith('LINES'):
            dataset.metadata.lines = int(line.split()[1])
        elif line.startswith('POLYGONS'):
            dataset.metadata.polygons = int(line.split()[1])
        elif line.startswith('TRIANGLE_STRIPS'):
            dataset.metadata.triangle_strips = int(line.split()[1])
    elif (dataset_type == 'UNSTRUCTURED_GRID'):
        if line.startswith('POINTS'):
            dataset.metadata.points = int(line.split()[1])
        if line.startswith('CELLS'):
            dataset.metadata.cells = int(line.split()[1])
    return (dataset, dataset_type)
