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(colorHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setOverlayProperty()));
44 connect(opacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
45 connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
46 connect(windowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
47 connect(levelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
50 void vvOverlayPanel::getCurrentImageName(QString name)
52 QString filename = "<b>Current image : </b>";
53 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
54 currentImageLabel->setText(filename.toStdString().c_str());
57 void vvOverlayPanel::getVFProperty(int subsampling, int scale, int log)
59 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);
76 vFFrame->setEnabled(0);
77 subSamplingSpinBox->setEnabled(0);
78 subSamplingSpinBox->setValue(0);
79 scaleSpinBox->setEnabled(0);
80 scaleSpinBox->setValue(0);
81 lutCheckBox->setEnabled(0);
82 lutCheckBox->setCheckState(Qt::Unchecked);
86 void vvOverlayPanel::getVFName(QString name)
88 QString filename = "<b>Deformation Field : </b>";
89 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
90 vectorFieldNameLabel->setText(filename.toStdString().c_str());
93 void vvOverlayPanel::setVFProperty()
95 emit VFPropertyUpdated(subSamplingSpinBox->value(),
96 scaleSpinBox->value(),
97 lutCheckBox->checkState());
100 void vvOverlayPanel::getCurrentVectorInfo(int visibility, double x,double y,double z, double value)
102 QString motion = "<b>Displacement : </b>";
103 QString motionValue = "<b>Length : </b>";
106 motion += QString::number(x,'f',1) + " ";
107 motion += QString::number(y,'f',1) + " ";
108 motion += QString::number(z,'f',1) + " ";
110 motionValue += QString::number(value,'f',1);
112 coordinatesLabel->setText(motion);
113 normLabel->setText(motionValue);
116 void vvOverlayPanel::getOverlayName(QString name)
118 QString filename = "<b>Compare with : </b>";
119 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
120 imageComparedLabel->setText(filename.toStdString().c_str());
123 void vvOverlayPanel::getOverlayProperty(int value)
127 compareFrame->show();
128 compareFrame->setEnabled(1);
129 colorHorizontalSlider->setEnabled(1);
130 colorHorizontalSlider->setValue(value);
134 compareFrame->hide();
135 compareFrame->setEnabled(0);
136 colorHorizontalSlider->setEnabled(0);
137 colorHorizontalSlider->setValue(0);
141 void vvOverlayPanel::setOverlayProperty()
143 emit OverlayPropertyUpdated(colorHorizontalSlider->value());
146 void vvOverlayPanel::getCurrentOverlayInfo(int visibility,double valueOver, double valueRef)
148 QString refValue = "<b>Pixel value in image 1 : </b>";
149 QString overlayValue = "<b>Pixel value in image 2 : </b>";
150 QString diffValue = "<b>Pixel difference : </b>";
153 refValue += QString::number(valueRef);
154 overlayValue += QString::number(valueOver,'f',1);
155 diffValue += QString::number(valueRef - valueOver,'f',1);
157 refValueLabel->setText(refValue);
158 valueLabel->setText(overlayValue);
159 diffValueLabel->setText(diffValue);
161 void vvOverlayPanel::getFusionName(QString name)
163 QString filename = "<b>Fusion with : </b>";
164 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
165 dataFusionnedLabel->setText(filename.toStdString().c_str());
168 void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window, double level)
173 fusionFrame->setEnabled(1);
174 opacityHorizontalSlider->setEnabled(1);
175 opacityHorizontalSlider->setValue(opacity);
176 fusionColorMapComboBox->setEnabled(1);
177 fusionColorMapComboBox->setCurrentIndex(colormap);
178 windowSpinBox->setEnabled(1);
179 levelSpinBox->setEnabled(1);
180 windowSpinBox->setValue(window);
181 levelSpinBox->setValue(level);
186 fusionFrame->setEnabled(0);
187 opacityHorizontalSlider->setEnabled(0);
188 opacityHorizontalSlider->setValue(0);
189 fusionColorMapComboBox->setEnabled(0);
190 fusionColorMapComboBox->setCurrentIndex(-1);
191 windowSpinBox->setEnabled(0);
192 levelSpinBox->setEnabled(0);
196 void vvOverlayPanel::setFusionProperty()
198 emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
199 windowSpinBox->value(), levelSpinBox->value());
202 void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
204 QString fusionValue = "<b>Pixel value in image 2 : </b>";
207 fusionValue += QString::number(value,'f',1);
209 valueFusionnedLabel->setText(fusionValue);
212 #endif /* end #define _vvOverlayPanel_CXX */