15#include <QmitkServiceListWidget.h>
19#include <mitkIOUtil.h>
29 : QmitkAbstractView(),
48 connect(
m_Controls.m_ConnectedDeviceServiceListWidget, SIGNAL(ServiceSelectionChanged(us::ServiceReferenceU)),
this, SLOT(
OnSelectCamera()));
50 std::string filter =
"";
53 std::string defaultPath =
"/tmp/";
55 defaultPath =
"C:/tmp/";
57 m_Controls.m_PathToSaveFiles->setText(defaultPath.c_str());
68 std::vector<std::string> fileExtensions;
69 fileExtensions.push_back(
".png");
70 fileExtensions.push_back(
".nrrd");
71 fileExtensions.push_back(
".jpg");
72 QStringList extensions;
73 for(
unsigned int i = 0; i < fileExtensions.size(); ++i)
75 extensions.append(QString(fileExtensions.at(i).c_str()));
77 this->UpdateGUIElements(device,
"no depth property available",
m_Controls.m_SaveDepth,
m_Controls.m_DepthFormat, extensions,
".nrrd");
84 this->UpdateGUIElements(device,
"HasAmplitudeImage",
m_Controls.m_SaveAmplitude ,
85 m_Controls.m_AmplitudeFormat, extensions,
".nrrd");
86 this->UpdateGUIElements(device,
"HasIntensityImage",
m_Controls.m_SaveIntensity,
87 m_Controls.m_IntensityFormat, extensions,
".nrrd");
88 this->UpdateGUIElements(device,
"HasRGBImage",
m_Controls.m_SaveColor,
90 this->UpdateGUIElements(device,
"HasRawImage",
m_Controls.m_SaveRaw,
94void QmitkToFScreenshotMaker::UpdateGUIElements(
mitk::ToFCameraDevice* device,
const char* ToFImageType,
95 QCheckBox* saveCheckBox, QComboBox* saveTypeComboBox,
96 QStringList fileExentions,
const char* preferredFormat)
98 bool isTypeProvidedByDevice =
false;
100 saveCheckBox->setChecked(isTypeProvidedByDevice);
101 saveCheckBox->setEnabled(isTypeProvidedByDevice);
103 saveTypeComboBox->clear();
104 saveTypeComboBox->setEnabled(isTypeProvidedByDevice);
105 saveTypeComboBox->addItems(fileExentions);
106 int index = saveTypeComboBox->findText(preferredFormat);
108 saveTypeComboBox->setCurrentIndex(index);
118 this->SaveImage(source->GetOutput(0),
m_Controls.m_SaveDepth->isChecked(),
119 m_Controls.m_PathToSaveFiles->text().toStdString(), std::string(
"Depth_"),
120 m_Controls.m_DepthFormat->currentText().toStdString());
121 this->SaveImage(source->GetOutput(1),
m_Controls.m_SaveAmplitude->isChecked(),
122 m_Controls.m_PathToSaveFiles->text().toStdString(), std::string(
"Amplitude_"),
123 m_Controls.m_AmplitudeFormat->currentText().toStdString());
124 this->SaveImage(source->GetOutput(2),
m_Controls.m_SaveIntensity->isChecked(),
125 m_Controls.m_PathToSaveFiles->text().toStdString(), std::string(
"Intensity_"),
126 m_Controls.m_IntensityFormat->currentText().toStdString());
127 this->SaveImage(source->GetOutput(3),
m_Controls.m_SaveColor->isChecked(),
128 m_Controls.m_PathToSaveFiles->text().toStdString(), std::string(
"Color_"),
129 m_Controls.m_ColorFormat->currentText().toStdString());
136void QmitkToFScreenshotMaker::SaveImage(mitk::Image::Pointer image,
bool saveImage, std::string path, std::string name, std::string extension)
140 std::stringstream outdepthimage;
141 outdepthimage << path << name<< m_SavingCounter << extension;
142 mitk::IOUtil::Save( image, outdepthimage.str() );
~QmitkToFScreenshotMaker() override
Ui::QmitkToFScreenshotMakerControls m_Controls
void CreateQtPartControl(QWidget *parent) override
void OnMakeScreenshotClicked()
OnMakeScreenshotClicked Slot called when the "Make screenshot" button is pressed.
void OnSelectCamera()
OnSelectCamera Slot called to update the GUI according to the selected image source.
static const std::string VIEW_ID
QmitkToFScreenshotMaker()
Virtual interface and base class for all Time-of-Flight devices.
virtual bool IsCameraActive()
returns true if the camera is connected and started
bool GetBoolProperty(const char *propertyKey, bool &boolValue)
get a bool from the property list
Image source providing ToF images. Interface for filters provided in ToFProcessing module.
ToFCameraDevice * GetCameraDevice()
Get the currently set ToF camera device.
Image source providing ToF images. Interface for filters provided in ToFProcessing module.