# Generating a mesh from noisy medical data

**URL:** https://discourse.paraview.org/t/generating-a-mesh-from-noisy-medical-data/17300
**Category:** ParaView Support
**Created:** [November 10, 2025, 4:59pm UTC](https://discourse.paraview.org/t/generating-a-mesh-from-noisy-medical-data/17300 "2025-11-10T16:59:52Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [November 12, 2025, 4:37pm UTC](https://discourse.paraview.org/t/generating-a-mesh-from-noisy-medical-data/17300/14 "2025-11-12T16:37:20Z")

</div>

This looks promising on my Mac with a development build of ParaView.

```python
python3 -m venv ~/itkvenv
source ~/itkvenv/bin/activate
pip install ~/itkvenv
bin/paraview.app/Contents/MacOS/paraview --venv ~/itkvenv

```

Add **Wavelet** source, add **Programmable Filter** and set it’s Script to

```python
import itk
itk_image = itk.image_from_vtk_image(inputs[0])

input_type = itk.Image[itk.F,3]
output_type = itk.Image[itk.D,3]
caster = itk.cast_image_filter(itk_image, ttype=(input_type, output_type))
caster.Update()

vtk_result = itk.vtk_image_from_image(caster)
output.ShallowCopy(vtk_result)

```

The Wavelet source produces a vtkImageData with floats, and this programmable script casts that image to a vtkImageData of doubles.

Input image info:

 ![image](https://discourse.paraview.org/uploads/default/original/3X/f/f/ff2bab06a70adbd73e41dcda53c7bceb4480b1fb.png)

Output image info (note the array type is “double” instead of “float”):

 ![image](https://discourse.paraview.org/uploads/default/original/3X/d/5/d565ff35bd81efacb1537830eb994521f4e5ca43.png)

It’s maybe not the most useful example, but it demonstrates that ITK can be used within ParaView’s Python environment using virtual environments and a pip-installed ITK.

I have not tried this with a binary from [paraview.org](http://paraview.org), but it should work as long as you create your virtual environment such that it installs compatible ITK Python modules. See [Install any python package for the ParaView binary release using pip](https://discourse.paraview.org/t/install-any-python-package-for-the-paraview-binary-release-using-pip/14437) for more info about that.

---

_[View the full topic](https://discourse.paraview.org/t/generating-a-mesh-from-noisy-medical-data/17300)._
