Scott G
Scott G

Reputation: 2310

ParaView: How to fix "PNGWriter only supports unsigned char and unsigned short inputs"?

I am trying to convert from .vtk to a series of .png slices (i.e., P images each with a resolution of MxN). I am currently using ParaView to attempt to accomplish this. However, upon attempting to save the data as .png, I receive the following error:

vtkkPNGWriter (0x7fa8339b4620) PNGWriter only supports unsigned char and unsigned short inputs

The steps I am currently attempting are:

  1. Load the data
  2. Apply the filter: Convert from cell to point data
  3. Apply the filter: Resample to Image
  4. Save Data as .png
  5. Error as specified above.

This error appears regardless of data format (i.e., jpg, png, etc.). However, it successfully outputs a .mhd file that is readable with Slicer.

Is there a fix for this, is it just my dataset, or is this a known bug?

I am also open to suggestions for ways of easily generating the sequence of images I need so I can throw them into something like ImageJ. Currently looking at python vtk and SimpleITK.

ParaView Versions Tested:

Upvotes: 0

Views: 852

Answers (1)

Mathieu Westphal
Mathieu Westphal

Reputation: 2633

Use a calculator filter to convert your data to unsigned char:

  • Load the data
  • Apply the filter: Convert from cell to point data
  • Apply the filter: Resample to Image
  • Add a calculator filter
  • Output type : unsigned char
  • Formula : yourOwnArray
  • Apply
  • Save Data as .png

Upvotes: 1

Related Questions