37 #include <QFileDialog>
42 #include "vtkRenderWindow.h"
55 m_VideoName2(
""), m_FrameRate2(10), m_VideoQuality2(2), m_SliceFT(0),
56 m_WindowSelected(0), m_XMinForVideo(0), m_XMaxForVideo(0),
57 m_YMinForVideo(0), m_YMaxForVideo(0), m_ZMinForVideo(0),
58 m_ZMaxForVideo(0), m_TMinForVideo(0), m_TMaxForVideo(0),
59 m_FrameCounter(0), m_RenderWindowSelected(false)
73 ->
setStatusTip(
tr(
"You have to be in full screen view to use the video recording") );
74 this->warning_1->hide();
75 this->warning_2->hide();
78 QString ttoolTip =
"Start recording the video";
79 this->startVideo->setToolTip(ttoolTip);
80 ttoolTip =
"First slice of the video";
81 this->tSpinMin_2->setToolTip(ttoolTip);
82 ttoolTip =
"Last slice of the video";
83 this->tSpinMax_2->setToolTip(ttoolTip);
84 ttoolTip =
"Location and name of the video";
85 this->createFile->setToolTip(ttoolTip);
86 ttoolTip =
"Create video along this axe";
87 this->SliceFT->setToolTip(ttoolTip);
88 ttoolTip =
"Continue creating video from selected time points";
89 this->pauseVideo->setToolTip(ttoolTip);
90 ttoolTip =
"End the video";
91 this->endVideo->setToolTip(ttoolTip);
92 ttoolTip =
"Create video without manual interaction (usefull in 2D)";
93 this->tabVideoMethod1->setToolTip(ttoolTip);
94 ttoolTip =
"Create video with manual interaction (usefull in 3D)";
95 this->tabVideoMethod2->setToolTip(ttoolTip);
96 ttoolTip =
"Quality of the output video (high=2, medium=1, low=0)";
97 this->videoQuality->setToolTip(ttoolTip);
106 this->videoLenght->display(value);
107 this->endRecord->setEnabled(
false);
109 this->tabVideoWidget->setEnabled(
false);
134 m_FFMPEGWriter->Delete();
138 m_AVIWriter->Delete();
155 this->tSpinMin_2->setMinimum(
m_XMin);
156 this->tSpinMin_2->setMaximum(
m_XMax);
157 this->tSpinMin_2->setValue(
m_XMin);
159 this->tSpinMax_2->setMinimum(
m_XMin);
160 this->tSpinMax_2->setMaximum(
m_XMax);
161 this->tSpinMax_2->setValue(
m_XMax);
250 this->tSpinMin_2->setMinimum(
m_XMin);
251 this->tSpinMin_2->setMaximum(
m_XMax);
252 this->tSpinMin_2->setValue(
m_XMin);
254 this->tSpinMax_2->setMinimum(
m_XMin);
255 this->tSpinMax_2->setMaximum(
m_XMax);
256 this->tSpinMax_2->setValue(
m_XMax);
265 this->tSpinMin_2->setMinimum(
m_YMin);
266 this->tSpinMin_2->setMaximum(
m_YMax);
267 this->tSpinMin_2->setValue(
m_YMin);
269 this->tSpinMax_2->setMinimum(
m_YMin);
270 this->tSpinMax_2->setMaximum(
m_YMax);
271 this->tSpinMax_2->setValue(
m_YMax);
280 this->tSpinMin_2->setMinimum(
m_ZMin);
281 this->tSpinMin_2->setMaximum(
m_ZMax);
282 this->tSpinMin_2->setValue(
m_ZMin);
284 this->tSpinMax_2->setMinimum(
m_ZMin);
285 this->tSpinMax_2->setMaximum(
m_ZMax);
286 this->tSpinMax_2->setValue(
m_ZMax);
296 this->tSpinMin_2->setMinimum(
m_TMin);
297 this->tSpinMin_2->setMaximum(
m_TMax);
298 this->tSpinMin_2->setValue(
m_TMin);
300 this->tSpinMax_2->setMinimum(
m_TMin);
301 this->tSpinMax_2->setMaximum(
m_TMax);
302 this->tSpinMax_2->setValue(
m_TMax);
404 tr(
"Folder to Save Video"),
"fileName", 0);
406 this->createFile->setStyleSheet(
"background-color: rgb(0, 255, 0); color: rgb(0, 0, 0)");
407 this->createFile_2->setStyleSheet(
"background-color: rgb(255, 165, 0); color: rgb(0, 0, 0)");
410 plt.
setColor(QPalette::WindowText, Qt::black);
411 this->label->setPalette(plt);
412 this->label_2->setPalette(plt);
421 if (
m_FrameRate2 != static_cast< unsigned int >( value ) )
424 this->frameRate_2->setValue(value);
438 this->videoQuality_2->setValue(value);
450 tr(
"Folder to Save Video"),
"fileName", 0);
452 this->createFile_2->setStyleSheet(
"background-color: rgb(0, 255, 0); color: rgb(0, 0, 0)");
453 this->createFile->setStyleSheet(
"background-color: rgb(255, 165, 0); color: rgb(0, 0, 0)");
456 plt.
setColor(QPalette::WindowText, Qt::black);
457 this->label->setPalette(plt);
458 this->label_2->setPalette(plt);
467 if (
m_FrameRate2 != static_cast< unsigned int >( value ) )
470 this->frameRate->setValue(value);
484 this->videoQuality->setValue(value);
499 plt.
setColor(QPalette::WindowText, Qt::red);
500 this->label->setPalette(plt);
501 this->label_2->setPalette(plt);
503 this->createFile->setStyleSheet(
"background-color: rgb(255, 0, 0); color: rgb(0, 0, 0)");
504 this->createFile_2->setStyleSheet(
"background-color: rgb(255, 0, 0)");
524 this->startVideo->setEnabled(
false);
546 plt.
setColor(QPalette::WindowText, Qt::red);
547 this->label->setPalette(plt);
548 this->label_2->setPalette(plt);
549 this->createFile->setStyleSheet(
"background-color: rgb(255, 0, 0)");
550 this->createFile_2->setStyleSheet(
"background-color: rgb(255, 0, 0); color: rgb(0, 0, 0)");
554 this->createFile_2->setEnabled(
false);
555 this->frameRate_2->setEnabled(
false);
556 this->videoQuality_2->setEnabled(
false);
557 this->startRecord->setEnabled(
false);
558 this->tabVideoMethod1->setEnabled(
false);
559 this->endRecord->setEnabled(
true);
587 this->createFile_2->setEnabled(
true);
588 this->frameRate_2->setEnabled(
true);
589 this->videoQuality_2->setEnabled(
true);
590 this->startRecord->setEnabled(
true);
591 this->tabVideoMethod1->setEnabled(
true);
592 this->endRecord->setEnabled(
false);
605 double doubleCounter;
608 int test = 100 * doubleCounter;
624 this->videoLenght->display(value);
711 for (
unsigned int i = iMin; i < iMax + 1; i++ )
730 this->pauseVideo->setEnabled(
true);
731 this->endVideo->setEnabled(
true);
751 this->endVideo->setEnabled(
false);
752 this->pauseVideo->setEnabled(
false);
753 this->startVideo->setEnabled(
true);
std::string toStdString() const
void onEndRecordClicked()
Function called when "End video" clicked in Record tab.
unsigned int m_VideoQuality2
void timeout()
Function called with the timer to take snapshots.
void SetXMinAndMax(const int &, const int &)
Set value X Min and Max for a given image (useful for spin boxes) when image is loaded, to know boundaries of the spin box to be used.
void SetSpecificParametersFrameRate(int iValue)
void SetRenderingWindow(vtkRenderWindow *)
Set the rendering window to be observed.
void SetCurrentT(const int &)
Set current T value (useful for spin boxes)
void setColor(ColorGroup group, ColorRole role, const QColor &color)
void EndCapture()
End the video acquisition.
unsigned int m_FrameRate2
void on_frameRate_valueChanged(int)
Function called when FrameRate changes.
unsigned int m_ZMinForVideo
void SetCurrentY(const int &)
Set current Y value (useful for spin boxes)
void setIcon(const QIcon &icon)
void SetSpecificParametersQuality(int iValue)
~QGoVideoRecorder()
Destructor.
vtkRenderWindowMovieRecorder * m_VideoRecorder
void on_frameRate_2_valueChanged(int)
Update value of frame rate.
void on_SliceFT_activated(int)
Update content of spin box depending of selected slice (X,Y,Z)
virtual void SetBitRate(int)
void SetTMinAndMax(const int &, const int &)
Set value T Min and Max for a given image (useful for spin boxes) when image is loaded, to know boundaries of the spin box to be used.
QString tr(const char *sourceText, const char *disambiguation, int n)
unsigned int m_YMinForVideo
virtual void SetVideoQuality(int)
unsigned int m_FrameCounter
void UpdateQSpinBoxFT(int)
Function to update spinbox extent according to selected slice.
void AcquireWithPause(int)
Function to create the video with "pauses".
void on_videoQuality_2_valueChanged(int)
Update value of video quality.
void on_tSpinMax_2_valueChanged(int)
Update ending slice for video (fixed time point)
QString number(int n, int base)
void onStartRecordClicked()
Function called when "Create video" clicked in Record tab.
QString fromUtf8(const char *str, int size)
QString & insert(int position, QChar ch)
static vtkFFMPEGRenderWindowRecorder * New()
void emitChangeSliceSignal(const int &, const int &)
void on_videoQuality_valueChanged(int)
Function called when VideoQuality changes.
virtual void SetFrameRate(int)
void TakeSnapshot()
Take a snapshot of the current rendering window.
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
bool m_RenderWindowSelected
unsigned int m_XMaxForVideo
void on_endVideo_clicked()
Function called when we want to stop video while it is in pause.
void SetCurrentZ(const int &)
Set current Z value (useful for spin boxes)
void FrameRateChanged(int)
unsigned int m_XMinForVideo
unsigned int m_ZMaxForVideo
void StartCapture()
Start the video acquisition.
void on_createFile_clicked()
Create the video from.
QString & replace(int position, int n, QChar after)
void setStatusTip(const QString &statusTip)
void onStartVideoClicked()
Function called when "Create video" clicked in Create tab.
void SetFileName(const std::string &)
Set the name of the video.
void SetCurrentX(const int &)
Set current X value (useful for spin boxes)
void SetMovieRecorder(vtkRenderWindowMovieRecorder *)
void on_createFile_2_clicked()
Function called to choose name/path of output file.
unsigned int m_TMinForVideo
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter, QFlags< QFileDialog::Option > options)
std::ofstream m_OutputVideoFile
void SetRenderingWindow(vtkRenderWindow *)
QGoVideoRecorder(QWidget *parent=0)
Constructor.
unsigned int m_YMaxForVideo
void SetYMinAndMax(const int &, const int &)
Set value Y Min and Max for a given image (useful for spin boxes) when image is loaded, to know boundaries of the spin box to be used.
unsigned int m_TMaxForVideo
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void on_tSpinMin_2_valueChanged(int)
Update starting slice for video (fixed time point)
void SetZMinAndMax(const int &, const int &)
Set value Z Min and Max for a given image (useful for spin boxes) when image is loaded, to know boundaries of the spin box to be used.
static vtkAVIRenderWindowRecorder * New()
void on_pauseVideo_clicked()
Function called when we want to restart video while it is in pause.
virtual void SetSpecificParameters()=0