1 #ifndef _vvOverlayPanel_CXX
2 #define _vvOverlayPanel_CXX
4 /*=========================================================================
8 Author : Pierre Seroul (pierre.seroul@gmail.com)
10 Copyright (C) 200COLUMN_IMAGE_NAME
11 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
12 CREATIS-LRMN http://www.creatis.insa-lyon.fr
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, version 3 of the License.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 =========================================================================*/
28 #include "vvOverlayPanel.h"
32 #include "QTreePushButton.h"
34 #include <vtksys/SystemTools.hxx>
36 //====================================================================
37 vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent)
44 subSamplingSpinBox->setEnabled(0);
45 scaleSpinBox->setEnabled(0);
47 lutCheckBox->setEnabled(0);
48 connect(subSamplingSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
49 connect(scaleSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
50 connect(lutCheckBox,SIGNAL(clicked()),this,SLOT(setVFProperty()));
51 connect(colorHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setOverlayProperty()));
52 connect(opacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
53 connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
54 connect(windowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
55 connect(levelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
58 void vvOverlayPanel::getCurrentImageName(QString name)
60 QString filename = "<b>Current image : </b>";
61 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
62 currentImageLabel->setText(filename.toStdString().c_str());
65 void vvOverlayPanel::getVFProperty(int subsampling, int scale, int log)
67 if (subsampling != -1)
70 vFFrame->setEnabled(1);
71 subSamplingSpinBox->setEnabled(1);
72 subSamplingSpinBox->setValue(subsampling);
73 scaleSpinBox->setEnabled(1);
74 scaleSpinBox->setValue(scale);
75 lutCheckBox->setEnabled(1);
77 lutCheckBox->setCheckState(Qt::Checked);
79 lutCheckBox->setCheckState(Qt::Unchecked);
84 vFFrame->setEnabled(0);
85 subSamplingSpinBox->setEnabled(0);
86 subSamplingSpinBox->setValue(0);
87 scaleSpinBox->setEnabled(0);
88 scaleSpinBox->setValue(0);
89 lutCheckBox->setEnabled(0);
90 lutCheckBox->setCheckState(Qt::Unchecked);
94 void vvOverlayPanel::getVFName(QString name)
96 QString filename = "<b>Deformation Field : </b>";
97 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
98 vectorFieldNameLabel->setText(filename.toStdString().c_str());
101 void vvOverlayPanel::setVFProperty()
103 emit VFPropertyUpdated(subSamplingSpinBox->value(),
104 scaleSpinBox->value(),
105 lutCheckBox->checkState());
108 void vvOverlayPanel::getCurrentVectorInfo(int visibility, double x,double y,double z, double value)
110 QString motion = "<b>Displacement : </b>";
111 QString motionValue = "<b>Length : </b>";
114 motion += QString::number(x,'f',1) + " ";
115 motion += QString::number(y,'f',1) + " ";
116 motion += QString::number(z,'f',1) + " ";
118 motionValue += QString::number(value,'f',1);
120 coordinatesLabel->setText(motion);
121 normLabel->setText(motionValue);
124 void vvOverlayPanel::getOverlayName(QString name)
126 QString filename = "<b>Compare with : </b>";
127 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
128 imageComparedLabel->setText(filename.toStdString().c_str());
131 void vvOverlayPanel::getOverlayProperty(int value)
135 compareFrame->show();
136 compareFrame->setEnabled(1);
137 colorHorizontalSlider->setEnabled(1);
138 colorHorizontalSlider->setValue(value);
142 compareFrame->hide();
143 compareFrame->setEnabled(0);
144 colorHorizontalSlider->setEnabled(0);
145 colorHorizontalSlider->setValue(0);
149 void vvOverlayPanel::setOverlayProperty()
151 emit OverlayPropertyUpdated(colorHorizontalSlider->value());
154 void vvOverlayPanel::getCurrentOverlayInfo(int visibility,double valueOver, double valueRef)
156 QString refValue = "<b>Pixel value in image 1 : </b>";
157 QString overlayValue = "<b>Pixel value in image 2 : </b>";
158 QString diffValue = "<b>Pixel difference : </b>";
161 refValue += QString::number(valueRef);
162 overlayValue += QString::number(valueOver,'f',1);
163 diffValue += QString::number(valueRef - valueOver,'f',1);
165 refValueLabel->setText(refValue);
166 valueLabel->setText(overlayValue);
167 diffValueLabel->setText(diffValue);
169 void vvOverlayPanel::getFusionName(QString name)
171 QString filename = "<b>Fusion with : </b>";
172 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
173 dataFusionnedLabel->setText(filename.toStdString().c_str());
176 void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window, double level)
181 fusionFrame->setEnabled(1);
182 opacityHorizontalSlider->setEnabled(1);
183 opacityHorizontalSlider->setValue(opacity);
184 fusionColorMapComboBox->setEnabled(1);
185 fusionColorMapComboBox->setCurrentIndex(colormap);
186 windowSpinBox->setEnabled(1);
187 levelSpinBox->setEnabled(1);
188 windowSpinBox->setValue(window);
189 levelSpinBox->setValue(level);
194 fusionFrame->setEnabled(0);
195 opacityHorizontalSlider->setEnabled(0);
196 opacityHorizontalSlider->setValue(0);
197 fusionColorMapComboBox->setEnabled(0);
198 fusionColorMapComboBox->setCurrentIndex(-1);
199 windowSpinBox->setEnabled(0);
200 levelSpinBox->setEnabled(0);
204 void vvOverlayPanel::setFusionProperty()
206 emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
207 windowSpinBox->value(), levelSpinBox->value());
210 void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
212 QString fusionValue = "<b>Pixel value in image 2 : </b>";
215 fusionValue += QString::number(value,'f',1);
217 valueFusionnedLabel->setText(fusionValue);
220 #endif /* end #define _vvOverlayPanel_CXX */