# Unstructured mesh to image

**URL:** https://discourse.paraview.org/t/unstructured-mesh-to-image/13496
**Category:** ParaView Support
**Created:** [December 13, 2023, 9:53am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496 "2023-12-13T09:53:01Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 9:53am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/1 "2023-12-13T09:53:01Z")

</div>

I have a 2d unstructured mesh, that I want to resample to image (pixel based) . If I use the filter resample to image, I get an empty figure (it seems it takes only only triangle?)

I follow the steps mentioned here, [Resampling using cell data?](https://discourse.paraview.org/t/resampling-using-cell-data/7238)  
but still, I can’t get an output of this.  
Could someone explain how to do this?

 ![l1_v4](https://discourse.paraview.org/uploads/default/original/2X/1/19289bbe7292119283f2c8e0951e7e8095bc2ed7.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:10am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/2 "2023-12-13T10:10:07Z")

</div>

Sadly resampling 2D data is not easy in ParaView, can you give it some depth ?

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:13am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/3 "2023-12-13T10:13:41Z")

</div>

Sure, I can follow this

> [@Resample to Image returns an empty field](https://discourse.paraview.org/t/resample-to-image-returns-an-empty-field/13347/5):
>
> RessampleToImage is not intended to work on 2D data. You can use ExtractSurface and LinearExtrusion to have result looking like this:

to get a 3d version of my data.

 ![paraview_2](https://discourse.paraview.org/uploads/default/original/2X/d/dceaa9c8b3c7eac77f837e04b38175815051706e.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:14am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/4 "2023-12-13T10:14:47Z")

</div>

Then resampling should work

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:16am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/5 "2023-12-13T10:16:08Z")

</div>

I still get an empty image

 ![3araview_2](https://discourse.paraview.org/uploads/default/original/2X/f/f147964b1fcd73eb58d61a644c5653ebe3564be1.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:16am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/6 "2023-12-13T10:16:52Z")

</div>

Please share your data

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:17am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/7 "2023-12-13T10:17:30Z")

</div>

[resistivity.vtk](https://discourse.paraview.org/uploads/short-url/2NcdoCoFjs2m8kq65rlgQSZNjl2.vtk) (573.2 KB)

The data shared

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:21am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/8 "2023-12-13T10:21:09Z")

</div>

nevermind, ResampleToImage seems to work fine with 2D data!

 ![a](https://discourse.paraview.org/uploads/default/original/2X/5/51070792cf49aefe4196f0093cf94066a0ecfafc.png)

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:23am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/9 "2023-12-13T10:23:59Z")

</div>

> [@mwestphal](#):
>
> are your data

 ![3araview_3](https://discourse.paraview.org/uploads/default/original/2X/a/a1c871c617385de624eec0f269f95c19493d8422.png)

For me, it returns an empty figure.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:25am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/10 "2023-12-13T10:25:10Z")

</div>

Change outline representation to surface

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:25am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/11 "2023-12-13T10:25:47Z")

</div>

And closing the app and start again, it’s working !

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:29am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/12 "2023-12-13T10:29:04Z")

</div>

Something is off. The pixels, do not have a solid color. In other words, I was expecting that each pixel to have one color.

 ![3araview_4](https://discourse.paraview.org/uploads/default/original/2X/3/3eb10a88a172860cde7cfc9a6215cc58b622f7fd.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:29am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/13 "2023-12-13T10:29:49Z")

</div>

This is expected with point data. Use Cell Data instead. You can convert using PointDataToCellData filter.

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:32am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/14 "2023-12-13T10:32:41Z")

</div>

Sorry, can’t seem to find this filter. I can only seer CellDataToPoint data.

Can you help me out?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:38am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/15 "2023-12-13T10:38:54Z")

</div>

Filters → Alphabetical → PointDataToCellData

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:41am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/16 "2023-12-13T10:41:10Z")

</div>

It’s not there for me. I guess it’s because the original vtk is already cell?

![3araview_5](https://discourse.paraview.org/uploads/default/original/2X/6/67b2273e51838c6eccce45ee39d98f6c6ed1fbad.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:42am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/17 "2023-12-13T10:42:43Z")

</div>

Yes, use the filter on the ResampleToImage instead.

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:44am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/18 "2023-12-13T10:44:52Z")

</div>

Thanks a lot, that worked.

---

<div class="post-metadata">

### Author: ![marios\_geo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@marios\_geo](https://discourse.paraview.org/u/marios_geo)
#### Post date: [December 13, 2023, 10:55am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/19 "2023-12-13T10:55:34Z")

</div>

Follow up:  
I have now a 3d volume, which I make slices out of it. Now the same filter, isn’t working the same way. What is the procedure for 3d?  
Slice

 ![3araview_6](https://discourse.paraview.org/uploads/default/original/2X/a/aaa86a1ab8e7b772905e22e49b41ed85bfd85f19.png)  
3D unstructured mesh  
 ![3araview_7](https://discourse.paraview.org/uploads/default/original/2X/3/38a757619f1c8e8680a062338e262bd6fce39921.jpeg)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 13, 2023, 10:56am UTC](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496/20 "2023-12-13T10:56:37Z")

</div>

Please share some data

[Next page](https://discourse.paraview.org/t/unstructured-mesh-to-image/13496.md?page=2)
