skeletonVisualization::skeletonVisualization(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); ui.centralWidget->setContentsMargins(6, 6, 6, 6); ui.centralWidget->setLayout(ui.horizontalLayout); connect(ui.buttonOpen, SIGNAL(clicked()), this, SLOT(openImage())); connect(ui.actionOpen, SIGNAL(activated()), this, SLOT(openImage())); connect(ui.buttonRefresh, SIGNAL(clicked()), this, SLOT(updateSkeleton())); connect(ui.actionRefresh, SIGNAL(activated()), this, SLOT(updateSkeleton())); connect(ui.buttonSave, SIGNAL(clicked()), this, SLOT(saveImage())); connect(ui.actionSave, SIGNAL(activated()), this, SLOT(saveImage())); connect(ui.buttonConnect, SIGNAL(clicked()), this, SLOT(breaksConnector())); connect(ui.actionConnect, SIGNAL(activated()), this, SLOT(breaksConnector())); connect(ui.buttonQuit, SIGNAL(clicked()), this, SLOT(exitMethod())); connect(ui.actionQuit, SIGNAL(activated()), this, SLOT(exitMethod())); connect(ui.sliderScale, SIGNAL(valueChanged(int)), this, SLOT(setScaleValue(int))); connect(ui.checkBoxCircles, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.checkBoxBones, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.checkBoxContours, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.checkBoxImage, SIGNAL(stateChanged(int)), this, SLOT(checkBoxesChanged(int))); connect(ui.actionOn, SIGNAL(activated()), this, SLOT(scaleOn())); connect(ui.actionOff, SIGNAL(activated()), this, SLOT(scaleOff())); connect(ui.actionOriginal, SIGNAL(activated()), this, SLOT(scaleOrig())); connect(ui.actionInternal, SIGNAL(activated()), this, SLOT(internal())); connect(ui.actionExternal, SIGNAL(activated()), this, SLOT(external())); scene = 0; drawCircles = ready = 0; drawBones = drawImage = drawContours = skeletonView = 1; scale = 1.0; }
QColor ColorValueMap::color(const double &value, int colors) { QColor result; switch (colorMap_) { case GREYSCALE: result.setRgbF(scaleOn(value, 0.1, 0.9, colors), scaleOn(value, 0.1, 0.9, colors), scaleOn(value, 0.1, 0.9, colors)); break; case SPRING: result.setRgbF(1.0, scaleOn(value, 0.0, 1.0, colors), scaleOn(value, 1.0, 0.0, colors)); break; case SUMMER: result.setRgbF(scaleOn(value, 0.0, 1.0, colors), scaleOn(value, 0.5, 1.0, colors), 0.4); break; case AUTUMN: result.setRgbF(1.0, scaleOn(value, 0.0, 1.0, colors), 0.0); break; case WINTER: result.setRgbF(0.0, scaleOn(value, 0.0, 1.0, colors), scaleOn(value, 1.0, 0.5, colors)); break; case HOT: result.setRgbF(scaleOn(value, min_, min_ + (max_ - min_) / 3.0, 0.0, 1.0, colors / 2), scaleOn(value, min_ + (max_ - min_) / 3.0, min_ + 2.0 * (max_ - min_) / 3.0, 0.0, 1.0, colors / 2), scaleOn(value, min_ + 2.0 * (max_ - min_) / 3.0, max_, 0.0, 1.0, colors / 2)); break; case COOL: result.setRgbF(scaleOn(value, 0.0, 1.0, colors), scaleOn(value, 1.0, 0.0, colors), 1.0); break; default: break; } return result; }