Gaussian Filter and Python

Hello,
I am new to VTK. I want to load a DICOM file using VTK in python and then implement Gaussian and Median Filters with python code. Please can someone assist? I’m kinda confused as to how to go about it.

VTK’s built-in DICOM reader is quite limited but if it works on your data and you really only need Gaussian and median imaging filters then you should be fine. You can use vtkDICOMImageReader to read the image, apply the filters you need, then use a writer to write the processed image to file.

If DICOM reading fails then you may try vtkDICOM.

If you need more sophisticated image processing then you may find SimpleITK more suitable than VTK.

If you need to import/export DICOM RT structure sets, segmentation objects, 4D data sets, ultrasound, etc. then you may find 3D Slicer’s Python environment useful: 3D Slicer can take care of reading/writing all kinds of DICOM information objects, includes VTK and SimpleITK (and you can pip install any additional packages you need), and you also get rich visualization, interactive processing, etc. (if you need those).

Just an FYI, PyVista provides direct access to the Gaussian filter in Python. See this example. And DICOM images can be read with PyVista’s wrapping of VTK’s DICOM reader via pyvista.read()

Also, adding support for the vtkImageMedian3D median filter in PyVista would be a breeze to implement