REIXSXESMCPDetectorPre2013::REIXSXESMCPDetectorPre2013(const QString& name, const QString& basePVName, QObject *parent) : QObject(parent) { name_ = name; description_ = "XES Imaging Detector"; basePVName_ = basePVName; totalCountsPV_ = new AMProcessVariable(basePVName_+":totalCounts", true, this); countsPerSecondPV_ = new AMProcessVariable(basePVName_+":countsPerSecond", true, this); imagePV_ = new AMProcessVariable(basePVName_+":image", true, this); instantaneousImagePV_ = new AMProcessVariable(basePVName_+":instantaneousImage", true, this); resolutionXPV_ = new AMProcessVariable(basePVName_+":resolutionX", true, this); resolutionYPV_ = new AMProcessVariable(basePVName_+":resolutionY", true, this); clearPV_ = new AMProcessVariable(basePVName_+":clear", true, this); orientationControl_ = new AMPVControl("mcpOrientation", basePVName_+":orientation", basePVName_+":orientation", QString(), this, 0.1); averagingPeriodSecsControl_ = new AMPVControl("mcpAveragingPeriod", basePVName_+":averagingPeriodSecs", basePVName_+":averagingPeriodSecs", QString(), this, 0.1); persistTimeSecsControl_ = new AMPVControl("mcpPersistDuration", basePVName_+":persistTimeSecs", basePVName_+":persistTimeSecs", QString(), this, 0.1); image_ = new REIXSXESMCPDataSourcePre2013("xesImage", imagePV_, resolutionXPV_, resolutionYPV_, this); image_->setDescription("Accumulated Detector Image"); instantaneousImage_ = new REIXSXESMCPDataSourcePre2013("xesRealtimeImage", instantaneousImagePV_, resolutionXPV_, resolutionYPV_, this); instantaneousImage_->setDescription("Instantaneous Detector Image"); connect(totalCountsPV_, SIGNAL(valueChanged(double)), this, SIGNAL(totalCountsChanged(double))); connect(countsPerSecondPV_, SIGNAL(valueChanged(double)), this, SIGNAL(countsPerSecondChanged(double))); connect(imagePV_, SIGNAL(valueChanged()), this, SIGNAL(imageDataChanged())); connect(instantaneousImagePV_, SIGNAL(valueChanged()), this, SIGNAL(instantaneousImageDataChanged())); }
void REIXSXESScanController::onScanFinished() { scanProgressTimer_.stop(); disconnect(&scanProgressTimer_, SIGNAL(timeout()), this, SLOT(onScanProgressCheck())); disconnect(REIXSBeamline::bl()->mcpDetector(), SIGNAL(imageDataChanged()), this, SLOT(onNewImageValues())); saveRawData(); setFinished(); }
REIXSXESMCPDetector::REIXSXESMCPDetector(QObject *parent) : AMDetector("XESMCPDetector", "REIXS XES MCP Detector", parent) { dwellTime_ = -1; totalCountTarget_ = -1; finishedConditions_ = REIXSXESMCPDetector::FinishedTotalTime; clearOnStart_ = true; dwellTimeTimer_ = 0; //NULL basePVName_ = "CPD1610-01"; totalCountsControl_ = new AMReadOnlyPVControl("MCPTotalCounts", QString("%1:totalCounts").arg(basePVName_), this); countsPerSecondControl_ = new AMReadOnlyPVControl("MCPCountsPerSecond", QString("%1:countsPerSecond").arg(basePVName_), this); imageControl_ = new AMReadOnlyPVControl("MCPImage", QString("%1:image").arg(basePVName_), this); instantaneousImageControl_ = new AMReadOnlyPVControl("MCPInstantaneousImage", QString("%1:instantaneousImage").arg(basePVName_), this); resolutionXControl_ = new AMReadOnlyPVControl("MCPXResolution", QString("%1:resolutionX").arg(basePVName_), this); resolutionYControl_ = new AMReadOnlyPVControl("MCPYResolution", QString("%1:resolutionY").arg(basePVName_), this); clearControl_ = new AMSinglePVControl("MCPClear", QString("%1:clear").arg(basePVName_), this, 0.5); averagingPeriodSecsControl_ = new AMSinglePVControl("mcpAveragingPeriod", QString("%1:averagingPeriodSecs").arg(basePVName_), this, 0.1); persistTimeSecsControl_ = new AMSinglePVControl("mcpPersistDuration", QString("%1:persistTimeSecs").arg(basePVName_), this, 0.1); image_ = new REIXSXESMCPDataSource("xesImage", imageControl_, resolutionXControl_, resolutionYControl_, this); image_->setDescription("Accumulated Detector Image"); instantaneousImage_ = new REIXSXESMCPDataSource("xesRealtimeImage", instantaneousImageControl_, resolutionXControl_, resolutionYControl_, this); instantaneousImage_->setDescription("Instantaneous Detector Image"); vetoControl_ = new AMSinglePVControl("Veto", "PDTR1610-4-I21-01:OprVeto", this, 0.5); vetoStateControl_ = new AMReadOnlyPVControl("VetoState", "PDTR1610-4-I21-01:Veto:state", this); allControls_ = new AMControlSet(this); allControls_->addControl(totalCountsControl_); allControls_->addControl(countsPerSecondControl_); allControls_->addControl(imageControl_); allControls_->addControl(instantaneousImageControl_); allControls_->addControl(resolutionXControl_); allControls_->addControl(resolutionYControl_); allControls_->addControl(clearControl_); allControls_->addControl(averagingPeriodSecsControl_); allControls_->addControl(persistTimeSecsControl_); allControls_->addControl(vetoControl_); allControls_->addControl(vetoStateControl_); triggerSource_ = new AMDetectorTriggerSource(QString("REIXSXESMCPTriggerSource"), this); dwellTimeSource_ = new AMDetectorDwellTimeSource(QString("REIXSXESMCPDwellTimeSource"), this); connect(triggerSource_, SIGNAL(triggered(AMDetectorDefinitions::ReadMode)), this, SLOT(onTriggerSourceTriggered(AMDetectorDefinitions::ReadMode))); connect(dwellTimeSource_, SIGNAL(setDwellTime(double)), this, SLOT(onDwellTimeSourceSetDwellTime(double))); connect(allControls_, SIGNAL(connected(bool)), this, SLOT(onControlsConnected(bool))); connect(allControls_, SIGNAL(controlConnectedChanged(bool,AMControl*)), this, SLOT(onControlsTimedOut())); connect(imageControl_->readPV(), SIGNAL(valueChanged()), this, SIGNAL(imageDataChanged())); connect(instantaneousImageControl_->readPV(), SIGNAL(valueChanged()), this, SIGNAL(instantaneousImageDataChanged())); connect(countsPerSecondControl_, SIGNAL(valueChanged(double)), this, SIGNAL(countsPerSecondChanged(double))); connect(totalCountsControl_, SIGNAL(valueChanged(double)), this, SIGNAL(totalCountsChanged(double))); }
/// Cancel scan if currently running or paused void REIXSXESScanController::cancelImplementation() { ScanState currentState = state(); if(currentState == Running || currentState == Paused) { scanProgressTimer_.stop(); disconnect(&scanProgressTimer_, SIGNAL(timeout()), this, SLOT(onScanProgressCheck())); disconnect(REIXSBeamline::bl()->mcpDetector(), SIGNAL(imageDataChanged()), this, SLOT(onNewImageValues())); } setCancelled(); }
void VolumeRenderWidget::updateVolumeRendering() { if (m_volume) m_renderer->RemoveVolume(m_volume); if (!m_imageData->image) return; m_volumeMapper = vtkSmartPointer<vtkSmartVolumeMapper>::New(); m_volume = vtkSmartPointer<vtkVolume>::New(); auto volumeProperty = m_settingsWidget->getVolumeProperty(); auto spacing = m_imageData->image->GetSpacing(); double meanSpacing = (spacing[0]+spacing[1]+spacing[2]) / 3.0; double minSpacing = std::min(std::min(spacing[0], spacing[1]), spacing[2]); volumeProperty->SetScalarOpacityUnitDistance(meanSpacing); m_volumeMapper->SetInteractiveUpdateRate(0.00001); m_volumeMapper->SetSampleDistance(minSpacing*0.39); m_volumeMapper->CroppingOn(); int *extent = m_imageData->image->GetExtent(); setCropPlanes(extent); if (m_renderMode == 0) m_volumeMapper->SetRequestedRenderModeToRayCast(); else if (m_renderMode == 1) m_volumeMapper->SetRequestedRenderModeToGPU(); m_volumeMapper->SetBlendModeToComposite(); m_volumeMapper->SetInputData(m_imageData->image); m_volumeMapper->Update(); emit imageDataChanged(m_imageData); m_volume->SetProperty(volumeProperty); m_volume->SetMapper(m_volumeMapper); m_volume->Update(); updateVolumeProps(); m_renderer->AddViewProp(m_volume); m_renderer->ResetCamera(); updateRendering(); }
bool REIXSXESScanController::startImplementation() { if(!config_->doNotClearExistingCounts()) { REIXSBeamline::bl()->mcpDetector()->clear(); } connect(REIXSBeamline::bl()->mcpDetector(), SIGNAL(imageDataChanged()), this, SLOT(onNewImageValues())); connect(&scanProgressTimer_, SIGNAL(timeout()), this, SLOT(onScanProgressCheck())); startTime_ = QDateTime::currentDateTime(); scanProgressTimer_.start(1000); setStarted(); return true; }