Skip to content

Commit 89004dc

Browse files
author
Tommaso Vinci
committed
Visar: ghost fringe remove tool
1 parent a30e55a commit 89004dc

4 files changed

Lines changed: 32 additions & 15 deletions

File tree

plugins/Image_list/Image_list.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Image_list::updatePad(nPhysD *my_phys) {
323323
if (phys) {
324324
QTreeWidgetItem* it2=itemsMap[phys];
325325
if (it2) {
326-
QString mynum=QString::number(k);
326+
QString mynum=QString::number(k).rightJustified(1+log10(nparent->getBufferList().size()), ' ');;
327327
if (mynum!=it2->data(0,Qt::DisplayRole).toString()) {
328328
it2->setData(0,0,mynum);
329329
}

plugins/Visar/Visar.cc

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ void Visar::addVisar() {
273273
intensity[numVisars][m].setShortName("intensity");
274274
}
275275

276+
276277
QApplication::processEvents();
277278

278279
sweepCoeff.push_back(std::vector<double>());
@@ -309,6 +310,7 @@ void Visar::addVisar() {
309310
connect(my_mask, SIGNAL(sceneChanged()), this, SLOT(needWave()));
310311

311312
maskRegion.push_back(my_mask);
313+
ghostPhys.push_back(nullptr);
312314

313315
velocity.push_back(QVector<double>());
314316
velError.push_back(QVector<double>());
@@ -432,6 +434,9 @@ void Visar::delVisar() {
432434
cContrast[m].pop_back();
433435
}
434436

437+
if (ghostPhys.back()) delete ghostPhys.back();
438+
ghostPhys.pop_back();
439+
435440
QList<QCPAbstractPlottable *> listplottable;
436441
for (int kk=0; kk< plotVelocity->plottableCount() ; kk++) {
437442
QVariant id=plotVelocity->plottable(kk)->property("id");
@@ -642,7 +647,7 @@ void Visar::setObjectVisibility(nPhysD*phys) {
642647
bool ismyimg = (phys == getPhysFromCombo(settingsUi[k]->shotImage) || phys == getPhysFromCombo(settingsUi[k]->refImage));
643648
fringeLine[k]->setVisible(ismyimg);
644649
fringeRect[k]->setVisible(ismyimg);
645-
maskRegion[k]->setVisible(settingsUi[k]->DeghostCheck->isChecked() && ismyimg);
650+
maskRegion[k]->setVisible(settingsUi[k]->DeghostCheck->isChecked() && (ismyimg || phys == ghostPhys[k]));
646651
}
647652
sopRect->setVisible(enableSOP->isChecked() && (phys == getPhysFromCombo(sopRef) || phys == getPhysFromCombo(sopShot)));
648653
}
@@ -1109,18 +1114,17 @@ void Visar::doWave(unsigned int k) {
11091114
for (size_t i=0;i<dy;i++)
11101115
yy[i]=(i+(dy+1)/2)%dy-(dy+1)/2;
11111116

1112-
nPhysD* physDeghost=nullptr;
1117+
double cr = cos((settingsUi[k]->angle->value()) * _phys_deg);
1118+
double sr = sin((settingsUi[k]->angle->value()) * _phys_deg);
11131119

1114-
if (settingsUi[k]->DeghostCheck->isChecked()) {
1120+
nPhysD* physDeghost=nullptr;
11151121

1122+
if (settingsUi[k]->DeghostCheck->checkState()>0) {
11161123

11171124
physC imageFFT = imgs[1]->ft2(PHYS_FORWARD);
11181125

11191126
progress.setValue(progress.value()+1);
11201127

1121-
double cr = cos((settingsUi[k]->angle->value()) * _phys_deg);
1122-
double sr = sin((settingsUi[k]->angle->value()) * _phys_deg);
1123-
11241128
double lambda=sqrt(pow(cr*dx,2)+pow(sr*dy,2))/(M_PI*settingsUi[k]->interfringe->value());
11251129

11261130
for (size_t x=0;x<dx;x++) {
@@ -1138,7 +1142,7 @@ void Visar::doWave(unsigned int k) {
11381142

11391143
progress.setValue(progress.value()+1);
11401144

1141-
physDeghost=new nPhysD(*imgs[1],"deghost");
1145+
physDeghost=new nPhysD(*imgs[1],"deghost VISAR "+std::to_string(tabPhase->currentIndex()+1));
11421146

11431147
QRect geom=maskRegion[k]->path().boundingRect().toRect();
11441148

@@ -1158,7 +1162,6 @@ void Visar::doWave(unsigned int k) {
11581162
}
11591163
}
11601164
progress.setValue(progress.value()+1);
1161-
11621165
physDeghost->TscanBrightness();
11631166
imgs[1]=physDeghost;
11641167
}
@@ -1191,8 +1194,6 @@ void Visar::doWave(unsigned int k) {
11911194

11921195
progress.setValue(progress.value()+1);
11931196
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
1194-
double cr = cos((settingsUi[k]->angle->value()) * _phys_deg);
1195-
double sr = sin((settingsUi[k]->angle->value()) * _phys_deg);
11961197
double thick_norm=settingsUi[k]->resolution->value()*M_PI/sqrt(pow(sr*dx,2)+pow(cr*dy,2));
11971198
const double damp_norm=M_PI;
11981199

@@ -1270,8 +1271,17 @@ void Visar::doWave(unsigned int k) {
12701271

12711272
settingsUi[k]->doWaveButton->setIcon(QIcon(":icons/refresh.png"));
12721273

1273-
if (physDeghost) {
1274-
delete physDeghost;
1274+
if (physDeghost){
1275+
qDebug() << settingsUi[k]->DeghostCheck->checkState();
1276+
qDebug() << physDeghost->getSize().x() << physDeghost->getSize().y();
1277+
if (settingsUi[k]->DeghostCheck->checkState()==1) {
1278+
ghostPhys[k]=nparent->replacePhys(physDeghost,ghostPhys[k],false);
1279+
} else if (settingsUi[k]->DeghostCheck->checkState()==2) {
1280+
qDebug() << nPhysExists(physDeghost) << ghostPhys[k];
1281+
delete physDeghost;
1282+
// ghostPhys[k]=nullptr;
1283+
nparent->removePhys(ghostPhys[k]);
1284+
}
12751285
}
12761286

12771287
} else {
@@ -1473,10 +1483,10 @@ Visar::export_txt() {
14731483
QString title=tr("Export ");
14741484
switch (tabs->currentIndex()) {
14751485
case 0:
1476-
title=tr("VISAR")+QString(" ")+QLocale().toString(tabPhase->currentIndex()+1);
1486+
title=tr("VISAR ")+QLocale().toString(tabPhase->currentIndex()+1);
14771487
break;
14781488
case 1:
1479-
title=tr("VISAR")+QString(" ")+QLocale().toString(tabVelocity->currentIndex()+1);
1489+
title=tr("VISAR ")+QLocale().toString(tabVelocity->currentIndex()+1);
14801490
break;
14811491
case 2:
14821492
title=tr("SOP");

plugins/Visar/Visar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class Visar : public nGenericPan, private Ui::Visar {
116116
std::vector<nLine*> fringeLine;
117117
std::vector<nRect*> fringeRect;
118118
QPointer<nRect> sopRect;
119+
std::vector<nPhysD*> ghostPhys;
119120

120121
public slots:
121122

plugins/Visar/VisarSettings.ui

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,15 @@
247247
</item>
248248
<item row="0" column="3">
249249
<widget class="QCheckBox" name="DeghostCheck">
250+
<property name="toolTip">
251+
<string>Completely checked to remove ghost fringes. Partially checked box will show the image.</string>
252+
</property>
250253
<property name="text">
251254
<string>Deghost</string>
252255
</property>
256+
<property name="tristate">
257+
<bool>true</bool>
258+
</property>
253259
<property name="neutrinoSave" stdset="0">
254260
<bool>true</bool>
255261
</property>

0 commit comments

Comments
 (0)