1 #ifndef _vvOverlayPanel_CXX
2 #define _vvOverlayPanel_CXX
4 /*=========================================================================
7 Module: $RCSfile: vvOverlayPanel.cxx,v $
9 Date: $Date: 2010/01/06 13:31:57 $
10 Version: $Revision: 1.1 $
11 Author : Pierre Seroul (pierre.seroul@gmail.com)
13 Copyright (C) 200COLUMN_IMAGE_NAME
14 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
15 CREATIS-LRMN http://www.creatis.insa-lyon.fr
17 This program is free software: you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation, version 3 of the License.
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program. If not, see <http://www.gnu.org/licenses/>.
29 =========================================================================*/
31 #include "vvOverlayPanel.h"
35 #include "QTreePushButton.h"
37 #include <vtksys/SystemTools.hxx>
39 //====================================================================
40 vvOverlayPanel::vvOverlayPanel(QWidget * parent):QWidget(parent)
47 subSamplingSpinBox->setEnabled(0);
48 scaleSpinBox->setEnabled(0);
50 lutCheckBox->setEnabled(0);
51 connect(subSamplingSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
52 connect(scaleSpinBox,SIGNAL(editingFinished()),this,SLOT(setVFProperty()));
53 connect(lutCheckBox,SIGNAL(clicked()),this,SLOT(setVFProperty()));
54 connect(colorHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setOverlayProperty()));
55 connect(opacityHorizontalSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionProperty()));
56 connect(fusionColorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(setFusionProperty()));
57 connect(windowSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
58 connect(levelSpinBox,SIGNAL(valueChanged(double)),this,SLOT(setFusionProperty()));
61 void vvOverlayPanel::getCurrentImageName(QString name)
63 QString filename = "<b>Current image : </b>";
64 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
65 currentImageLabel->setText(filename.toStdString().c_str());
68 void vvOverlayPanel::getVFProperty(int subsampling, int scale, int log)
70 if (subsampling != -1)
73 vFFrame->setEnabled(1);
74 subSamplingSpinBox->setEnabled(1);
75 subSamplingSpinBox->setValue(subsampling);
76 scaleSpinBox->setEnabled(1);
77 scaleSpinBox->setValue(scale);
78 lutCheckBox->setEnabled(1);
80 lutCheckBox->setCheckState(Qt::Checked);
82 lutCheckBox->setCheckState(Qt::Unchecked);
87 vFFrame->setEnabled(0);
88 subSamplingSpinBox->setEnabled(0);
89 subSamplingSpinBox->setValue(0);
90 scaleSpinBox->setEnabled(0);
91 scaleSpinBox->setValue(0);
92 lutCheckBox->setEnabled(0);
93 lutCheckBox->setCheckState(Qt::Unchecked);
97 void vvOverlayPanel::getVFName(QString name)
99 QString filename = "<b>Deformation Field : </b>";
100 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
101 vectorFieldNameLabel->setText(filename.toStdString().c_str());
104 void vvOverlayPanel::setVFProperty()
106 emit VFPropertyUpdated(subSamplingSpinBox->value(),
107 scaleSpinBox->value(),
108 lutCheckBox->checkState());
111 void vvOverlayPanel::getCurrentVectorInfo(int visibility, double x,double y,double z, double value)
113 QString motion = "<b>Displacement : </b>";
114 QString motionValue = "<b>Length : </b>";
117 motion += QString::number(x,'f',1) + " ";
118 motion += QString::number(y,'f',1) + " ";
119 motion += QString::number(z,'f',1) + " ";
121 motionValue += QString::number(value,'f',1);
123 coordinatesLabel->setText(motion);
124 normLabel->setText(motionValue);
127 void vvOverlayPanel::getOverlayName(QString name)
129 QString filename = "<b>Compare with : </b>";
130 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
131 imageComparedLabel->setText(filename.toStdString().c_str());
134 void vvOverlayPanel::getOverlayProperty(int value)
138 compareFrame->show();
139 compareFrame->setEnabled(1);
140 colorHorizontalSlider->setEnabled(1);
141 colorHorizontalSlider->setValue(value);
145 compareFrame->hide();
146 compareFrame->setEnabled(0);
147 colorHorizontalSlider->setEnabled(0);
148 colorHorizontalSlider->setValue(0);
152 void vvOverlayPanel::setOverlayProperty()
154 emit OverlayPropertyUpdated(colorHorizontalSlider->value());
157 void vvOverlayPanel::getCurrentOverlayInfo(int visibility,double valueOver, double valueRef)
159 QString refValue = "<b>Pixel value in image 1 : </b>";
160 QString overlayValue = "<b>Pixel value in image 2 : </b>";
161 QString diffValue = "<b>Pixel difference : </b>";
164 refValue += QString::number(valueRef);
165 overlayValue += QString::number(valueOver,'f',1);
166 diffValue += QString::number(valueRef - valueOver,'f',1);
168 refValueLabel->setText(refValue);
169 valueLabel->setText(overlayValue);
170 diffValueLabel->setText(diffValue);
172 void vvOverlayPanel::getFusionName(QString name)
174 QString filename = "<b>Fusion with : </b>";
175 filename += vtksys::SystemTools::GetFilenameWithoutExtension(name.toStdString()).c_str();
176 dataFusionnedLabel->setText(filename.toStdString().c_str());
179 void vvOverlayPanel::getFusionProperty(int opacity, int colormap, double window, double level)
184 fusionFrame->setEnabled(1);
185 opacityHorizontalSlider->setEnabled(1);
186 opacityHorizontalSlider->setValue(opacity);
187 fusionColorMapComboBox->setEnabled(1);
188 fusionColorMapComboBox->setCurrentIndex(colormap);
189 windowSpinBox->setEnabled(1);
190 levelSpinBox->setEnabled(1);
191 windowSpinBox->setValue(window);
192 levelSpinBox->setValue(level);
197 fusionFrame->setEnabled(0);
198 opacityHorizontalSlider->setEnabled(0);
199 opacityHorizontalSlider->setValue(0);
200 fusionColorMapComboBox->setEnabled(0);
201 fusionColorMapComboBox->setCurrentIndex(-1);
202 windowSpinBox->setEnabled(0);
203 levelSpinBox->setEnabled(0);
207 void vvOverlayPanel::setFusionProperty()
209 emit FusionPropertyUpdated(opacityHorizontalSlider->value(), fusionColorMapComboBox->currentIndex(),
210 windowSpinBox->value(), levelSpinBox->value());
213 void vvOverlayPanel::getCurrentFusionInfo(int visibility,double value)
215 QString fusionValue = "<b>Pixel value in image 2 : </b>";
218 fusionValue += QString::number(value,'f',1);
220 valueFusionnedLabel->setText(fusionValue);
223 #endif /* end #define _vvOverlayPanel_CXX */