예제 #1
0
        public SipperFileDialog(PicesSipperFile _sipperFile,
                                PicesRunLog _runLog
                                )
        {
            runLog = _runLog;

            if (runLog == null)
            {
                runLog = new PicesRunLog();
            }

            sipperFile = _sipperFile;

            if (sipperFile != null)
            {
                // Retrieve an up-to-date version of SipperFile from database.
                PicesSipperFile tempSipperFile = DbConn().SipperFileRecLoad(sipperFile.SipperFileName);
                if (tempSipperFile != null)
                {
                    sipperFile.ReFresh(tempSipperFile);
                }
            }

            addMode = false;

            InitializeComponent();
        }
예제 #2
0
        public InstrumentDataReportCTD(InstrumentDataManager _manager,
                                       byte _deviceId,
                                       OutPutFormat _outFormat
                                       ) :
            base(_manager, _deviceId)
        {
            sipperFile = _manager.SipperFile();
            SipperConfigRec configRec = _manager.ConmfigRec();

            if (sipperFile != null)
            {
                ext0Code = sipperFile.CtdExt0;
                ext1Code = sipperFile.CtdExt1;
                ext2Code = sipperFile.CtdExt2;
                ext3Code = sipperFile.CtdExt3;
            }

            else if (configRec != null)
            {
                ext0Code = configRec.HeaderRec().CtdExt0Code();
                ext1Code = configRec.HeaderRec().CtdExt1Code();
                ext2Code = configRec.HeaderRec().CtdExt2Code();
                ext3Code = configRec.HeaderRec().CtdExt3Code();
            }

            String siperFileName = "";

            if (sipperFile != null)
            {
                siperFileName = OSservices.GetRootName(sipperFile.SipperFileName);
            }

            //if  (!String.IsNullOrEmpty (siperFileName))
            //  ctdStream = new StreamWriter ("C:\\Temp\\" + siperFileName + ".txt");
        }
예제 #3
0
        } /* SetLeftCrop */

        private void  SetExtractionStartPoint(object sender, System.EventArgs e)
        {
            if (dbConn == null)
            {
                return;
            }

            uint scanLine = (uint)((displayRowTop + rightMouseRow) * sipperFile.Ratio());

            DialogResult dr = MessageBox.Show(panel, "Set Image Extraction starting Scan-Line to " +
                                              scanLine.ToString("###,###,##0") +
                                              " ?", "Image Extraction Start Point",
                                              MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                PicesSipperFile sf = dbConn.SipperFileRecLoad(dbSipperFile.SipperFileName);
                if (sf == null)
                {
                    MessageBox.Show(panel, "Error retrieving existing SipperFile Entry from database", "Update Starting Extraction Failed", MessageBoxButtons.OK);
                }
                else
                {
                    sf.ExtractionScanLineStart = (uint)scanLine;
                    dbConn.SipperFileUpdate(sf);
                    dbSipperFile.ExtractionScanLineStart = scanLine;
                }
            }
        }
        } /* CreateFeatureDataFileThread */

        void  MakeSureDepthFieldIsIncluded(PicesFeatureVectorList data)
        {
            PicesDataBase dbConn = null;
            PicesRunLog   runLog = new PicesRunLog(dialogMsgQueue);

            data.SortByImageFileName();

            String curSipperFileName  = "";
            float  curSipperFileDepth = 0.0f;


            foreach (PicesFeatureVector fv in data)
            {
                if (fv.Depth == 0.0f)
                {
                    if (dbConn == null)
                    {
                        dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
                    }
                    uint   sacnLineNum        = 0;
                    uint   scanCol            = 0;
                    String nextSipperFileName = "";

                    PicesFeatureVector.ParseImageFileName(fv.ExampleFileName, ref nextSipperFileName, ref sacnLineNum, ref scanCol);

                    if (nextSipperFileName != curSipperFileName)
                    {
                        curSipperFileDepth = 0.0f;
                        curSipperFileName  = nextSipperFileName;

                        PicesSipperFile sf = dbConn.SipperFileRecLoad(curSipperFileName);
                        if (sf != null)
                        {
                            curSipperFileDepth = sf.Depth;
                        }
                    }

                    PicesInstrumentData id = dbConn.InstrumentDataGetByScanLine(curSipperFileName, sacnLineNum);
                    if ((id == null) || (id.Depth == 0.0))
                    {
                        fv.Depth = curSipperFileDepth;
                    }
                    else
                    {
                        fv.Depth = id.Depth;
                    }
                }
            }

            if (dbConn != null)
            {
                dbConn.Close();
                dbConn = null;
                GC.Collect();
            }
        } /* MakeSureDepthFieldIsIncluded */
예제 #5
0
        public TreeNodeSipperFile(PicesDataBase _dbConn,
                                  PicesSipperFile _sipperFile
                                  )
        {
            sipperFile = _sipperFile;
            Text       = ToString();

            ContextMenuStrip cms = new ContextMenuStrip();

            cms.Items.Add("View Sipper File", null, ViewSipperFile);
            cms.Items.Add("Edit Sipper File Parameters", null, EditSipperFileParameters);
            this.ContextMenuStrip = cms;
        }
예제 #6
0
        } /* SaveImagesBySipperFiles */

        private void  SaveImagesForOneSipperFile(String dirPath,
                                                 PicesSipperFile sf,
                                                 Dictionary <string, int> imagesPerClass
                                                 )
        {
            uint lastImageId = 0;

            sipperFileName = sf.SipperFileName;

            while (!cancelRequested)
            {
                int limit = -1;
                if (mlClass == null)
                {
                    // With out the Class Key;  mySql will probably not be able to restart the query from a known spot and
                    // get all the images that is intended.  So in this case we want to retrieve all images that meet the
                    // criteria from this SIPPER file.
                    limit = -1;
                }
                PicesDataBaseImageList nextBunch = dbConn.ImagesQuery
                                                       (null, // ImageGroup
                                                       sipperFileName,
                                                       mlClass,
                                                       classKeyToUse,
                                                       probMin, probMax,
                                                       sizeMin, sizeMax,
                                                       depthMin, depthMax,
                                                       lastImageId,
                                                       limit,
                                                       false // false = Don't load Thumbnail images.
                                                       );

                if ((nextBunch == null) || (nextBunch.Count < 1))
                {
                    break;
                }

                SaveOneBatchOfImages(dirPath, imagesPerClass, nextBunch);
                lastImageId = nextBunch[nextBunch.Count - 1].ImageId;
                nextBunch   = null;

                if ((nextBunch == null) || (nextBunch.Count < limit) || (limit < 0))
                {
                    // Since we loaded less images than 'limit' was set for we are done loading images from this sipperFileName.
                    break;
                }

                nextBunch = null;
            }
        } /* SaveImagesForOneSipperFile */
        } /* CreateTuningFeatureFiles */

        void  MakeSureDepthFieldIsIncluded(PicesFeatureVectorList data)
        {
            PicesDataBase dbConn = null;
            PicesRunLog   runLog = new PicesRunLog();

            data.SortByImageFileName();

            String curSipperFileName  = "";
            float  curSipperFileDepth = 0.0f;


            foreach (PicesFeatureVector fv in data)
            {
                if (fv.Depth == 0.0f)
                {
                    String nextSipperFileName = PicesMethods.SipperFileNameFromImageFileName(fv.ExampleFileName);

                    if (nextSipperFileName != curSipperFileName)
                    {
                        curSipperFileDepth = 0.0f;
                        curSipperFileName  = nextSipperFileName;

                        if (dbConn == null)
                        {
                            dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
                        }

                        PicesSipperFile sf = dbConn.SipperFileRecLoad(curSipperFileName);
                        if (sf != null)
                        {
                            curSipperFileDepth = sf.Depth;
                        }
                    }

                    if (fv.Depth == 0.0f)
                    {
                        fv.Depth = curSipperFileDepth;
                    }
                }
            }

            if (dbConn != null)
            {
                dbConn.Close();
                dbConn = null;
                GC.Collect();
            }
        } /* MakeSureDepthFieldIsIncluded */
예제 #8
0
        public ImportValidatdClass()
        {
            runLog      = new PicesRunLog();
            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            runLogGoalie   = new PicesGoalKeeper("ImportValidatingClass");
            runLogMsgQueue = new Queue <String> ();

            sipperFile   = mainWinConn.SipperFileRecLoad(sipperFileName);
            unknownClass = GetClassFromName(mainWinConn, "UnKnown");

            InitializeComponent();

            SourceDirectory.Text = PicesSipperVariables.HomeDir();
            SourceDirectory.Text = "D:\\Users\\kkramer\\PlanktonCompetition\\trunk\\Data\\";
        }
예제 #9
0
        public SipperFileDialog(String _siperFileName,
                                PicesRunLog _runLog
                                )
        {
            runLog     = _runLog;
            sipperFile = DbConn().SipperFileRecLoad(_siperFileName);
            if (sipperFile == null)
            {
                sipperFile = new PicesSipperFile(_siperFileName);
                sipperFile.SipperFileName = _siperFileName;
                addMode = true;
            }

            InitializeComponent();

            allowUpdates = PicesSipperVariables.AllowUpdates();

            PopulateScreen();
        }
예제 #10
0
        } /* Colorize */



        public void  SetSipperFile(SipperFileBuffered _sipperFile,
                                   PicesSipperFile _dbSipperFile,
                                   PicesDataBase _dbConn
                                   )
        {
            sipperFile    = _sipperFile;
            dbSipperFile  = _dbSipperFile;
            dbConn        = _dbConn;
            displayRowTop = 0;

            if (sipperFile == null)
            {
                cropColumnLeft  = 0;
                cropColumnRight = 4095;
            }
            else
            {
                cropColumnLeft  = sipperFile.CropColLeft();
                cropColumnRight = sipperFile.CropColRight();
            }

            ComputeParameters();
        } /* SetSipperFile */
예제 #11
0
        } /* SaveGivenImageList */

        private void  SaveImagesBySipperFiles()
        {
            bool includeStationAndDeploymentInDirName = false;
            bool firstSipperFile = true;

            PicesSipperFileList sipperFiles = null;

            if (String.IsNullOrEmpty(sipperFileName))
            {
                sipperFiles = dbConn.SipperFileLoad(cruise, station, deployment);
            }
            else
            {
                PicesSipperFile sf = dbConn.SipperFileRecLoad(sipperFileName);
                if (sf != null)
                {
                    sipperFiles = new PicesSipperFileList();
                    sipperFiles.Add(sf);
                }
            }

            if (sipperFiles != null)
            {
                String lastCruise     = "";
                String lastStation    = "";
                String lastDeployment = "";
                String dirPath        = "";

                Dictionary <String, int> imagesPerClass = new Dictionary <string, int> ();

                foreach (PicesSipperFile sf in sipperFiles)
                {
                    bool startANewDir = false;
                    if (firstSipperFile)
                    {
                        startANewDir = true;
                    }

                    //else if   (sf.CruiseName != lastCruise)
                    //  startANewDir = true;

                    else if ((includeStationAndDeploymentInDirName) &&
                             ((sf.StationName != lastStation) || (sf.DeploymentNum != lastDeployment))
                             )
                    {
                        startANewDir = true;
                    }

                    if (startANewDir)
                    {
                        lastCruise     = sf.CruiseName;
                        lastStation    = sf.StationName;
                        lastDeployment = sf.DeploymentNum;
                        dirPath        = OSservices.AddSlash(DestinationDirectory.Text);

                        if (includeStationAndDeploymentInDirName)
                        {
                            if (!String.IsNullOrEmpty(lastCruise))
                            {
                                dirPath = OSservices.AddSlash(dirPath) + lastCruise;
                            }

                            if (!String.IsNullOrEmpty(lastStation))
                            {
                                dirPath = OSservices.AddSlash(dirPath) + lastStation;
                            }

                            if (!String.IsNullOrEmpty(lastDeployment))
                            {
                                dirPath = OSservices.AddSlash(dirPath) + lastDeployment;
                            }
                        }

                        OSservices.CreateDirectoryPath(dirPath);
                        imagesPerClass = new Dictionary <string, int> ();
                    }

                    SaveImagesForOneSipperFile(dirPath, sf, imagesPerClass);
                    firstSipperFile = false;
                }
            }
        } /* SaveImagesBySipperFiles */
예제 #12
0
        private void  AddSipperFiles(String[]  sipperFileNames)
        {
            if (sipperFileNames == null)
            {
                return;
            }

            String errorMsgs = "";

            foreach (String sfn in sipperFileNames)
            {
                String          rootName = OSservices.GetRootName(sfn);
                PicesSipperFile sf       = DbConn().SipperFileRecLoad(rootName);
                if (sf != null)
                {
                    if (errorMsgs.Length > 0)
                    {
                        errorMsgs += "\n";
                    }
                    errorMsgs += "File[" + rootName + "] already in DataBase;  Cruise[" + sf.CruiseName + "]  Station[" + sf.StationName + "]  Deployment[" + sf.DeploymentNum + "]";
                }
            }
            if (errorMsgs.Length > 0)
            {
                MessageBox.Show("The following errors occurred" + "\n" + "\n" + errorMsgs + "\n", "Add Sipper Files Failed.");
            }
            else
            {
                foreach (String sfn in sipperFileNames)
                {
                    String          rootName      = OSservices.GetRootName(sfn);
                    PicesSipperFile newSipperFile = new PicesSipperFile(rootName);
                    newSipperFile.CruiseName    = deployment.CruiseName;
                    newSipperFile.StationName   = deployment.StationName;
                    newSipperFile.DeploymentNum = deployment.DeploymentNum;

                    SipperConfigRec config = new SipperConfigRec();
                    newSipperFile.Sp0 = config.HeaderRec().SerialPortShortName(0);
                    newSipperFile.Sp1 = config.HeaderRec().SerialPortShortName(1);
                    newSipperFile.Sp2 = config.HeaderRec().SerialPortShortName(2);
                    newSipperFile.Sp3 = config.HeaderRec().SerialPortShortName(3);
                    if (String.IsNullOrEmpty(newSipperFile.Sp0))
                    {
                        newSipperFile.Sp0 = "CTD";
                        newSipperFile.Sp1 = "P-R";
                        newSipperFile.Sp2 = "BAT";
                        newSipperFile.Sp3 = "";
                    }

                    newSipperFile.CtdExt0 = config.HeaderRec().CtdExt0Code();
                    newSipperFile.CtdExt1 = config.HeaderRec().CtdExt1Code();
                    newSipperFile.CtdExt2 = config.HeaderRec().CtdExt2Code();
                    newSipperFile.CtdExt3 = config.HeaderRec().CtdExt3Code();

                    if (String.IsNullOrEmpty(newSipperFile.CtdExt0))
                    {
                        newSipperFile.CtdExt1 = "TRN";
                        newSipperFile.CtdExt1 = "OXG";
                        newSipperFile.CtdExt2 = "FLO";
                        newSipperFile.CtdExt3 = "TUR";
                    }
                    DbConn().SipperFileInsert(newSipperFile);
                    if (!DbConn().Valid())
                    {
                        MessageBox.Show("Error occurred adding SipperFile[" + rootName + "]" + "\n\n" + DbConn().LastErrorDesc());
                        break;
                    }
                }
                PopulateScreen();
            }
        } /* AddSipperFiles */
예제 #13
0
        private void  ExtractDataFromSIPPERFile(String sipperFileName)
        {
            PicesRunLog   runLog = new PicesRunLog();
            PicesDataBase db     = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            PicesSipperFile sf = null;

            if (db == null)
            {
                sf     = new PicesSipperFile(sipperFileName);
                sf.Sp0 = configRec.HeaderRec().SerialPortShortName(0);
                sf.Sp1 = configRec.HeaderRec().SerialPortShortName(1);
                sf.Sp2 = configRec.HeaderRec().SerialPortShortName(2);
                sf.Sp3 = configRec.HeaderRec().SerialPortShortName(3);

                sf.CtdExt0 = configRec.HeaderRec().CtdExt0Code();
                sf.CtdExt1 = configRec.HeaderRec().CtdExt1Code();
                sf.CtdExt2 = configRec.HeaderRec().CtdExt2Code();
                sf.CtdExt3 = configRec.HeaderRec().CtdExt3Code();
            }
            else
            {
                sf = db.SipperFileRecLoad(OSservices.GetRootName(sipperFileName));
                if (sf == null)
                {
                    return;
                }
            }

            byte ctdSensorNum    = 0;
            byte pitchAndRollNum = 1;

            switch (sf.Sp0)
            {
            case  "CTD": ctdSensorNum = 16;  break;

            case  "P-R": pitchAndRollNum = 16;  break;
            }

            switch (sf.Sp1)
            {
            case  "CTD": ctdSensorNum = 17;  break;

            case  "P-R": pitchAndRollNum = 17;  break;
            }

            switch (sf.Sp2)
            {
            case  "CTD": ctdSensorNum = 18;  break;

            case  "P-R": pitchAndRollNum = 18;  break;
            }

            switch (sf.Sp3)
            {
            case  "CTD": ctdSensorNum = 19;  break;

            case  "P-R": pitchAndRollNum = 19;  break;
            }

            BinaryReader fs = null;

            try { fs = new BinaryReader(new FileStream(sipperFileName, FileMode.Open, FileAccess.Read, FileShare.Read)); }
            catch (Exception)  { fs = null; }
            if (fs == null)
            {
                return;
            }

            BuildDecodeRecs();

            bool   eof = false;
            ushort rec = 0;

            try  { rec = fs.ReadUInt16(); }  catch (Exception)  { eof = true; }
            while (!eof)
            {
                Sipper3DecodeRec dr = decodeRecs[rec];
                if (!dr.ImageData())
                {
                    if (dr.SensorNum() == ctdSensorNum)
                    {
                        AddToCTDData(dr.SensorData());
                    }

                    else if (dr.SensorNum() == pitchAndRollNum)
                    {
                        AddToPitchAndRollData(dr.SensorData());
                    }
                }


                try  { rec = fs.ReadUInt16(); }  catch (Exception)  { eof = true; }
            }
        } /* ExtractDataFromSIPPERFile */
예제 #14
0
        } /* FilterListFirImageFiles */

        private void  ImportImagesFromDirectoryStructure(PicesDataBase threadConn,
                                                         String dirName
                                                         )
        {
            runLog.Writeln("Dir[" + dirName + "]" + "\n");

            String[] fileNames = null;
            try  { fileNames = Directory.GetFiles(dirName); }
            catch (Exception e)
            {
                runLog.Writeln("\n" + "Error retrieving file info for Directory[" + dirName + "]" + "\n");
                runLog.Writeln("Exception[" + e.ToString() + "]" + "\n\n");
                fileNames = null;
            }

            if (fileNames != null)
            {
                fileNames = FilterListForImageFiles(fileNames);
            }

            if (fileNames != null)
            {
                String sipperFileName = cruiseName + stationName + deploymentNum + "-" + OSservices.GetRootName(dirName);

                sipperFile               = new PicesSipperFile(sipperFileName);
                sipperFile.CruiseName    = cruiseName;
                sipperFile.StationName   = stationName;
                sipperFile.DeploymentNum = deploymentNum;
                threadConn.SipperFileInsert(sipperFile);

                int numThisDir       = 0;
                int numFailedThisDir = 0;
                foreach (String fn in fileNames)
                {
                    String ext = OSservices.GetFileExtension(fn).ToLower();
                    if ((ext == "bmp") || (ext == "jpg"))
                    {
                        numThisDir++;
                        bool successful = false;
                        ImportImage(threadConn, sipperFileName, fn, ref successful);
                        if (!successful)
                        {
                            ++numFailedThisDir;
                        }

                        if ((numThisDir % 100) == 0)
                        {
                            runLog.Writeln("Dir[" + dirName + "]  Files Updated[" + numThisDir.ToString("###,##0") + "]" + "\n");
                        }
                    }
                    if (cancelImporting)
                    {
                        break;
                    }
                }

                runLog.Writeln("Dir[" + dirName + "]  Files Updated[" + numThisDir.ToString("###,##0") + "]" + "\n");
                totalImagesUpdated += numThisDir;
            }

            if (!cancelImporting)
            {
                String[] directories = null;
                try { directories = Directory.GetDirectories(dirName); }
                catch (Exception) { directories = null; }

                if (directories != null)
                {
                    foreach (String subDir in directories)
                    {
                        if ((subDir == ".") || (subDir == ".."))
                        {
                            continue;
                        }
                        ImportImagesFromDirectoryStructure(threadConn, subDir);
                        if (cancelImporting)
                        {
                            break;
                        }
                    }
                }
            }
        } /* ImportImagesFromDirectoryStructure */
        } /* ProcessSipperFiles*/

        void  ProcessSipperFile(String sfn)
        {
            PicesSipperFile sipperFile = dbConn.SipperFileRecLoad(sfn);

            if (sipperFile == null)
            {
                RunLogAddMsg("\n\n  ***ERROR***      Sipper File[" + sfn + "]  not defined in database.\n\n");
                return;
            }

            if (instrumentDataFileManager == null)
            {
                instrumentDataFileManager = new PicesInstrumentDataFileManager();
            }
            PicesInstrumentDataList data = instrumentDataFileManager.ReExtractInstrumentDataForSipperFile(sfn, sipperFile, runLog);

            if (cancelRequested)
            {
                return;
            }

            if (data == null)
            {
                RunLogAddMsg("\n\n ***ERROR***  Sipper File[" + sfn + "] returned no Instrument Data.\n\n");
                return;
            }

            RunLogAddMsg("Saving Instrument Data;  SipperFileName[" + sfn + "].\n");
            dbConn.InstrumentDataSaveListForOneSipperFile(sfn, data);

            if (cancelRequested)
            {
                return;
            }

            uint lastScanLine = 0;
            {
                RunLogAddMsg("Updating Images Table;  SipperFileName[" + sfn + "].\n");
                int c1 = 0;

                foreach (PicesInstrumentData id in data)
                {
                    if (cancelRequested)
                    {
                        break;
                    }

                    if (id.ScanLine > 0)
                    {
                        dbConn.ImageUpdateInstrumentDataFields(id, sfn, lastScanLine, id.ScanLine);
                    }
                    lastScanLine = id.ScanLine;

                    c1++;
                    if ((c1 % 25) == 0)
                    {
                        RunLogAddMsg("Updating Images Table;  SipperFileName[" + sfn + "]   ScanLine[" + lastScanLine.ToString("###,###,##0") + "]\n");
                    }
                }
            }
        } /* ProcessSipperFile*/
예제 #16
0
        public ImageViewer(PicesRaster _raster,
                           PicesDataBaseImage _image,
                           PicesClassList _classes
                           )
        {
            runLog  = new PicesRunLog();
            raster  = _raster;
            classes = _classes;
            dbConn  = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
            image   = _image;

            sizeCoordinates = image.SizeCoordinates;

            if (raster == null)
            {
                raster = PicesRaster.GetOrigSipperImage(image.SipperFileName,
                                                        image.ByteOffset,
                                                        image.TopLeftRow,
                                                        image.TopLeftCol,
                                                        image.Height,
                                                        image.Width,
                                                        image.ConnectedPixelDist,
                                                        runLog
                                                        );
            }

            if (raster == null)
            {
                MessageBox.Show("Could not locate source image or SipperFile[" + image.SipperFileName + "]");
                return;
            }

            {
                uint scanLine = image.TopLeftRow;
                scanLine       = 4096 * (uint)(scanLine / 4096);
                instrumentData = dbConn.InstrumentDataGetByScanLine(image.SipperFileName, image.TopLeftRow);
                sipperFile     = dbConn.SipperFileRecLoad(image.SipperFileName);
            }

            double pixelsPerScanLine = pixelsPerScanLineDefault;


            if (instrumentData != null)
            {
                if (instrumentData.ActiveColumns > 0)
                {
                    pixelsPerScanLine = instrumentData.ActiveColumns;
                }
                if (instrumentData.FlowRate1 > 0.0)
                {
                    flowRate1 = instrumentData.FlowRate1;
                }
            }

            if (sipperFile != null)
            {
                if (sipperFile.ScanRate > 0.0)
                {
                    scanRate = sipperFile.ScanRate;
                }
                deployment = dbConn.SipperDeploymentLoad(sipperFile.CruiseName, sipperFile.StationName, sipperFile.DeploymentNum);
                if (deployment != null)
                {
                    chamberWidth = deployment.ChamberWidth;
                }
            }

            if ((dataFieldAssignments == null) || (DataLabels == null))
            {
                ConfigurationLoad();
            }

            InitializeComponent();
            if (image != null)
            {
                extractionLogEntry = dbConn.LogEntriesSelect(image.ExtractionLogEntryId);
                classLogEntry      = dbConn.LogEntriesSelect(image.ClassLogEntryId);
            }

            mmPerPixelAccrossChamber = chamberWidth * mmPerMeter / pixelsPerScanLine;
            mmPerPixelWithFlow       = mmPerMeter * flowRate1 / scanRate;

            DataLabels    = new Label[4];
            DataLabels[0] = DataLabel0;
            DataLabels[1] = DataLabel1;
            DataLabels[2] = DataLabel2;
            DataLabels[3] = DataLabel3;

            displayDataFields    = new TextBox[4];
            displayDataFields[0] = DataField0;
            displayDataFields[1] = DataField1;
            displayDataFields[2] = DataField2;
            displayDataFields[3] = DataField3;

            UpdateDataFields();

            ImageFileName.Text = image.ImageFileName;
        }
예제 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstrumentDataManager"/> class.
        /// </summary>
        /// <param name="_dataLogger">The _data logger.</param>
        /// <param name="_sipperFile">The _sipper file.</param>
        /// <param name="_configRec">The _config rec.</param>
        /// <param name="_currentDataRow">The _current data row.</param>
        public InstrumentDataManager(InstrumentDataLogger _dataLogger,             // Will take ownership of '_dataLogger'
                                     PicesSipperFile _sipperFile,
                                     SipperConfigRec _configRec,
                                     InstrumentData _currentDataRow
                                     )
        {
            dataLogger = _dataLogger;
            configRec  = _configRec;
            sipperFile = _sipperFile;

            portAssignments = null;

            if (sipperFile != null)
            {
                portAssignments = new PortAssignment[4];

                if (String.IsNullOrEmpty(sipperFile.Sp0))
                {
                    portAssignments[0] = null;
                }
                else
                {
                    portAssignments[0] = new PortAssignment(sipperFile.Sp0, "");
                }

                if (String.IsNullOrEmpty(sipperFile.Sp1))
                {
                    portAssignments[1] = null;
                }
                else
                {
                    portAssignments[1] = new PortAssignment(sipperFile.Sp1, "");
                }

                if (String.IsNullOrEmpty(sipperFile.Sp2))
                {
                    portAssignments[2] = null;
                }
                else
                {
                    portAssignments[2] = new PortAssignment(sipperFile.Sp2, "");
                }

                if (String.IsNullOrEmpty(sipperFile.Sp3))
                {
                    portAssignments[3] = null;
                }
                else
                {
                    portAssignments[3] = new PortAssignment(sipperFile.Sp3, "");
                }
            }
            else
            {
                portAssignments = configRec.HeaderRec().PortAssignments();
            }

            reporters = new InstrumentDataReport[MaxNumOfDevices];

            currentDataRow = _currentDataRow;

            byte deviceId = 0;

            for (deviceId = 0; deviceId < MaxNumOfDevices; deviceId++)
            {
                reporters[deviceId] = null;

                if (deviceId >= SerialPort0DeviceID)
                {
                    byte serialPort = (byte)(deviceId - SerialPort0DeviceID);
                    if (serialPort < portAssignments.Length)
                    {
                        if (portAssignments[serialPort] != null)
                        {
                            reporters[deviceId] = portAssignments[serialPort].Instrument().CreateInstrumentDataReport(this, deviceId);
                        }
                    }
                }
            }

            InitializeLatitude();
        }