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)
63 vFFrame->setEnabled(1);
64 subSamplingSpinBox->setEnabled(1);
65 subSamplingSpinBox->setValue(subsampling);
66 scaleSpinBox->setEnabled(1);
67 scaleSpinBox->setValue(scale);
68 lutCheckBox->setEnabled(1);
70 lutCheckBox->setCheckState(Qt::Checked);
72 lutCheckBox->setCheckState(Qt::Unchecked);
77 vFFrame->setEnabled(0);
78 subSamplingSpinBox->setEnabled(0);
79 subSamplingSpinBox->setValue(0);
80 scaleSpinBox->setEnabled(0);
81 scaleSpinBox->setValue(0);
82 lutCheckBox->setEnabled(0);
83 lutCheckBox->setCheckState(Qt::Unchecked);
87 void vvOverlayPanel::getVFName(QString name)
89 QString filename = "<b>Deformation Field : </b>";
90 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
91 vectorFieldNameLabel->setText(filename.toStdString().c_str());
94 void vvOverlayPanel::setVFProperty()
96 emit VFPropertyUpdated(subSamplingSpinBox->value(),
97 scaleSpinBox->value(),
98 lutCheckBox->checkState(),
99 vfWidthSpinBox->value());
102 void vvOverlayPanel::getCurrentVectorInfo(int visibility, double x,double y,double z, double value)
104 QString motion = "<b>Displacement : </b>";
105 QString motionValue = "<b>Length : </b>";
108 motion += QString::number(x,'f',1) + " ";
109 motion += QString::number(y,'f',1) + " ";
110 motion += QString::number(z,'f',1) + " ";
112 motionValue += QString::number(value,'f',1);
114 coordinatesLabel->setText(motion);
115 normLabel->setText(motionValue);
118 void vvOverlayPanel::getOverlayName(QString name)
120 QString filename = "<b>Compare with : </b>";
121 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
122 imageComparedLabel->setText(filename.toStdString().c_str());
125 void vvOverlayPanel::getOverlayProperty(int value)
129 compareFrame->show();
130 compareFrame->setEnabled(1);
131 colorHorizontalSlider->setEnabled(1);
132 colorHorizontalSlider->setValue(value);
136 compareFrame->hide();
137 compareFrame->setEnabled(0);
138 colorHorizontalSlider->setEnabled(0);
139 colorHorizontalSlider->setValue(0);
143 void vvOverlayPanel::setOverlayProperty()
145 emit OverlayPropertyUpdated(colorHorizontalSlider->value());
148 void vvOverlayPanel::getCurrentOverlayInfo(int visibility,double valueOver, double valueRef)
150 QString refValue = "<b>Pixel value in image 1 : </b>";
151 QString overlayValue = "<b>Pixel value in image 2 : </b>";
152 QString diffValue = "<b>Pixel difference : </b>";
155 refValue += QString::number(valueRef);
156 overlayValue += QString::number(valueOver,'f',1);
157 diffValue += QString::number(valueRef - valueOver,'f',1);
159 refValueLabel->setText(refValue);
160 valueLabel->setText(overlayValue);
161 diffValueLabel->setText(diffValue);
163 void vvOverlayPanel::getFusionName(QString name)
165 QString filename = "<b>Fusion with : </b>";
166 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
167 dataFusionnedLabel->setText(filename.toStdString().c_str());
170 void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window, double level)
175 fusionFrame->setEnabled(1);
176 opacityHorizontalSlider->setEnabled(1);
177 opacityHorizontalSlider->setValue(opacity);
178 fusionColorMapComboBox->setEnabled(1);
179 fusionColorMapComboBox->setCurrentIndex(colormap);
180 windowSpinBox->setEnabled(1);
181 levelSpinBox->setEnabled(1);
182 windowSpinBox->setValue(window);
183 levelSpinBox->setValue(level);
188 fusionFrame->setEnabled(0);
189 opacityHorizontalSlider->setEnabled(0);
190 opacityHorizontalSlider->setValue(0);
191 fusionColorMapComboBox->setEnabled(0);
192 fusionColorMapComboBox->setCurrentIndex(-1);
193 windowSpinBox->setEnabled(0);
194 levelSpinBox->setEnabled(0);
198 void vvOverlayPanel::setFusionProperty()
200 emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
201 windowSpinBox->value(), levelSpinBox->value());
204 void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
206 QString fusionValue = "<b>Pixel value in image 2 : </b>";
209 fusionValue += QString::number(value,'f',1);
211 valueFusionnedLabel->setText(fusionValue);
214 #endif /* end #define _vvOverlayPanel_CXX */