# VTK File not displaying colours and only showing as Point Gaussian

**URL:** https://discourse.paraview.org/t/vtk-file-not-displaying-colours-and-only-showing-as-point-gaussian/3294
**Category:** ParaView Support
**Created:** [January 9, 2020, 9:27am UTC](https://discourse.paraview.org/t/vtk-file-not-displaying-colours-and-only-showing-as-point-gaussian/3294 "2020-01-09T09:27:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![pavaninguva](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavaninguva/32/5849_2.png) [@pavaninguva](https://discourse.paraview.org/u/pavaninguva)
#### Post date: [January 9, 2020, 9:27am UTC](https://discourse.paraview.org/t/vtk-file-not-displaying-colours-and-only-showing-as-point-gaussian/3294/1 "2020-01-09T09:27:02Z")

</div>

Hi, I generated the following VTK file from a simulation in `FiPy` and reading it in Paraview doesnt seem to be working. I am only able to view the points as a `Point Gaussian` and the colours are not suitably reflected. [50.0\_output.vtk](https://discourse.paraview.org/uploads/short-url/hN7Kg0pDjluua1P9gjFt03785fI.vtk) (24.7 KB)

I would appreciate any insight on this and is it possible to modify the VTK files in a scripted fashion so I could run a postprocessing pipeline to correct the VTK files if there is an error or are there certain buttons in Paraview that I need to click.

Thanks for your help.

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [January 9, 2020, 10:19am UTC](https://discourse.paraview.org/t/vtk-file-not-displaying-colours-and-only-showing-as-point-gaussian/3294/2 "2020-01-09T10:19:20Z")

</div>

It is because of the cell type used in your dataset.

In your file, from line 557 to 956 (i.e the ‘CELL\_TYPES’ part) try replacing `41` (convex point set) by `9` (Quad). See here [https://vtk.org/doc/nightly/html/vtkCellType\_8h.html](https://vtk.org/doc/nightly/html/vtkCellType_8h.html) for available values, and check vtkCell subclasses ([https://vtk.org/doc/nightly/html/classvtkCell.html](https://vtk.org/doc/nightly/html/classvtkCell.html)) to get more informations.

**more details**

ParaView (and VTK) does not display points directly but only cells. ParaView does not handle every kind of VTK cells. The `Point Gaussian` is a workaround to display a geometry at each point, whatever the cell type of the dataset.

---

<div class="post-metadata">

### Author: ![pavaninguva](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavaninguva/32/5849_2.png) [@pavaninguva](https://discourse.paraview.org/u/pavaninguva)
#### Post date: [January 30, 2020, 6:49am UTC](https://discourse.paraview.org/t/vtk-file-not-displaying-colours-and-only-showing-as-point-gaussian/3294/3 "2020-01-30T06:49:01Z")

</div>

Hi! For future reference if anyone comes across a similar problem, here is a crude script in python to quickly modify the .vtk file. I know its not the most elegant, but it does the trick. I essentially do a text replacement of the `41` to `9`.

```auto
import glob

from tempfile import mkstemp
from shutil import move
from os import remove

# Obtain list of VTK files in directory
vtk_list = glob.glob("*.vtk")

# Rename the extensions to .txt files to process
for vtk in vtk_list: 
    # Access the last four characters in the path and replace them with .txt
    os.rename(vtk, vtk[:-4] + ".txt")

txt_list = glob.glob("*output.txt")

def replace(source_file_path, pattern, substring):
    fh, target_file_path = mkstemp()
    with open(target_file_path, 'w') as target_file:
        with open(source_file_path, 'r') as source_file:
            for line in source_file:
                if line.strip() == pattern:
                    lineout = f"{substring}\n"
                    target_file.write(lineout)
                else:
                    target_file.write(line)
    remove(source_file_path)
    move(target_file_path, source_file_path)

for text in txt_list:
    replace(text, "41", "9")
    os.rename(text, text[:-4] + ".vtk")

```

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [January 30, 2020, 9:07am UTC](https://discourse.paraview.org/t/vtk-file-not-displaying-colours-and-only-showing-as-point-gaussian/3294/4 "2020-01-30T09:07:00Z")

</div>

On the command line, there are some powerful tools to do such replacements, as `sed`:

```auto
$ sed -i 's/^41$/9/' 50.0_output.vtk

```
