Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

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:

  • Linux 5.4.0
  • Windows 5.8.0
question from:https://stackoverflow.com/questions/65909302/paraview-how-to-fix-pngwriter-only-supports-unsigned-char-and-unsigned-short-i

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...