private void checkPropertyValueEquals( Devices.Keys devKey, Properties.Keys propKey, Properties.Values expectedValue) { if (!(props_.getPropValueString(devKey, propKey).equals(expectedValue.toString()))) { if (MyDialogUtils.getConfirmDialogResult( "This plugin may not work if property \"" + propKey.toString() + "\" of device \"" + devices_.getMMDevice(devKey) + "\" is not set to \"" + expectedValue.toString() + "\". Set it now?", JOptionPane.YES_NO_OPTION)) { props_.setPropValue(devKey, propKey, expectedValue); } } }
/** * checks that the device has correct library, properties that we need, and correct values set as * needed * * @param key */ private void checkDeviceLibrary(Devices.Keys key) { Devices.Libraries deviceLibrary = devices_.getMMDeviceLibrary(key); if (deviceLibrary == Devices.Libraries.NODEVICE) { return; } switch (key) { case CAMERAA: case CAMERAB: switch (deviceLibrary) { case HAMCAM: checkPropertyExists(key, Properties.Keys.TRIGGER_SOURCE); checkPropertyValueEquals( key, Properties.Keys.TRIGGER_POLARITY, Properties.Values.POSITIVE); break; case PCOCAM: // trigger polarity not accessible in Micro-Manager, so we have to trust it is correct checkPropertyExists(key, Properties.Keys.TRIGGER_MODE_PCO); break; case ANDORCAM: // TODO check trigger polarity checkPropertyExists(key, Properties.Keys.TRIGGER_MODE); break; case DEMOCAM: checkPropertyValueEquals(key, Properties.Keys.PIXEL_TYPE, Properties.Values.SIXTEENBIT); break; default: MyDialogUtils.showError( "Plugin doesn't support your camera for SPIM yet;" + " contact the authors for support (camera must have hardware trigger)"); } // CamA/B case break; case GALVOA: case GALVOB: if (deviceLibrary == Devices.Libraries.ASITIGER) { checkPropertyValueEquals( key, Properties.Keys.INPUT_MODE, Properties.Values.INTERNAL_INPUT); // PLogic use in the plugin assumes "laser + side" output mode if (devices_.isValidMMDevice(Devices.Keys.PLOGIC)) { checkPropertyValueEquals( key, Properties.Keys.LASER_OUTPUT_MODE, Properties.Values.LASER_SHUTTER_SIDE); } } else { MyDialogUtils.showError("Plugin doesn't support galvo devices other than ASITiger"); } break; case PIEZOA: case PIEZOB: if (deviceLibrary == Devices.Libraries.ASITIGER) { checkPropertyValueEquals( key, Properties.Keys.PIEZO_MODE, Properties.Values.INTERNAL_CLOSEDLOOP_INPUT); } else { MyDialogUtils.showError("Plugin doesn't support piezo devices other than ASITiger"); } break; case PLOGIC: if (deviceLibrary == Devices.Libraries.ASITIGER) { // would like to do below line but we need to change pre-init value and reload config // checkPropertyValueEquals(key, Properties.Keys.PLOGIC_MODE, // Properties.Values.DISPIM_SHUTTER); if (!props_ .getPropValueString(key, Properties.Keys.PLOGIC_MODE) .equals(Properties.Values.DISPIM_SHUTTER.toString())) { MyDialogUtils.showError( "Device " + devices_.getMMDevice(key) + ": need to set pre-initialization property PLogicMode to " + "diSPIM Shutter (use Hardware Config Wizard, then edit device " + devices_.getMMDevice(key) + " on Step 2). Then reload the " + " changed configuration and restart the diSPIM plugin."); } checkPropertyValueEquals( key, Properties.Keys.PLOGIC_TRIGGER_SOURCE, Properties.Values.PLOGIC_TRIGGER_MMIRROR); // PLogic use in the plugin assumes "laser + side" output mode for (Devices.Keys galvoKey : Devices.GALVOS) { if (devices_.isValidMMDevice(galvoKey)) { checkPropertyValueEquals( galvoKey, Properties.Keys.LASER_OUTPUT_MODE, Properties.Values.LASER_SHUTTER_SIDE); } } } else { MyDialogUtils.showError("Plugin doesn't support shutter devices other than ASITiger"); } break; default: break; } }