17 #include <QTextStream>
19 #include <vtkImageChangeInformation.h>
20 #include <vtkImageLuminance.h>
21 #include <vtkImageData.h>
22 #include "vtkImageAppend.h"
23 #include "vtkMetaImageWriter.h"
37 mSaveFolder(saveFolder),
40 mMutex(QMutex::Recursive),
43 mTimestampsFile(saveFolder+
"/"+prefix+
".fts"),
44 mCompressed(compressed),
45 mWriteColor(writeColor)
47 this->setObjectName(
"org.custusx.resource.videorecordersave");
61 data.
mImage = vtkImageDataPtr::New();
62 data.
mImage->DeepCopy(image);
66 QMutexLocker sentry(&
mMutex);
116 vtkSmartPointer<vtkImageLuminance> luminance = vtkSmartPointer<vtkImageLuminance>::New();
117 luminance->SetInputData(data.
mImage);
119 data.
mImage = luminance->GetOutput();
125 writer->SetInputData(data.
mImage);
151 QMutexLocker sentry(&
mMutex);
156 this->
write(current);
183 mImages->setDeleteFilesOnRelease(
true);
186 mSaveFolder = saveFolder;
188 mSaveThread->start();
193 mSaveThread->cancel();
207 void SavingVideoRecorder::newFrameSlot()
209 if (!mSource->validData())
213 TimeInfo timestamp = mSource->getAdvancedTimeInfo();
214 QString filename = mSaveThread->addData(timestamp, image);
216 mImages->append(filename);
217 mTimestamps.push_back(timestamp);
234 mSaveThread->cancel();
237 this->deleteFolder(mSaveFolder);
242 void SavingVideoRecorder::deleteFolder(QString folder)
245 filters <<
"*.fts" <<
"*.mhd" <<
"*.raw" <<
"*.zraw";
246 for (
int i=0; i<filters.size(); ++i)
247 filters[i] = mPrefix + filters[i];
250 QStringList files = dir.entryList(filters);
252 for (
int i=0; i<files.size(); ++i)
253 dir.remove(files[i]);