1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef _vvOverlayPanel_CXX
19 #define _vvOverlayPanel_CXX
20 #include "vvOverlayPanel.h"
24 #include "QTreePushButton.h"
26 #include <vtksys/SystemTools.hxx>
28 //====================================================================
29 vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent)
36 subSamplingSpinBox->setEnabled(0);
37 scaleSpinBox->setEnabled(0);
39 lutCheckBox->setEnabled(0);
40 connect(subSamplingSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
41 connect(scaleSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
42 connect(lutCheckBox,SIGNAL(clicked()),this,SLOT(setVFProperty()));
43 connect(vfWidthSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
44 connect(colorHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setOverlayProperty()));
45 connect(opacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
46 connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
47 connect(windowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
48 connect(levelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
51 void vvOverlayPanel::getCurrentImageName(QString name)
53 QString filename = "<b>Current image : </b>";
54 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
55 currentImageLabel->setText(filename.toStdString().c_str());
58 void vvOverlayPanel::getVFProperty(int subsampling, int scale, int log)
60 if (subsampling != -1) {
62 vFFrame->setEnabled(1);
63 subSamplingSpinBox->setEnabled(1);
64 subSamplingSpinBox->setValue(subsampling);
65 scaleSpinBox->setEnabled(1);
66 scaleSpinBox->setValue(scale);
67 lutCheckBox->setEnabled(1);
69 lutCheckBox->setCheckState(Qt::Checked);
71 lutCheckBox->setCheckState(Qt::Unchecked);
74 vFFrame->setEnabled(0);
75 subSamplingSpinBox->setEnabled(0);
76 subSamplingSpinBox->setValue(0);
77 scaleSpinBox->setEnabled(0);
78 scaleSpinBox->setValue(0);
79 lutCheckBox->setEnabled(0);
80 lutCheckBox->setCheckState(Qt::Unchecked);
84 void vvOverlayPanel::getVFName(QString name)
86 QString filename = "<b>Deformation Field : </b>";
87 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
88 vectorFieldNameLabel->setText(filename.toStdString().c_str());
91 void vvOverlayPanel::setVFProperty()
93 emit VFPropertyUpdated(subSamplingSpinBox->value(),
94 scaleSpinBox->value(),
95 lutCheckBox->checkState(),
96 vfWidthSpinBox->value());
99 void vvOverlayPanel::getCurrentVectorInfo(int visibility, double x,double y,double z, double value)
101 QString motion = "<b>Displacement : </b>";
102 QString motionValue = "<b>Length : </b>";
104 motion += QString::number(x,'f',1) + " ";
105 motion += QString::number(y,'f',1) + " ";
106 motion += QString::number(z,'f',1) + " ";
108 motionValue += QString::number(value,'f',1);
110 coordinatesLabel->setText(motion);
111 normLabel->setText(motionValue);
114 void vvOverlayPanel::getOverlayName(QString name)
116 QString filename = "<b>Compare with : </b>";
117 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
118 imageComparedLabel->setText(filename.toStdString().c_str());
121 void vvOverlayPanel::getOverlayProperty(int value)
124 compareFrame->show();
125 compareFrame->setEnabled(1);
126 colorHorizontalSlider->setEnabled(1);
127 colorHorizontalSlider->setValue(value);
129 compareFrame->hide();
130 compareFrame->setEnabled(0);
131 colorHorizontalSlider->setEnabled(0);
132 colorHorizontalSlider->setValue(0);
136 void vvOverlayPanel::setOverlayProperty()
138 emit OverlayPropertyUpdated(colorHorizontalSlider->value());
141 void vvOverlayPanel::getCurrentOverlayInfo(int visibility,double valueOver, double valueRef)
143 QString refValue = "<b>Pixel value in image 1 : </b>";
144 QString overlayValue = "<b>Pixel value in image 2 : </b>";
145 QString diffValue = "<b>Pixel difference : </b>";
147 refValue += QString::number(valueRef);
148 overlayValue += QString::number(valueOver,'f',1);
149 diffValue += QString::number(valueRef - valueOver,'f',1);
151 refValueLabel->setText(refValue);
152 valueLabel->setText(overlayValue);
153 diffValueLabel->setText(diffValue);
155 void vvOverlayPanel::getFusionName(QString name)
157 QString filename = "<b>Fusion with : </b>";
158 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
159 dataFusionnedLabel->setText(filename.toStdString().c_str());
162 void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window, double level)
166 fusionFrame->setEnabled(1);
167 opacityHorizontalSlider->setEnabled(1);
168 opacityHorizontalSlider->setValue(opacity);
169 fusionColorMapComboBox->setEnabled(1);
170 fusionColorMapComboBox->setCurrentIndex(colormap);
171 windowSpinBox->setEnabled(1);
172 levelSpinBox->setEnabled(1);
173 windowSpinBox->setValue(window);
174 levelSpinBox->setValue(level);
177 fusionFrame->setEnabled(0);
178 opacityHorizontalSlider->setEnabled(0);
179 opacityHorizontalSlider->setValue(0);
180 fusionColorMapComboBox->setEnabled(0);
181 fusionColorMapComboBox->setCurrentIndex(-1);
182 windowSpinBox->setEnabled(0);
183 levelSpinBox->setEnabled(0);
187 void vvOverlayPanel::setFusionProperty()
189 emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
190 windowSpinBox->value(), levelSpinBox->value());
193 void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
195 QString fusionValue = "<b>Pixel value in image 2 : </b>";
197 fusionValue += QString::number(value,'f',1);
199 valueFusionnedLabel->setText(fusionValue);
202 #endif /* end #define _vvOverlayPanel_CXX */