Skip to content

Commit 4b0a26b

Browse files
authored
Merge pull request #322 from githubdoe/gr5
Fixed bug in foucault/ronchi view where it was always in AC mode
2 parents 55d8092 + e8d4dc2 commit 4b0a26b

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

RevisionHistory.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<h1>DFTFringe Version History</h1>
1111
<ul>
1212

13+
<li>Version 8.3.2</li>
14+
<ul>
15+
<li>Fixed bug introduced in 8.3.1 in Ronchi Foucault where it was always doing autocollimate mode</li>
16+
</ul>
17+
1318
<li>Version 8.3.1</li>
1419
<ul>
1520
<li>Auto-invert feature (and dialog) only applies to wavefronts created form igram, not those loaded from file, simulated, averaged, subtracted, etc.</li>

foucaultview.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ QVector<QPoint> scaleProfile(QPolygonF points, int width,
171171
}
172172

173173

174-
QImage foucaultView::generateOpticalTestImage(OpticalTestType type, wavefront* wf, const OpticalTestSettings& s)
174+
QImage foucaultView::generateOpticalTestImage(OpticalTestType type, wavefront* wf, const OpticalTestSettings& s, bool bAutoCollimate)
175175
{
176176
if (!wf || wf->data.cols == 0) return QImage();
177177

@@ -200,8 +200,15 @@ QImage foucaultView::generateOpticalTestImage(OpticalTestType type, wavefront* w
200200

201201
SimulationsView *sv = SimulationsView::getInstance(0);
202202
sv->setSurface(wf);
203+
204+
bool oldDoNull = md->doNull;
205+
if (bAutoCollimate == false)
206+
md->doNull = false; // this is normal foucault/ronchi so we *don't* subtract the null (autcoCollimate ronchi or foucault mode will typically subtract the null)
207+
203208
cv::Mat surf_fft = sv->computeStarTest(s.heightMultiply * sv->nulledSurface(effectiveZ3), size, actualPad, true);
209+
204210
wf->InputZerns = originalZerns; // Restore state immediately
211+
md->doNull = oldDoNull;
205212

206213
// 3. Mask Generation
207214
cv::Mat mask = cv::Mat::zeros(size, size, CV_64FC1);
@@ -275,6 +282,7 @@ void foucaultView::on_makePb_clicked()
275282

276283
QApplication::setOverrideCursor(Qt::WaitCursor);
277284

285+
278286
// 1. Pack the current UI state into the settings struct
279287
OpticalTestSettings settings;
280288
settings.rocOffset = ui->rocOffsetSb->value();
@@ -293,8 +301,8 @@ void foucaultView::on_makePb_clicked()
293301
settings.outputLambda = outputLambda;
294302

295303
// 2. Call the refactored static engine for both images
296-
QImage ronchiImg = generateOpticalTestImage(OpticalTestType::Ronchi, m_wf, settings);
297-
QImage foucaultImg = generateOpticalTestImage(OpticalTestType::Foucault, m_wf, settings);
304+
QImage ronchiImg = generateOpticalTestImage(OpticalTestType::Ronchi, m_wf, settings, ui->autocollimation->isChecked());
305+
QImage foucaultImg = generateOpticalTestImage(OpticalTestType::Foucault, m_wf, settings, ui->autocollimation->isChecked());
298306

299307
// Store for potential saving/external access
300308
m_foucaultQimage = foucaultImg;
@@ -402,7 +410,7 @@ void foucaultView::generateBatchRonchiImage(const QList<wavefront*>& wavefrontLi
402410
int row = i / cols;
403411
int col = i % cols;
404412

405-
QImage ronchi = generateOpticalTestImage(OpticalTestType::Ronchi, currentWf, s);
413+
QImage ronchi = generateOpticalTestImage(OpticalTestType::Ronchi, currentWf, s, ui->autocollimation->isChecked());
406414

407415
if (!ronchi.isNull()) {
408416
// Store a copy for the comparison feature

foucaultview.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class foucaultView : public QWidget
5252
bool needsDrawing;
5353

5454
// The Refactored Static Engine - Callable from other classes
55-
static QImage generateOpticalTestImage(OpticalTestType type, wavefront* wf, const OpticalTestSettings& settings);
55+
static QImage generateOpticalTestImage(OpticalTestType type, wavefront* wf, const OpticalTestSettings& settings, bool bAutoCollimate);
5656

5757
public slots:
5858
void on_makePb_clicked();

0 commit comments

Comments
 (0)