- if ( iViewNumber < m_rProjections.nView() ) {
- m_iLastView = iViewNumber;
- m_pSGP->eraseWindow();
-
- char szProgress [256];
- snprintf (szProgress, sizeof(szProgress), "Reconstructing View %d (%.1f%%)", iViewNumber, 100 * iViewNumber / static_cast<double>(m_rProjections.nView()));
- m_pSGP->setViewport (0, 0, 1, 1);
- m_pSGP->setWindow (0, 0, 1, 1);
- m_pSGP->setTextColor (C_LTRED, -1);
- double dCharHeight = m_pSGP->getCharHeight();
- m_pSGP->setTextSize (dCharHeight * 2);
- m_pSGP->moveAbs(0., m_pSGP->getCharHeight());
- m_pSGP->drawText (szProgress);
- m_pSGP->setTextSize (dCharHeight);
-
- m_pSGP->setViewport (0.0, 0.1, 0.66, 1.);
- m_rReconstructor.reconstructView (iViewNumber, 1, m_pSGP);
-
- ImageFileArrayConst v = m_rImageFile.getArray();
- int xBase = m_nxGraph;
- int yBase = 0;
- if (m_nyGraph > m_nyImage)
- yBase = (m_nyGraph - m_nyImage) / 2;
- double minValue = v[0][0];
- double maxValue = v[0][0];
- for (int ix = 0; ix < m_nxImage; ix++) {
- for (int iy = 0; iy < m_nyImage; iy++) {
- double dPixel = v[ix][iy];
- if (dPixel < minValue)
- minValue = dPixel;
- else if (dPixel > maxValue)
- maxValue = dPixel;
- }
- }
- unsigned char* imageData = new unsigned char [m_nxImage * m_nyImage * 3];
- double dScale = 255 / (maxValue - minValue);
- for (int ix = 0; ix < m_nxImage; ix++) {
- for (int iy = 0; iy < m_nyImage; iy++) {
- double dPixel = v[ix][iy];
- dPixel = (dPixel - minValue) * dScale;
- int intensity = nearest<int>(dPixel);
- intensity = clamp (intensity, 0, 255);
- int baseAddr = ((m_nyImage - 1 - iy) * m_nxImage + ix) * 3;
- imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
+ if ( iViewNumber < m_rProjections.nView() ) {
+ m_iLastView = iViewNumber;
+ ::wxYield(); // update the display
+ m_pSGP->eraseWindow();
+ m_btnPause->Refresh();
+ m_btnStep->Refresh();
+ m_btnAbort->Refresh();
+
+ char szProgress [256];
+ snprintf (szProgress, sizeof(szProgress), "Reconstructing View %d (%.1f%%)", iViewNumber, 100 * iViewNumber / static_cast<double>(m_rProjections.nView()));
+ m_pSGP->setViewport (0, 0, 1, 1);
+ m_pSGP->setWindow (0, 0, 1, 1);
+ m_pSGP->setTextColor (C_LTRED, -1);
+ double dCharHeight = m_pSGP->getCharHeight();
+ m_pSGP->setTextSize (dCharHeight * 2);
+ m_pSGP->moveAbs(0., m_pSGP->getCharHeight());
+ m_pSGP->drawText (szProgress);
+ m_pSGP->setTextSize (dCharHeight);
+
+ m_pSGP->setViewport (0.0, 0.1, 0.66, 1.);
+ m_rReconstructor.reconstructView (iViewNumber, 1, m_pSGP, bBackprojectView);
+
+ ImageFileArrayConst v = m_rImageFile.getArray();
+ int xBase = m_nxGraph;
+ int yBase = 0;
+ if (m_nyGraph > m_nyImage)
+ yBase = (m_nyGraph - m_nyImage) / 2;
+ double minValue = v[0][0];
+ double maxValue = v[0][0];
+ for (int ix = 0; ix < m_nxImage; ix++) {
+ for (int iy = 0; iy < m_nyImage; iy++) {
+ double dPixel = v[ix][iy];
+ if (dPixel < minValue)
+ minValue = dPixel;
+ else if (dPixel > maxValue)
+ maxValue = dPixel;
+ }
+ }
+ unsigned char* imageData = new unsigned char [m_nxImage * m_nyImage * 3];
+ double dScale = 255 / (maxValue - minValue);
+ for (int ix2 = 0; ix2 < m_nxImage; ix2++) {
+ for (int iy = 0; iy < m_nyImage; iy++) {
+ double dPixel = v[ix2][iy];
+ dPixel = (dPixel - minValue) * dScale;
+ int intensity = nearest<int>(dPixel);
+ intensity = clamp (intensity, 0, 255);
+ int baseAddr = ((m_nyImage - 1 - iy) * m_nxImage + ix2) * 3;
+ imageData[baseAddr] = imageData[baseAddr+1] = imageData[baseAddr+2] = intensity;
+ }
+ }
+ wxImage image (m_nxImage, m_nyImage, imageData, true);
+ wxBitmap bitmap = image.ConvertToBitmap();
+ m_pSGP->getDriver().idWX()->DrawBitmap(bitmap, xBase, yBase, false);
+ delete imageData;