[vtkusers] How to print VtkBmpWriter

ISTB f.dshabarow at gmail.com
Thu Oct 4 08:21:08 EDT 2012


I am using VTKBMPWriter to create a bmp image from my render window:

        vtkWindowToImageFilter *winToImg = vtkWindowToImageFilter::New();
	winToImg->SetInput(mRenderWindow);
	vtkBMPWriter *writer = vtkBMPWriter::New();
	writer->SetInput(winToImg->GetOutput());
	writer->SetFileName(aFilename.c_str());
	writer->Write();


But now I would like to print the image. For this purpose I am using the 
QPrinter:

    QPrinter printer;
    QPrintDialog *dialog = new QPrintDialog(&printer);
    dialog->setWindowTitle(tr("Print Document"));
    if (dialog->exec() != QDialog::Accepted) {
        return;
    }
    QImage testbild("C:\\test.bmp");
    QPainter painter(&printer);
    painter.drawImage(QPoint(0, 0), testbild);
    painter.end();


Instead of giving the path of the bmp filename, I would like to give the 
bitmap itself from the vtkbmpwriter. How can I extract the bmp image from the 
writer? With GetOutput?




More information about the vtkusers mailing list