Пример #1
0
        public TargetingTest(int expSeconds, int frameRate, int pxPERmm, string folder, string name, string fishID) : base(folder, name, fishID, expSeconds, frameRate, pxPERmm)
        {
            _totalFrames = ExperimentLength * FrameRate;
            if (FileSaver != null)
            {
                _trackWriter = FileSaver.GetStreamWriter(".track");
                _imageWriter = FileSaver.GetTiffWriter("_camImage.tif", true);
            }
            _laser = new SDLPS500Controller(Properties.Settings.Default.DAQ, Properties.Settings.Default.LaserAO);
            string xchannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerX;
            string ychannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerY;

            //Load scan lookup table from file
            try
            {
                TextReader reader    = File.OpenText("main.calib");
                var        scanTable = BLIScanLookupTable.LoadFromFile(reader);
                _scanner = new RandomAccessScanner(scanTable, xchannel, ychannel, -10, 10);
                reader.Dispose();
            }
            catch (IOException)
            {
                System.Diagnostics.Debug.WriteLine("Could not find calibration data. No targeting available");
            }
            //This is an closed-loop experiment - try to stay fully up-to-date
            SuggestedBufferSeconds = 0;
        }
Пример #2
0
        public Replay(Queue <string> originalTrackData, Queue <string> originalInfoData, OriginalType originalType, int originalLength, int frameRate, int pxPERmm, string folder, string name, string fishID) :
            base(folder, name, fishID, originalLength, frameRate, pxPERmm)
        {
            if (FileSaver != null)
            {
                _trackWriter      = FileSaver.GetStreamWriter(".track");
                _imageWriter      = FileSaver.GetTiffWriter("_camImage.tif", true);
                _backgroundWriter = FileSaver.GetTiffWriter("_bgImage.tif", true);
                //Create 10x10 mm region image
                _camRegion = new Image8(Properties.Settings.Default.PixelsPermm * 10, Properties.Settings.Default.PixelsPermm * 10);
            }
            _laser = new SDLPS500Controller(Properties.Settings.Default.DAQ, Properties.Settings.Default.LaserAO);
            string xchannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerX;
            string ychannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerY;

            //Load scan lookup table from file
            try
            {
                TextReader reader    = File.OpenText("main.calib");
                var        scanTable = BLIScanLookupTable.LoadFromFile(reader);
                _scanner = new RandomAccessScanner(scanTable, xchannel, ychannel, -10, 10);
                reader.Dispose();
            }
            catch (IOException)
            {
                System.Diagnostics.Debug.WriteLine("Could not find calibration data. No targeting available");
            }
            //This is a closed-loop experiment - try to stay fully up-to-date
            SuggestedBufferSeconds = 0;
            _originalType          = originalType;
            _originalTrackData     = originalTrackData;
            _originalInfoData      = originalInfoData;
            _experimentPhase       = ExperimentPhase.Replay;
        }
Пример #3
0
        /// <summary>
        /// Creates a new LaserAlignment object
        /// </summary>
        /// <param name="frameRate">The frameRate of the experiment</param>
        public LaserAlignment(int frameRate) : base("", "", "", 0, frameRate)
        {
            //TODO: Here we should probably get information about actual ROI to use as well as where to store calibration data
            _laser = new SDLPS500Controller(Properties.Settings.Default.DAQ, Properties.Settings.Default.LaserAO);
            string xchannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerX;
            string ychannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerY;

            _scanner = new RandomAccessScanner(null, xchannel, ychannel, -10, 10);
        }
Пример #4
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (_bgModel != null)
     {
         _bgModel.Dispose();
         _bgModel = null;
     }
     if (_fgModel != null)
     {
         _fgModel.Dispose();
         _fgModel = null;
     }
     if (_calc != null)
     {
         _calc.Dispose();
         _calc = null;
     }
     if (_foreground != null)
     {
         _foreground.Dispose();
         _foreground = null;
     }
     if (_markerBuffer != null)
     {
         Marshal.FreeHGlobal((IntPtr)_markerBuffer);
         _markerBuffer = null;
     }
     if (_laser != null)
     {
         _laser.Dispose();
         _laser = null;
     }
     if (_scanner != null)
     {
         _scanner.Hit(new IppiPoint_32f(0.0f, 0.0f));
         _scanner.Dispose();
         _scanner = null;
     }
     if (_strel3x3 != null)
     {
         _strel3x3.Dispose();
         _strel3x3 = null;
     }
 }
Пример #5
0
        public CircularGradient(int habitSeconds, int preSeconds, int gradientSeconds, int nTrials, int frameRate, int pxPERmm, string folder, string name, string fishID) :
            base(folder, name, fishID, habitSeconds + (preSeconds + gradientSeconds) * nTrials, frameRate, pxPERmm)
        {
            if (FileSaver != null)
            {
                _trackWriter      = FileSaver.GetStreamWriter(".track");
                _imageWriter      = FileSaver.GetTiffWriter("_camImage.tif", true);
                _backgroundWriter = FileSaver.GetTiffWriter("_bgImage.tif", true);
                //Create 10x10 mm region image
                _camRegion = new Image8(Properties.Settings.Default.PixelsPermm * 10, Properties.Settings.Default.PixelsPermm * 10);
            }
            _laser = new SDLPS500Controller(Properties.Settings.Default.DAQ, Properties.Settings.Default.LaserAO);
            string xchannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerX;
            string ychannel = Properties.Settings.Default.DAQ + "/" + Properties.Settings.Default.ScannerY;

            //Load scan lookup table from file
            try
            {
                TextReader reader    = File.OpenText("main.calib");
                var        scanTable = BLIScanLookupTable.LoadFromFile(reader);
                _scanner = new RandomAccessScanner(scanTable, xchannel, ychannel, -10, 10);
                reader.Dispose();
            }
            catch (IOException)
            {
                System.Diagnostics.Debug.WriteLine("Could not find calibration data. No targeting available");
            }
            _preFrames         = preSeconds * FrameRate;
            _gradFrames        = gradientSeconds * FrameRate;
            _habitFrames       = habitSeconds * FrameRate;
            _nTrials           = nTrials;
            _currentPhaseFrame = 0;
            _currentTrial      = 0;//Start at 0 during habituation will be pre-incremented as we enter pre-phase and will be checked for completing at end of gradient phase
            //This is a closed-loop experiment - try to stay fully up-to-date
            SuggestedBufferSeconds = 0;
            //Start in habituation phase
            _experimentPhase = ExperimentPhase.Habituation;
        }