Ejemplo n.º 1
0
        public AndorCamera(CameraParameters p)
        {
            int _numCameras = 0;

            ret = sdk.GetAvailableCameras(ref _numCameras);
            if (ret == AndorSDK.DRV_SUCCESS && _numCameras == 1)
            {
                numCameras = _numCameras;
                int handle = 0;
                ret = sdk.GetCameraHandle(0, ref handle);
                if (ret == AndorSDK.DRV_SUCCESS)
                {
                    ret = sdk.SetCurrentCamera(handle);
                    if (ret == AndorSDK.DRV_SUCCESS)
                    {
                        ret = sdk.Initialize(p.Dir);
                        if (ret != AndorSDK.DRV_SUCCESS)
                        {
                            Log.Debug("ANDOR: " + ErrorCodes.Decoder(ret));
                            sdk.ShutDown();
                        }
                        else
                        {
                            int _Serial = 0;
                            sdk.GetCameraSerialNumber(ref _Serial);
                            Serial = _Serial;

                            // get properties
                            ret = sdk.GetCapabilities(ref caps);
                            if (ret == AndorSDK.DRV_SUCCESS && (AndorSDK.AC_FEATURES_FTEXTERNALEXPOSURE & caps.ulTriggerModes) != 1)
                            {
                                Log.Debug("ANDOR: " + "Does not support external exposure");
                            }

                            int nAD = 0;
                            sdk.GetNumberADChannels(ref nAD);
                            NumberADChannels = nAD; // number of ADCs

                            int _BitDepth = 0;
                            sdk.GetBitDepth(_BitDepth, ref _BitDepth); // dynamic range
                            BitDepth = _BitDepth;

                            int _XDim = 0, _YDim = 0;
                            sdk.GetDetector(ref _XDim, ref _YDim); // detector dimensions
                            XDim = _XDim; YDim = _YDim;

                            int _MCPGainMin = 0; int _MCPGainMax = 0;
                            sdk.GetMCPGainRange(ref _MCPGainMin, ref _MCPGainMax); // gain settings
                            MCPGainMin = _MCPGainMin; MCPGainMax = _MCPGainMax;

                            // set properties
                            SetUpAndor();
                        }
                    }
                }
            }
        }