From: srit Date: Thu, 7 Apr 2011 15:46:47 +0000 (+0000) Subject: Added support for ffmpeg library if VTK_USE_FFMPEG_ENCODER is ON with extension ... X-Git-Tag: v1.2.0~59 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2d6b6fbd8edc053c10eae660130fd0b7d7d6520f;p=clitk.git Added support for ffmpeg library if VTK_USE_FFMPEG_ENCODER is ON with extension .avi in snapshots. --- diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 5fec7b2..2d1feeb 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -66,6 +66,7 @@ #include #include #include +#include #include #include #include @@ -2543,6 +2544,9 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget) Extensions += "Images( *.bmp);;"; Extensions += "Images( *.tif);;"; Extensions += "Images( *.ppm)"; +#ifdef VTK_USE_FFMPEG_ENCODER + Extensions += "Images( *.avi)"; +#endif #ifdef VTK_USE_MPEG2_ENCODER Extensions += "Images( *.mpg)"; #endif @@ -2590,6 +2594,29 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget) jpg->SetFileName(fileName.toStdString().c_str()); jpg->Write(); jpg->Delete(); +#ifdef VTK_USE_FFMPEG_ENCODER + } else if (!strcmp(ext, ".avi")) { + vtkFFMPEGWriter *mpg = vtkFFMPEGWriter::New(); + mpg->SetInput(image); + mpg->SetFileName(fileName.toStdString().c_str()); + mpg->SetQuality(2); + mpg->SetRate(5); + mpg->Start(); + + vvImage * vvImg = mSlicerManagers[smIndex]->GetImage(); + int nSlice = vvImg->GetVTKImages().size(); + for(int i=0; iSetNextTSlice(0); + vtkSmartPointer w2i = vtkSmartPointer::New(); + w2i->SetInput(widget->GetRenderWindow()); + w2i->Update(); + mpg->SetInput(w2i->GetOutput()); + mpg->Write(); + } + mpg->End(); + mpg->Delete(); +#endif #ifdef VTK_USE_MPEG2_ENCODER } else if (!strcmp(ext, ".mpg")) { vtkMPEG2Writer *mpg = vtkMPEG2Writer::New();