[vtkusers] vtkJPEGWriter not writing file

David Doria daviddoria+vtk at gmail.com
Tue Mar 16 12:41:19 EDT 2010


I have used vtkJPEGWriter many times before with no problems. However,
in this case it seems to simply do nothing. I can't reproduce the
problem in a simple example (the writer writes like it is supposed to)
so I'm assuming there is something wrong with the vtkImageData I am
trying to write.

I tried to make sure the imageData was valid with some outputs:

  vtkImageData* outputImage = superPixelSegmentation->GetOutput();

  int dims[3];
  outputImage->GetDimensions(dims);
  cout << "Dims: " << dims[0] << " " << dims[1] << " " << dims[2] << endl;

  int extent[3];
  outputImage->GetExtent(extent);
  cout << "Extent: " << extent[0] << " " << extent[1] << " " <<
extent[2]  << " " << extent[3] << " " << extent[4] << " " << extent[5]
<< endl;

  cout << "number of points: " << outputImage->GetNumberOfPoints() << endl;

  vtkSmartPointer<vtkJPEGWriter> writer =
      vtkSmartPointer<vtkJPEGWriter>::New();
  writer->DebugOn();
  writer->SetFileName(outputFilename.c_str());
  writer->SetInput(outputImage);
  writer->Write();


The output is:

Dims: 1999 1080 1
Extent: 0 1998 0 1079 0 0
number of points: 2158920

but the file is not written!? Any suggestions on what else to check
before writing the file?

Thanks,

David



More information about the vtkusers mailing list