@@ -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" );
0 commit comments