-
Notifications
You must be signed in to change notification settings - Fork 0
/
imagetree.cpp
30 lines (28 loc) · 886 Bytes
/
imagetree.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "imagetree.h"
imagetree::imagetree():QTreeWidget()
{
}
imagetree::imagetree(QWidget *w):QTreeWidget(w)
{
}
void imagetree::addItemCustom()
{
QString fileName = QFileDialog::getOpenFileName(0, QString("Open image"), QString(""), QString("*.jpg;*.png;*.tif;*.tiff;*.jpeg"));
if (fileName != "")
{
imageTreeNode* item = new imageTreeNode(fileName);
this->addTopLevelItem(item);
this->setCurrentItem(item);
}
}
void imagetree::selectionChangedSlot()
{
imageTreeNode* item = (imageTreeNode*)this->selectedItems().at(0);
cv::Mat m = cv::imread(ProcessingCore::convertToStdString(item->fileName), -1);
if (item->channel>=0)
{
m = ProcessingCore::getChannel((Channels)item->channel, m);
}
QImage* image = ProcessingCore::convertToQImage(m);
emit this->itemSelected(image);
}