vtkImageWriter does only write zero data?!

Rene Tschirley pooh at cs.tu-berlin.de
Mon Sep 27 07:13:03 EDT 1999

Dear all,

Thank you for reply to the problem with mouse interaction. I'll
contact you via private email next days.

Again, I'm clueless about VTK. I use vtkImageReader to read some
grey-level based images (single pics from fullHead-sequence in
vtkdata). Not I want to transform them and write them back into a
separate file (I'm generating testimages for an image registration
application). This shall be done with vtkImageWriter, because all
other image writers (BMP, TIFF, PNM) don't accept short scalars, but
only chars. There seems to be nor runtime problem neither compilation
warnings. A file of the correct size is created but containing only
zero data. Here's the code:

static void write_image(vtkImageData *img, char *filename)
  vtkImageWriter *writer = vtkImageWriter::New();


A little confusing thing: the statement 'delete writer' before the
return leads to the runtime warning "ERROR In vtkObject.cxx, line 114,
vtkObject (0x806e160): Trying to delete object with non-zero reference
count." which I don't quite understand.

I guess that the method Write() does not flush the image cache. Is
that possible?


Dipl.-Inform. René Tschirley, pooh at cs.tu-berlin.de
Phone&Address: see http://cs.tu-berlin.de/~pooh
Technische Universität Berlin, FB Informatik, Fachgruppe Computer Graphics

This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.

More information about the vtkusers mailing list