Commit 09875de6 authored by Emmanuel Promayon's avatar Emmanuel Promayon

FIXED key shortcut to reset image interactor LUT modification

When the user Left Click and move the mouse in a slice viewer
(e.g., the axial slice), the LUT is modified interactively thanks
to the vtkInteractorStyleImage. This is very handy but there
was no simple way to reset the modifications applied to the LUT.
The user can now press "R" to reset these modifications.
Also fixed by this commit: the colors of the What's This panel
made it difficult to read. Text background and foreground colors
are now more constrasted and it should be easy to read the what's
this help.
parent b5f9f671
......@@ -77,7 +77,7 @@
#include <vtkRendererCollection.h>
#include <vtkExtractSelectedFrustum.h>
#include <vtkPointData.h>
#include <vtkImageProperty.h>
namespace camitk {
// ---------------------- singleton ----------------------------
......@@ -435,6 +435,7 @@ QWidget* InteractiveViewer::getWidget(QWidget* parent) {
addWhatsThisItem("Alt+L", "Toggle light follows camera");
addWhatsThisItem("Alt+P", "Toggle point rendering");
addWhatsThisItem("P", "Pick (flip selection flag for point/cell)");
addWhatsThisItem("R", "Reset Image Interactor Look Up Table");
addWhatsThisItem("S", "Take a screenshot");
addWhatsThisItem("Alt+S", "Toggle surfacerendering");
addWhatsThisItem("T", "Trackball interaction mode");
......@@ -1009,26 +1010,33 @@ void InteractiveViewer::initActions() {
// ----------------------initWhatsThis ----------------------------
void InteractiveViewer::initWhatsThis() {
whatsThis = "<font size=\"8pt\"><center><b><u><i>3D view interaction Shortcuts</i></u></b></center><br/></font>";
QColor bgColor = frame->palette().color(QPalette::Button);
QColor textColor = frame->palette().color(QPalette::ButtonText);
whatsThis = "<div style=\"background:" + bgColor.name() + "\"><font size=\"8pt\" color=\"" + textColor.name() + "\" ><center><b><u><i>3D view interaction Shortcuts</i></u></b></center><br/></font></div>";
}
// ----------------------startWhatsThisSection ----------------------------
void InteractiveViewer::startWhatsThisSection(const QString& title) {
whatsThis += "<font size=\"9pt\"><center><b><i>" + title + "</i></b></center></font>\
<table cellpadding = \"0\" cellspacing=\"0\" width=\"100%\">";
QColor bgColor = frame->palette().color(QPalette::Button);
QColor textColor = frame->palette().color(QPalette::ButtonText);
whatsThis += "<div style=\"background:" + bgColor.name() + "\"><font size=\"9pt\" color=\"" + textColor.name() + "\"><center><b><i>" + title + "</i></b></center>\
<table bgcolor=\"" + bgColor.name() + "\" cellpadding = \"0\" cellspacing=\"0\" width=\"100%\">";
oddWhatsThis = true;
}
// ----------------------endWhatsThisSection ----------------------------
void InteractiveViewer::endWhatsThisSection() {
whatsThis += "</table>\
whatsThis += "</table></font></div>\
<br>";
}
// ----------------------addWhatsThisItem ----------------------------
void InteractiveViewer::addWhatsThisItem(const QString& key, const QString& description) {
if (oddWhatsThis) {
whatsThis += "<tr bgcolor=\"#ECD4C8\">";
QColor bgColor = frame->palette().color(QPalette::Midlight);
whatsThis += "<tr bgcolor=\"" + bgColor.name() + "\">";
}
else {
whatsThis += "<tr>";
......@@ -1153,6 +1161,12 @@ void InteractiveViewer::keyPressEvent(QKeyEvent* e) {
break;
case Qt::Key_R:
if (myType == SLICE_VIEWER) {
resetLUT();
}
break;
case Qt::Key_S:
// addWhatsThisItem("Alt+S", "Toggle surface rendering");
......@@ -1670,6 +1684,23 @@ void InteractiveViewer::toggleInterpolation() {
}
}
//------------------------- resetLUT ----------------------------
void InteractiveViewer::resetLUT() {
foreach (Component* comp, actorMap.keys()) {
if (comp->getRepresentation() == Component::SLICE) {
// reset property LUT
vtkSmartPointer<vtkImageProperty> initProp = vtkImageProperty::New();
initProp->SetInterpolationTypeToLinear();
initProp->SetAmbient(1.0);
initProp->SetDiffuse(0.0);
comp->get2DImageActor()->SetProperty(initProp);
// the Component was modified inside the viewer, refresh all its other viewer
comp->refresh();
}
}
}
//---------------------updateSelectionDisplay------------------------
void InteractiveViewer::updateSelectionDisplay(Component* comp) {
InterfaceGeometry::EnhancedModes m = InterfaceGeometry::Normal;
......
......@@ -390,6 +390,9 @@ protected:
/// for InterfaceBitMap, toggle the interpolation mode (intern method, not a property because it can only be modified by the keyboard interaction)
void toggleInterpolation();
/// for InterfaceBitMap, reset the lut that was changed by the image interactor (window and level)
void resetLUT();
/// Update the display of the given Component, according to its selection state and the current HighlightMode.
void updateSelectionDisplay(Component*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment