int MCL_NanoDrive_XYStage::SetOrigin() { int err; // calculate new lower & upper limits xMin_ = xMin_ - curXpos_; xMax_ = xMax_ - curXpos_; yMin_ = yMin_ - curYpos_; yMax_ = yMax_ - curYpos_; // new position is 0, 0 curXpos_ = 0; curYpos_ = 0; // make sure to set the limits for the property browser err = SetPropertyLimits(g_Keyword_SetPosXUm, xMin_, xMax_); if (err != DEVICE_OK) return err; err = SetPropertyLimits(g_Keyword_SetPosYUm, yMin_, yMax_); if (err != DEVICE_OK) return err; err = UpdateStatus(); if (err != DEVICE_OK) return err; return DEVICE_OK; }
int Mightex_Sirius_SLC_USB::OnSetImax(MM::PropertyBase* pProp, MM::ActionType eAct) { long temp; if (eAct == MM::BeforeGet) { temp = ledChannelData.Normal_CurrentMax; pProp->Set(temp); } else if (eAct == MM::AfterSet) { pProp->Get(temp); int temp_data = ledChannelData.Normal_CurrentMax; ledChannelData.Normal_CurrentMax = temp; if(ledChannelData.Normal_CurrentSet > ledChannelData.Normal_CurrentMax) ledChannelData.Normal_CurrentSet = ledChannelData.Normal_CurrentMax; if(devHandle >= 0) { if(MTUSB_LEDDriverSetNormalPara(devHandle, m_channel, &ledChannelData) != 0) ledChannelData.Normal_CurrentMax = temp_data; MTUSB_LEDDriverSetNormalCurrent(devHandle, m_channel, ledChannelData.Normal_CurrentSet); } SetPropertyLimits("normal_CurrentSet", 0, ledChannelData.Normal_CurrentMax); SetPropertyLimits("i1", 0, ledChannelData.Normal_CurrentMax); SetPropertyLimits("i2", 0, ledChannelData.Normal_CurrentMax); } return DEVICE_OK; }
void CGigECamera::UpdateExposureRange() { if( nodes->isAvailable( EXPOSURE_TIME ) ) { double low, high; high = nodes->getMax( EXPOSURE_TIME ) / 1000.0; // us to ms low = nodes->getMin( EXPOSURE_TIME ) / 1000.0; // us to ms SetPropertyLimits( MM::g_Keyword_Exposure, low, high ); OnPropertiesChanged(); } else if( nodes->isAvailable( EXPOSURE_TIME_ABS ) ) { double low, high; high = nodes->getMax( EXPOSURE_TIME_ABS ) / 1000.0; // us to ms low = nodes->getMin( EXPOSURE_TIME_ABS ) / 1000.0; // us to ms SetPropertyLimits( MM::g_Keyword_Exposure, low, high ); OnPropertiesChanged(); } else if( nodes->isAvailable( EXPOSURE_TIME_ABS_INT ) ) { double low, high; high = nodes->getMax( EXPOSURE_TIME_ABS_INT ) / 1000.0; // us to ms low = nodes->getMin( EXPOSURE_TIME_ABS_INT ) / 1000.0; // us to ms SetPropertyLimits( MM::g_Keyword_Exposure, low, high ); OnPropertiesChanged(); } }
int VTiSIMScanner::Initialize() { int err = CreateStringProperty(g_PropName_Scanning, g_PropVal_Off, false, new CPropertyAction(this, &VTiSIMScanner::OnStartStop)); if (err != DEVICE_OK) return err; err = AddAllowedValue(g_PropName_Scanning, g_PropVal_Off); if (err != DEVICE_OK) return err; err = AddAllowedValue(g_PropName_Scanning, g_PropVal_On); if (err != DEVICE_OK) return err; DWORD vterr = vti_GetScanRateRange(VTiHub()->GetScanAndMotorHandle(), &minRate_, &maxRate_); if (vterr != VTI_SUCCESS) return vterr; if (scanRate_ < minRate_) scanRate_ = minRate_; if (scanRate_ > maxRate_) scanRate_ = maxRate_; err = CreateIntegerProperty(g_PropName_ScanRate, scanRate_, false, new CPropertyAction(this, &VTiSIMScanner::OnScanRate)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(g_PropName_ScanRate, minRate_, maxRate_); if (err != DEVICE_OK) return err; vterr = vti_GetScanWidthRange(VTiHub()->GetScanAndMotorHandle(), &minWidth_, &maxWidth_); if (vterr != VTI_SUCCESS) return vterr; if (scanWidth_ < minWidth_) scanWidth_ = minWidth_; if (scanWidth_ > maxWidth_) scanWidth_ = maxWidth_; err = CreateIntegerProperty(g_PropName_ScanWidth, scanWidth_, false, new CPropertyAction(this, &VTiSIMScanner::OnScanWidth)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(g_PropName_ScanWidth, minWidth_, maxWidth_); if (err != DEVICE_OK) return err; err = CreateFloatProperty(g_PropName_ActualRate, actualRate_, true, new CPropertyAction(this, &VTiSIMScanner::OnActualScanRate)); if (err != DEVICE_OK) return err; err = CreateIntegerProperty(g_PropName_ScanOffset, scanOffset_, false, new CPropertyAction(this, &VTiSIMScanner::OnScanOffset)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(g_PropName_ScanOffset, 0, GetMaxOffset()); if (err != DEVICE_OK) return err; return DoStartStopScan(false); }
//Tells micromanager the step size, top speed and acceleration. //Speed and acceleration ranges does not refer to a meaningful unit but //the range that the hardware uses. int XYStage::Initialize() { // Step size CPropertyAction* pAct = new CPropertyAction (this, &XYStage::OnStepSizeX); CreateProperty("StepSizeX_um", "0.1", MM::Float, true, pAct); pAct = new CPropertyAction (this, &XYStage::OnStepSizeY); CreateProperty("StepSizeY_um", "0.1", MM::Float, true, pAct); // Max Speed pAct = new CPropertyAction (this, &XYStage::OnMaxSpeed); CreateProperty("MaxSpeed", "30000", MM::Integer, false, pAct); SetPropertyLimits("MaxSpeed", 1000, 50000); // Acceleration pAct = new CPropertyAction (this, &XYStage::OnAcceleration); CreateProperty("Acceleration", "500", MM::Integer, false, pAct); SetPropertyLimits("Acceleration", 1, 1000); int ret = UpdateStatus(); if (ret != DEVICE_OK) return ret; initialized_ = true; return DEVICE_OK; }
int ZStage::Initialize() { if(!g_device_connected) return DEVICE_NOT_CONNECTED; if(_init) return DEVICE_OK; // Name and description CreateProperty(MM::g_Keyword_Name, g_devlist[MoticZ][0], MM::String, true); CreateProperty(MM::g_Keyword_Description, g_devlist[MoticZ][1], MM::String, true); double l(0), r(0); z_SpeedRange(&l, &r); CreateProperty(PROP_ZSPEED, CDeviceUtils::ConvertToString(r / 2), MM::Float, false, 0); SetPropertyLimits(PROP_ZSPEED, l, r); Hub* hub = static_cast<Hub*>(GetParentHub()); if(hub) { hub->AddEventReceiver(this); } UpdateStatus(); _init = true; return DEVICE_OK; }
int LStepOld::Initialize() { std::string answer; int s = ExecuteCommand( g_cmd_get_motor_speed, NULL, 0, &answer ); if (s!=DEVICE_OK) return s; motor_speed_ = atof( answer.c_str() ) * .1; char speed[5]; sprintf( speed, "%2.1f", motor_speed_ ); CPropertyAction* pAct = new CPropertyAction(this, &LStepOld::OnSpeed ); CreateProperty( "Motor-speed [Hz]", speed, MM::Float, false, pAct); SetPropertyLimits( "Motor-speed [Hz]", 0.01, 25 ); s = ExecuteCommand( g_cmd_get_version, NULL, 0, &answer ); if (s!=DEVICE_OK) return s; CreateProperty("Firmware Version", answer.c_str(), MM::String, true); pAct = new CPropertyAction( this, &LStepOld::OnJoystick ); CreateProperty( "Joystick command", "False", MM::String, false, pAct); std::vector<std::string> allowed_boolean; allowed_boolean.push_back("True"); allowed_boolean.push_back("False"); SetAllowedValues("Joystick command", allowed_boolean); return DEVICE_OK; }
int MicroPoint::CreateRepetitionsProperty() { repetitions_ = 1; CPropertyAction* pAct = new CPropertyAction (this, &MicroPoint::OnRepetitions); CreateProperty("Repetitions", "1", MM::Integer, false, pAct); SetPropertyLimits("Repetitions", 1, 100); return DEVICE_OK; }
// Refresh the soft higher and lower limit void CPI_E761_ZStage::refreshPosLimit() { double low, high; int ret = GetLimits(low, high); if (ret != DEVICE_OK) return; SetPropertyLimits(MM::g_Keyword_Position, low, high); }
int VTiSIMLasers::Initialize() { char s[MM::MaxStrLength + 1]; for (long i = 0; i < nChannels; ++i) { snprintf(s, MM::MaxStrLength, "Laser-%ld", i); SetPositionLabel(i, s); } int err = CreateIntegerProperty(MM::g_Keyword_State, 0, false, new CPropertyAction(this, &VTiSIMLasers::OnState)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(MM::g_Keyword_State, 0, nChannels - 1); if (err != DEVICE_OK) return err; err = CreateStringProperty(MM::g_Keyword_Label, "", false, new CPropertyAction(this, &CStateBase::OnLabel)); if (err != DEVICE_OK) return err; for (long i = 0; i < nChannels; ++i) { snprintf(s, MM::MaxStrLength, "Intensity-%ld", i); err = CreateIntegerProperty(s, intensities_[i], false, new CPropertyActionEx(this, &VTiSIMLasers::OnIntensity, i)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(s, 0, 100); if (err != DEVICE_OK) return err; err = DoSetIntensity(i, intensities_[i]); if (err != DEVICE_OK) return err; } // Sync with our memory of state return DoSetChannel(curChan_); }
int VTiSIMLaserShutter::Initialize() { int err = CreateIntegerProperty(MM::g_Keyword_State, 0, false, new CPropertyAction(this, &VTiSIMLaserShutter::OnState)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(MM::g_Keyword_State, 0, 1); if (err != DEVICE_OK) return err; // Sync with our memory of state return DoSetOpen(isOpen_); }
void Controller::GeneratePropertyIntensity() { string intensityName; CPropertyActionEx* pAct; for (unsigned i = 0; i < 3; i++) { pAct = new CPropertyActionEx(this, &Controller::OnIntensity, i); intensityName = g_Keyword_Intensity; intensityName.push_back('A' + (char)i); CreateProperty(intensityName.c_str(), "0", MM::Integer, false, pAct); SetPropertyLimits(intensityName.c_str(), 0, 100); } }
void MUCamSource::InitExposure() { MUCam_getExposureRange(hCameras_[currentCam_], &exposureMin_, &exposureMax_); exposureMs_ = 10.0; MUCam_setExposure(hCameras_[currentCam_], (float)exposureMs_); char buf[10]; sprintf(buf, "%0.1f", (float)exposureMs_); CPropertyAction *pAct = new CPropertyAction (this, &MUCamSource::OnExposure); int ret = CreateProperty(MM::g_Keyword_Exposure, buf, MM::Float, false, pAct); assert(ret == DEVICE_OK); SetPropertyLimits(MM::g_Keyword_Exposure, (double)exposureMin_, (double)exposureMax_); // m_dExposurems = 10.0; }
int PIZStage::OnAxisLimit(MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { pProp->Set(axisLimitUm_); SetPropertyLimits(MM::g_Keyword_Position, 0.0/*-axisLimitUm_*/, axisLimitUm_); } else if (eAct == MM::AfterSet) { pProp->Get(axisLimitUm_); } return DEVICE_OK; }
int SimpleAutofocus::Initialize() { if(NULL == pPoints_) { pPoints_ = new SAFData(); } LogMessage("SimpleAutofocus::Initialize()"); pCore_ = GetCoreCallback(); CPropertyAction *pAct = new CPropertyAction (this, &SimpleAutofocus::OnExposure); CreateProperty(MM::g_Keyword_Exposure, "0.", MM::Float, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnBinning); CreateProperty("Binning","0",MM::Integer, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnCoarseStepNumber); CreateProperty("CoarseSteps from center","5",MM::Integer, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnStepsizeCoarse); CreateProperty("CoarseStepSize","1.0",MM::Float, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnFineStepNumber); CreateProperty("FineSteps from center","5",MM::Integer, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnStepSizeFine); CreateProperty("FineStepSize","0.3",MM::Float, false, pAct); // Set the sharpness threshold pAct = new CPropertyAction(this, &SimpleAutofocus::OnThreshold); CreateProperty("Threshold","0.1",MM::Float, false, pAct); // Set the cropping factor to speed up computation pAct = new CPropertyAction(this, &SimpleAutofocus::OnCropFactor); CreateProperty("CropFactor","0.2",MM::Float, false, pAct); SetPropertyLimits("CropFactor",0.1, 1.0); pAct = new CPropertyAction(this, &SimpleAutofocus::OnSharpnessScore); CreateProperty("SharpnessScore","0.0",MM::Float, true, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnMean); CreateProperty("Mean","0",MM::Float, true, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnEnableAutoShutter); CreateProperty("EnableAutoshutter","0",MM::Integer, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnRecalculate); CreateProperty("Re-acquire&EvaluateSharpness","0",MM::Integer, false, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnStandardDeviationOverMean); CreateProperty("StandardDeviation/Mean","0",MM::Float, true, pAct); pAct = new CPropertyAction(this, &SimpleAutofocus::OnChannel); CreateProperty("Channel","",MM::String, false, pAct); AddAllowedValue("Channel",""); AddAllowedValue("Channel","..."); selectedChannelConfig_ = ""; pAct = new CPropertyAction(this, &SimpleAutofocus::OnSearchAlgorithm); CreateProperty("SearchAlgorithm","Brent",MM::String, false, pAct); AddAllowedValue("SearchAlgorithm","Brent"); AddAllowedValue("SearchAlgorithm","BruteForce"); searchAlgorithm_ = "Brent"; UpdateStatus(); return DEVICE_OK; }
int XYStage::Initialize() { // LIN 01-01-2012 H128 DOES NOT HAVE ADJUSTABLE RESOLUTIONS // LIN 01-02-2012 STEP SIZE ALREADY SET IN XYSTAGE::XYSTAGE() FUNCTION INITIALIZER LIST TO 0.1 // Max Speed CPropertyAction* pAct = new CPropertyAction (this, &XYStage::OnMaxSpeed); CreateProperty("MaxSpeed", "20", MM::Integer, false, pAct); SetPropertyLimits("MaxSpeed", 1, 100); // LIN 01-01-2012 H128 MAX SPEED IS 100 NOT 250 // Acceleration pAct = new CPropertyAction (this, &XYStage::OnAcceleration); CreateProperty("Acceleration", "20", MM::Integer, false, pAct); SetPropertyLimits("Acceleration", 1, 100); // LIN 01-01-2012 H128 MAX ACCELERATION IS 100 NOT 150 int ret = UpdateStatus(); if (ret != DEVICE_OK) return ret; initialized_ = true; return DEVICE_OK; }
int Sapphire::OnMaximumLaserPower(MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { pProp->Set(maxlp_); } else if (eAct == MM::AfterSet) { pProp->Get(maxlp_); SetPropertyLimits(g_Keyword_PowerSetpoint, minlp_, maxlp_); } return HandleErrors(); }
VTiSIMPinholeArray::VTiSIMPinholeArray() : minFinePosition_(0), maxFinePosition_(1), curFinePosition_(6000), backlashCompensation_(100) { memset(pinholePositions_, 0, sizeof(pinholePositions_)); SetErrorText(VTI_ERR_TIMEOUT_OCCURRED, "Timeout occurred"); SetErrorText(VTI_ERR_DEVICE_NOT_FOUND, "Device not found"); SetErrorText(VTI_ERR_NOT_INITIALISED, "Device not initialized"); SetErrorText(VTI_ERR_NOT_SUPPORTED, "Operation not supported"); CreateIntegerProperty(g_PropName_Backlash, backlashCompensation_, false, new CPropertyAction(this, &VTiSIMPinholeArray::OnBacklashCompensation), true); SetPropertyLimits(g_PropName_Backlash, -500, 500); }
int VTiSIMPinholeArray::Initialize() { DWORD vterr = vti_GetMotorRange(VTiHub()->GetScanAndMotorHandle(), VTI_MOTOR_PINHOLE_ARRAY, &minFinePosition_, &maxFinePosition_); if (vterr != VTI_SUCCESS) return vterr; int err = DoGetPinholePositions(pinholePositions_); if (err != DEVICE_OK) return err; // Initialize our fine position to that of the 64 um pinhole, which is the // default pinhole where we will move to below after properties are set up. curFinePosition_ = pinholePositions_[VTI_PINHOLE_64_MICRON]; err = CreateIntegerProperty(g_PropName_FinePosition, curFinePosition_, false, new CPropertyAction(this, &VTiSIMPinholeArray::OnFinePosition)); if (err != DEVICE_OK) return err; err = SetPropertyLimits(g_PropName_FinePosition, minFinePosition_, maxFinePosition_); if (err != DEVICE_OK) return err; err = CreateIntegerProperty(g_PropName_PinholeSize, GetPinholeSizeUmForIndex(VTI_PINHOLE_64_MICRON), false, new CPropertyAction(this, &VTiSIMPinholeArray::OnPinholeSize)); if (err != DEVICE_OK) return err; for (int i = 0; i < nSizes; ++i) { char s[MM::MaxStrLength + 1]; snprintf(s, MM::MaxStrLength, "%d", GetPinholeSizeUmForIndex(i)); err = AddAllowedValue(g_PropName_PinholeSize, s); if (err != DEVICE_OK) return err; } err = DoSetFinePosition(curFinePosition_, backlashCompensation_); if (err != DEVICE_OK) return err; return DEVICE_OK; }
int LCDA::Initialize() { if (!LaserBoardIsOpen()) { int ret = LaserBoardOpen(); if (ret != NO_ERR) return ret; } char version[64]; int ret = LaserBoardFirmwareVersion(version); if (ret != NO_ERR) return ret; ret = LaserBoardGetAOInfo(channel_ - 1, &minV_, &maxV_, &bitDepth_); if (ret != NO_ERR) return ret; // set property list // ----------------- // Name int nRet = CreateProperty(MM::g_Keyword_Name, name_.c_str(), MM::String, true); if (DEVICE_OK != nRet) return nRet; // Description nRet = CreateProperty(MM::g_Keyword_Description, "LC DAC driver", MM::String, true); if (DEVICE_OK != nRet) return nRet; // Volts // ----- CPropertyAction* pAct = new CPropertyAction (this, &LCDA::OnVolts); nRet = CreateProperty("Volts", "0.0", MM::Float, false, pAct); if (nRet != DEVICE_OK) return nRet; SetPropertyLimits("Volts", minV_, maxV_); initialized_ = true; return DEVICE_OK; }
void MUCamSource::InitGain() { int cnt = MUCam_getGainCount(hCameras_[currentCam_]); if (cnt <= 0) return; if (gains_ != 0) { delete [] gains_; gains_ = 0; } gains_ = new float[cnt]; if (MUCam_getGainList(hCameras_[currentCam_], gains_)) { int gainRed, gainGreen, gainBlue; CPropertyAction *pAct = new CPropertyAction (this, &MUCamSource::OnGain); CreateProperty(MM::g_Keyword_Gain, "1.0", MM::Float, false, pAct); if(MUCam_setRGBGainValue(hCameras_[currentCam_], 1.0, 1.0, 1.0, &gainRed, &gainGreen, &gainBlue)) gain_ = gains_[gainRed]; SetPropertyLimits(MM::g_Keyword_Gain, gains_[0], gains_[cnt - 1]); } }
int Illumination::Initialize() { if(!g_device_connected) return DEVICE_NOT_CONNECTED; if(_init) return DEVICE_OK; // Name and description CreateProperty(MM::g_Keyword_Name, g_devlist[MoticIllumination][0], MM::String, true); CreateProperty(MM::g_Keyword_Description, g_devlist[MoticIllumination][1], MM::String, true); if(illumination_Available()) { int v = illumination_GetValue(); CPropertyAction* act = new CPropertyAction(this, &Illumination::OnIntensity); CreateProperty(PROP_ILLUMINATION_INTENSITY, CDeviceUtils::ConvertToString(v), MM::Integer, false, act); int l(0), r(0); illumination_GetRange(&l, &r); SetPropertyLimits(PROP_ILLUMINATION_INTENSITY, l, r); } Hub* hub = static_cast<Hub*>(GetParentHub()); if(hub) { hub->AddEventReceiver(this); } UpdateStatus(); _init = true; return DEVICE_OK; }
int VTiSIMScanner::DoSetScanWidth(int width) { if (width < minWidth_) width = minWidth_; if (width > maxWidth_) width = maxWidth_; scanWidth_ = width; // Update offset range (and value, if necessary) int newMaxOffset = GetMaxOffset(); if (scanOffset_ > newMaxOffset) { scanOffset_ = newMaxOffset; } int err = SetPropertyLimits(g_PropName_ScanOffset, 0, newMaxOffset); char s[MM::MaxStrLength + 1]; snprintf(s, MM::MaxStrLength, "%d", scanOffset_); err = OnPropertyChanged(g_PropName_ScanOffset, s); if (err != DEVICE_OK) return err; bool scanning; err = DoGetScanning(scanning); if (err != DEVICE_OK) return err; if (scanning) { err = DoStartStopScan(true); if (err != DEVICE_OK) return err; } return DEVICE_OK; }
int Sapphire::Initialize() { LogMessage("Sapphire::Initialize()"); GeneratePowerProperties(); GeneratePropertyState(); GenerateReadOnlyIDProperties(); std::stringstream msg; ReadGreeting(); //disable echo from the controller msg << "E" << "=" << 0; Send(msg.str()); if (ReceiveOneLine() != DEVICE_OK) return ERR_DEVICE_NOT_FOUND; //disable command prompt from controller msg.str(""); msg << ">" << "=" << 0; Send(msg.str()); ReceiveOneLine(); //msg.str(""); //msg << CDRHToken_ << "=" << 0; // Send(msg.str()); // ReceiveOneLine(); // enable control of the laser diode msg.str(""); msg << TECServoToken_ << "=" << 1; Send(msg.str()); ReceiveOneLine(); //disable external 'analogue' control of the laser // enable control of the laser diode //msg.str(""); //msg << externalPowerControlToken_ << "=" << 0; //Send(msg.str()); //ReceiveOneLine(); // query laser for power limits this->initLimits(); double llimit = this->minlp(); double ulimit = this->maxlp(); //if ( 1. > ulimit) // ulimit = 100.; // for off-line test // set the limits as interrogated from the laser controller. SetPropertyLimits(g_Keyword_PowerSetpoint, llimit, ulimit); // milliWatts initialized_ = true; return HandleErrors(); }
int CGigECamera::OnBinningV( MM::PropertyBase* pProp, MM::ActionType eAct ) { int ret = DEVICE_OK; switch(eAct) { case MM::AfterSet: { if(IsCapturing()) return DEVICE_CAMERA_BUSY_ACQUIRING; long binFactor; pProp->Get( binFactor ); int64_t oldBin, oldh; nodes->get( oldBin, BINNING_VERTICAL ); nodes->get( oldh, HEIGHT ); if( binFactor != (long) oldBin ) { bool retval = nodes->set( binFactor, BINNING_VERTICAL ); if( retval == false ) { // set it back nodes->set( oldBin, BINNING_VERTICAL ); pProp->Set( (long) oldBin ); ret = DEVICE_INVALID_PROPERTY_VALUE; } else { // new limits int64_t high, low; high = nodes->getMax( HEIGHT ); low = nodes->getMin( HEIGHT ); SetPropertyLimits( MM::g_Keyword_Image_Height, (double) low, (double) high ); // new height int64_t dim; nodes->get( dim, HEIGHT ); if( dim == oldh ) // this camera doesn't auto-adjust its height w/ binning change { dim = dim * oldBin / binFactor; } SetProperty( MM::g_Keyword_Image_Height, CDeviceUtils::ConvertToString( (long) dim ) ); UpdateProperty( MM::g_Keyword_Image_Height ); LogMessage( (std::string) "setting v bin to " + boost::lexical_cast<std::string>( binFactor ) + " and height to " + boost::lexical_cast<std::string>( dim ) + " (oldBin: " + boost::lexical_cast<std::string>( oldBin ) + ") " + " new limits (" + boost::lexical_cast<std::string>( low ) + + " " + boost::lexical_cast<std::string>( high ) + ")", true ); if( nodes->isAvailable( HEIGHT_MAX ) ) { UpdateProperty( MM::g_Keyword_Image_Height_Max ); } OnPropertiesChanged(); ret = DEVICE_OK; } ResizeImageBuffer(); } } break; case MM::BeforeGet: { int64_t vBin; nodes->get( vBin, BINNING_VERTICAL ); pProp->Set( (long) vBin ); ret=DEVICE_OK; } break; } return ret; } // OnBinningV
int CGigECamera::OnBinningH( MM::PropertyBase* pProp, MM::ActionType eAct ) { int ret = DEVICE_OK; switch(eAct) { case MM::AfterSet: { if(IsCapturing()) return DEVICE_CAMERA_BUSY_ACQUIRING; long binFactor; pProp->Get( binFactor ); int64_t oldBin, oldw; nodes->get( oldBin, BINNING_HORIZONTAL ); nodes->get( oldw, WIDTH ); if( binFactor != (long) oldBin ) { bool retval = nodes->set( (int64_t) binFactor, BINNING_HORIZONTAL ); if( retval == false ) { // set it back nodes->set( oldBin, BINNING_HORIZONTAL ); pProp->Set( (long) oldBin ); ret = DEVICE_INVALID_PROPERTY_VALUE; } else { int64_t dim; nodes->get( dim, WIDTH ); if( dim == oldw ) { dim = dim * oldBin / binFactor; } SetProperty( MM::g_Keyword_Image_Width, CDeviceUtils::ConvertToString( (long) dim ) ); int64_t high, low; high = nodes->getMax( WIDTH ); low = nodes->getMin( WIDTH ); SetPropertyLimits( MM::g_Keyword_Image_Width, (double) low, (double) high ); UpdateProperty( MM::g_Keyword_Image_Width ); LogMessage( (std::string) "setting h bin to " + boost::lexical_cast<std::string>( binFactor ) + " and width to " + boost::lexical_cast<std::string>( dim ) + " (oldBin: " + boost::lexical_cast<std::string>( oldBin ) + ") " + " new limits (" + boost::lexical_cast<std::string>( low ) + + " " + boost::lexical_cast<std::string>( high ) + ")", true ); if( nodes->isAvailable( WIDTH_MAX ) ) { UpdateProperty( MM::g_Keyword_Image_Width_Max ); } OnPropertiesChanged(); ret = DEVICE_OK; } ResizeImageBuffer(); } } break; case MM::BeforeGet: { int64_t hBin; nodes->get( hBin, BINNING_HORIZONTAL ); pProp->Set( (long) hBin ); ret=DEVICE_OK; } break; } return ret; } // OnBinningH
int Xcite120PC::Initialize() { /* Create the properties */ CPropertyAction *pAct = new CPropertyAction (this, &Xcite120PC::OnIntensity); CreateProperty("LampIntensity", "100", MM::Integer, false, pAct); std::vector<std::string> allowed_intensities; allowed_intensities.push_back("0"); allowed_intensities.push_back("12"); allowed_intensities.push_back("25"); allowed_intensities.push_back("50"); allowed_intensities.push_back("100"); SetAllowedValues("LampIntensity", allowed_intensities); pAct = new CPropertyAction (this, &Xcite120PC::OnPanelLock); CreateProperty("LockFrontPanel", "False", MM::String, false, pAct); std::vector<std::string> allowed_boolean; allowed_boolean.push_back("True"); allowed_boolean.push_back("False"); SetAllowedValues("LockFrontPanel", allowed_boolean); pAct = new CPropertyAction(this, &Xcite120PC::OnShutterState ); CreateProperty( "Shutter-State", "Closed", MM::String, false, pAct); std::vector<std::string> allowed_state; allowed_state.push_back("Closed"); allowed_state.push_back("Open"); SetAllowedValues("Shutter-State", allowed_state); pAct = new CPropertyAction(this, &Xcite120PC::OnExposureTime ); CreateProperty( "Exposure-Time [s]", "A", MM::Float, false, pAct); SetPropertyLimits( "Exposure-Time [s]", 0.2, 999.9 ); pAct = new CPropertyAction(this, &Xcite120PC::OnTrigger ); CreateProperty( "Trigger", "Off", MM::String, false, pAct); std::vector<std::string> trigger_state; trigger_state.push_back("On"); trigger_state.push_back("Off"); SetAllowedValues("Trigger", trigger_state); // This seems to cause problems //pAct = new CPropertyAction (this, &Xcite120PC::OnLampState); //CreateProperty("LampState", "On", MM::String, false, pAct); //std::vector<std::string> lamp_state; //lamp_state.push_back("On"); //lamp_state.push_back("Off"); //SetAllowedValues("LampState", lamp_state); /* Connect */ int s = ExecuteCommand( g_XciteCmdConnect ); if (s!=DEVICE_OK) return s; s = ExecuteCommand( g_XciteCmdClearAlarm ); if (s!=DEVICE_OK) return s; /* initialize machine to default values */ SetOpen(is_open_); SetProperty("LampIntensity", lamp_intensity_.c_str()); SetProperty("LockFrontPanel", is_locked_.c_str()); //SetProperty( "Exposure-Time [s]", "30"); /* Create properties which are not modifiable */ std::string answer; s = ExecuteCommand( g_XciteCmdGetSoftwareVersion, NULL, 0, &answer ); if (s!=DEVICE_OK) return s; CreateProperty("ShutterSoftwareVersion", answer.c_str(), MM::String, true); s = ExecuteCommand( g_XciteCmdGetLampHours, NULL, 0, &answer ); if (s!=DEVICE_OK) return s; CreateProperty("LampHours", answer.c_str(), MM::String, true); initialized_ = true; return DEVICE_OK; }
int MCL_NanoDrive_XYStage::SetDeviceProperties() { int err; char iToChar[25]; double origXpos, origYpos; /// Read-only device properties // Name property err = CreateProperty(MM::g_Keyword_Name, g_XYStageDeviceName, MM::String, true); if (err != DEVICE_OK){ return err; } // Description property err = CreateProperty(MM::g_Keyword_Description, "XY Stage Driver", MM::String, true); if (err != DEVICE_OK){ return err; } // MCL handle property sprintf(iToChar, "%d", MCLhandle_); err = CreateProperty("Handle", iToChar, MM::String, true); if (err != DEVICE_OK){ return err; } // Lower x limit property sprintf(iToChar, "%f", xMin_); err = CreateProperty("Lower x limit", iToChar, MM::Float, true); if (err != DEVICE_OK){ return err; } // Lower y limit property sprintf(iToChar, "%f", yMin_); err = CreateProperty("Lower y limit", iToChar, MM::Float, true); if (err != DEVICE_OK){ return err; } // Upper x limit property sprintf(iToChar, "%f", xMax_); err = CreateProperty("Upper x limit", iToChar, MM::Float, true); if (err != DEVICE_OK){ return err; } // Upper y limit property sprintf(iToChar, "%f", yMax_); err = CreateProperty("Upper y limit", iToChar, MM::Float, true); if (err != DEVICE_OK){ return err; } // Serial number sprintf(iToChar, "%d", MCL_GetSerialNumber(MCLhandle_)); err = CreateProperty("Serial number", iToChar, MM::String, true); if (err != DEVICE_OK){ return err; } /// Action handlers // Change x position origXpos = MCL_SingleReadN(XAXIS, MCLhandle_); if ((int)origXpos < 0) return (int) origXpos; sprintf(iToChar, "%f", origXpos); CPropertyAction* pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnPositionXUm); err = CreateProperty(g_Keyword_SetPosXUm, iToChar, MM::Float, false, pAct); if (err != DEVICE_OK) return err; // Set limits i.e. create a slide bar for the x position err = SetPropertyLimits(g_Keyword_SetPosXUm, xMin_, xMax_); if (err != DEVICE_OK) return err; // Change y position origYpos = MCL_SingleReadN(YAXIS, MCLhandle_); if ((int)origYpos < 0) return (int) origYpos; sprintf(iToChar, "%f", origYpos); pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnPositionYUm); err = CreateProperty(g_Keyword_SetPosYUm, iToChar, MM::Float, false, pAct); if (err != DEVICE_OK) return err; // Set limits i.e. make a slidebar for the y position err = SetPropertyLimits(g_Keyword_SetPosYUm, yMin_, yMax_); if (err != DEVICE_OK) return err; // Settling time X axis property sprintf(iToChar, "%d", settlingTimeX_ms_); pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnSettlingTimeXMs); err = CreateProperty("Settling Time X axis (ms)", iToChar, MM::Float, false, pAct); if (err != DEVICE_OK) return err; // Settling time Y axis property sprintf(iToChar, "%d", settlingTimeY_ms_); pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnSettlingTimeYMs); err = CreateProperty("Settling Time Y axis (ms)", iToChar, MM::Float, false, pAct); if (err != DEVICE_OK) return err; // Set origin at the current position property pAct = new CPropertyAction(this, &MCL_NanoDrive_XYStage::OnSetOrigin); err = CreateProperty(g_Keyword_SetOrigin, "No", MM::String, false, pAct); if (err != DEVICE_OK) return err; // Allows user to choose either "Yes" or "No" for wanting to set the origin std::vector<std::string> yesNoList; yesNoList.push_back("No"); yesNoList.push_back("Yes"); err = SetAllowedValues(g_Keyword_SetOrigin, yesNoList); if (err != DEVICE_OK) return err; return DEVICE_OK; }
/*--------------------------------------------------------------------------- This function initialize a Mightex_Sirius_SLC_USB device and creates the actions. ---------------------------------------------------------------------------*/ int Mightex_Sirius_SLC_USB::Initialize() { int nRet; if(dev_num > 0) { devHandle = MTUSB_LEDDriverOpenDevice(cur_dev); if(devHandle >= 0) { channels = MTUSB_LEDDriverDeviceChannels(devHandle); devModuleType = MTUSB_LEDDriverDeviceModuleType(devHandle); } } // Initialize the Mode action CPropertyAction* pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnMode); nRet = CreateProperty("mode", "DISABLE", MM::String, false, pAct); if (DEVICE_OK != nRet) return nRet; AddAllowedValue( "mode", "DISABLE"); AddAllowedValue( "mode", "NORMAL"); AddAllowedValue( "mode", "STROBE"); if((devModuleType != MODULE_MA) && (devModuleType != MODULE_CA)) AddAllowedValue( "mode", "TRIGGER"); pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnChannel); nRet = CreateProperty("channel", "1", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; if(channels > -1) SetPropertyLimits("channel", 1, channels); ledChannelData.Normal_CurrentMax = 20; ledChannelData.Normal_CurrentSet = 10; ledChannelData.Strobe_CurrentMax = 20; ledChannelData.Trigger_CurrentMax = 20; ledChannelData.Strobe_RepeatCnt = 1; ledChannelData.Trigger_Polarity = 1; ledChannelData.Strobe_Profile[0][0] = 0; ledChannelData.Strobe_Profile[0][1] = 500000; ledChannelData.Strobe_Profile[1][0] = 10; ledChannelData.Strobe_Profile[1][1] = 500000; ledChannelData.Strobe_Profile[2][0] = 0; ledChannelData.Strobe_Profile[2][1] = 0; ledChannelData.Trigger_Profile[0][0] = 0; ledChannelData.Trigger_Profile[0][1] = 500000; ledChannelData.Trigger_Profile[1][0] = 10; ledChannelData.Trigger_Profile[1][1] = 500000; ledChannelData.Trigger_Profile[2][0] = 0; ledChannelData.Trigger_Profile[2][1] = 0; pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetImax); nRet = CreateProperty("iMax", "20", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetNormalCurrent); nRet = CreateProperty("normal_CurrentSet", "10", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; SetPropertyLimits("normal_CurrentSet", 0, 20); pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetRatio); nRet = CreateProperty("ratio", "50", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; SetPropertyLimits("ratio", 0, 100); pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetPeriod); nRet = CreateProperty("frequency", "1", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetI1); nRet = CreateProperty("i1", "0", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; SetPropertyLimits("i1", 0, 20); pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetI2); nRet = CreateProperty("i2", "10", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; SetPropertyLimits("i2", 0, 20); pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnSetRepeatCnt); nRet = CreateProperty("repeatCnt", "1", MM::Integer, false, pAct); if (DEVICE_OK != nRet) return nRet; // Initialize the status query action pAct = new CPropertyAction (this, &Mightex_Sirius_SLC_USB::OnStatus); nRet = CreateProperty("Status", "No Fault", MM::String, true, pAct); if (DEVICE_OK != nRet) return nRet; CreateStaticReadOnlyProperties(); m_initialized = true; // init message std::ostringstream log; log << "Mightex Sirius SLC(USB) - initializied " << "S/N: " << m_serialNumber; LogMessage(log.str().c_str()); return DEVICE_OK; }
int CArduinoNeoPixelShutter::Initialize() { CArduinoNeoPixelHub* hub = static_cast<CArduinoNeoPixelHub*>(GetParentHub()); if (!hub || !hub->IsPortAvailable()) { return ERR_NO_PORT_SET; } char hubLabel[MM::MaxStrLength]; hub->GetLabel(hubLabel); SetParentID(hubLabel); // for backward comp. // set property list // ----------------- // OnOff // ------ CPropertyAction* pAct = new CPropertyAction (this, &CArduinoNeoPixelShutter::OnOnOff); int ret = CreateProperty("OnOff", "1", MM::Integer, false, pAct); if (ret != DEVICE_OK) return ret; pAct = new CPropertyAction (this, &CArduinoNeoPixelShutter::OnIntensity); ret = CreateProperty("Intensity", "255", MM::Integer, false, pAct); SetPropertyLimits("Intensity", 0, 255); if (ret != DEVICE_OK) return ret; pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnRedBrightness); ret = CreateProperty("Red brightness", "255", MM::Integer, false, pAct); SetPropertyLimits("Red brightness", 0, 255); if (ret != DEVICE_OK) return ret; pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnGreenBrightness); ret = CreateProperty("Green brightness", "255", MM::Integer, false, pAct); SetPropertyLimits("Green brightness", 0, 255); if (ret != DEVICE_OK) return ret; pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnBlueBrightness); ret = CreateProperty("Blue brightness", "255", MM::Integer, false, pAct); SetPropertyLimits("Blue brightness", 0, 255); if (ret != DEVICE_OK) return ret; pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnMulti); ret = CreateProperty("Multi", "8", MM::Integer, false, pAct); SetPropertyLimits("Multi", 0, 1<<3); if (ret != DEVICE_OK) return ret; // set shutter into the off state //WriteToPort(0); std::vector<std::string> vals; vals.push_back("0"); vals.push_back("1"); ret = SetAllowedValues("OnOff", vals); if (ret != DEVICE_OK) return ret; ret = UpdateStatus(); if (ret != DEVICE_OK) return ret; changedTime_ = GetCurrentMMTime(); initialized_ = true; return DEVICE_OK; }