예제 #1
0
        public ChartSizeDistribution(String _cruise,
                                     String _station,
                                     String _deployment,
                                     PicesClass _classToPlot,
                                     PicesClassList _classes,
                                     PicesClassList _activeClasses,
                                     String _rootDir
                                     )
        {
            cruise        = _cruise;
            station       = _station;
            deployment    = _deployment;
            classToPlot   = _classToPlot;
            classes       = _classes;
            activeClasses = _activeClasses;
            rootDir       = _rootDir;

            lastSaveDirectory = OSservices.AddSlash(PicesSipperVariables.PicesReportDir()) + "AbundanceReports";

            statusMsgs = new PicesMsgQueue("ChartSizeDistribution-StatusMsgs");
            msgQueue   = new PicesMsgQueue("ChartSizeDistribution-RunLog");
            runLog     = new PicesRunLog(msgQueue);

            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "ChartSizeDistribution.cfg";

            InitializeComponent();
        }
예제 #2
0
        public ChartAbundanceByDeployment(String _cruise,
                                          String _station,
                                          String _deployment,
                                          PicesClass _classToPlot,
                                          int _sizeMin,
                                          int _sizeMax,
                                          float _probMin,
                                          float _probMax,
                                          float _depthMin,
                                          float _depthMax,
                                          char _classKeyToUse,
                                          PicesClassList _classes,
                                          PicesClassList _activeClasses,
                                          String _rootDir
                                          )
        {
            cruise        = _cruise;
            station       = _station;
            deployment    = _deployment;
            classToPlot   = _classToPlot;
            sizeMin       = _sizeMin;
            sizeMax       = _sizeMax;
            probMin       = _probMin;
            probMax       = _probMax;
            depthMin      = _depthMin;
            depthMax      = _depthMax;
            classKeyToUse = _classKeyToUse;
            classes       = _classes;
            activeClasses = _activeClasses;
            rootDir       = _rootDir;

            if ((sizeMin > 0) && (sizeMax <= 0))
            {
                sizeMax = int.MaxValue;
            }
            if ((probMin >= 0.0f) && (probMax <= 0.0f))
            {
                probMax = 1.0f;
            }
            if ((depthMin > 0.0f) && (depthMax <= 0.0f))
            {
                depthMax = float.MaxValue;
            }

            filterSize  = (sizeMin > 0) || ((sizeMax > 0) && (sizeMax > sizeMin));
            filterProb  = ((probMin > 0.0f) || (probMax < 1.0f)) && (probMax > probMin);
            filterDepth = ((depthMax > 0) && (depthMax > depthMin));

            statusMsgs = new PicesMsgQueue("ChartAbundanceByDeployment-StatusMsgs");
            msgQueue   = new PicesMsgQueue("ChartAbundanceByDeployment-RunLog");
            runLog     = new PicesRunLog(msgQueue);

            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "ChartAbundanceByDeployment.cfg";

            BuildCriteriaString();

            InitializeComponent();
        }
예제 #3
0
        } /* ImageEntry */



        private void  HarvestImages()
        {
            PicesDataBase.ThreadInit();
            harvestingRunning   = true;
            harvestingCompleted = false;

            PicesDataBase threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            List <ImageEntry> allImages = null;

            List <ImageEntry>[] imagesByDepth    = null;
            double[]            depthTimeProfile = null;
            double[]            fracPartByDepth  = null;
            List <ImageEntry>   randDistByDepth  = null;

            //if  (!cbOilDeployments.Checked)
            allImages = LoadAllImages(threadConn);
            //else
            //  allImages = LoadOilDeploymentImages();

            if (!cancelHarvesting)
            {
                if (weight)
                {
                    depthTimeProfile = LoadDepthTimeProfile(threadConn);
                    if (!cancelHarvesting)
                    {
                        imagesByDepth   = DeriveImagesByDepth(allImages, depthTimeProfile.Length);
                        fracPartByDepth = DeriveFracPartByDepth(depthTimeProfile, imagesByDepth);

                        randDistByDepth = DeriveRandomDistByDepth(imagesByDepth, fracPartByDepth);
                        harvestedImages = GetDatabaseImageRecords(threadConn, randDistByDepth);
                        UpdateImageGroupTables(threadConn, harvestedImages);

                        RunLogAddMsg("\n" + "Harvesting Completed Successfully." + "\n");
                    }
                }
                else
                {
                    harvestedImages = DeriveRandomDistribution(threadConn, allImages);
                    if (!cancelHarvesting)
                    {
                        UpdateImageGroupTables(threadConn, harvestedImages);
                    }
                }

                if (!cancelHarvesting)
                {
                    harvestingCompleted = true;
                }
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();

            PicesDataBase.ThreadEnd();
            harvestingRunning = false;
        } /* HarvestImages */
예제 #4
0
        } /* LoadImagesForOneSipperFile */

        private void  LoadImagesThread()
        {
            blocker.StartBlock();
            loaderThreadRuning = true;
            PicesDataBase.ThreadInit();
            blocker.EndBlock();

            dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            allSipperFiles = (String.IsNullOrEmpty(cruiseName) &&
                              String.IsNullOrEmpty(stationName) &&
                              String.IsNullOrEmpty(deploymentNum) &&
                              String.IsNullOrEmpty(sipperFileName)
                              );

            if (!String.IsNullOrEmpty(sipperFileName))
            {
                sipperFileNames    = new String[1];
                sipperFileNames[0] = sipperFileName;
            }
            else
            {
                sipperFileNames = dbConn.SipperFileGetList(cruiseName, stationName, deploymentNum);
            }

            if (selectedImageGroup != null)
            {
                LoadImagesForSelectedGroup();
            }
            else
            {
                if (sipperFileNames != null)
                {
                    for (curSipperFileIdx = 0; (curSipperFileIdx < sipperFileNames.Length) && (!cancelRequested); curSipperFileIdx++)
                    {
                        LoadImagesForOneSipperFile(sipperFileNames[curSipperFileIdx]);
                    }
                }
            }

            blocker.StartBlock();
            if (!cancelRequested)
            {
                doneLoading = true;
            }
            loaderThreadRuning = false;
            blocker.EndBlock();

            if (completionEvent != null)
            {
                completionEvent(this);
            }

            dbConn.Close();
            dbConn = null;
            GC.Collect();

            PicesDataBase.ThreadEnd();
        } /* LoadImagesTread */
예제 #5
0
 private PicesDataBase  DbConn()
 {
     if (dbConn == null)
     {
         weOwnDbConn = true;
         dbConn      = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
     }
     return(dbConn);
 }
예제 #6
0
        /// <summary>
        /// Using supplied 'Raster' data it will call each currently active model and return there predictions.
        /// </summary>
        /// <param name="raster">Raster of image to predict. .</param>
        /// <param name="instrumentData">Instrument data that was recorded with the 'raster' .</param>
        /// <param name="imageFileName">Name of the image file.</param>
        /// <param name="model1Predictions">The model1 predictions.</param>
        /// <param name="model2Predictions">The model2 predictions.</param>
        /// <param name="runLog">The run log.</param>
        public static void  MakePredictions(PicesRaster raster,
                                            InstrumentData instrumentData,
                                            String imageFileName,
                                            ref PicesPredictionList model1Predictions,
                                            ref PicesPredictionList model2Predictions,
                                            PicesRunLog runLog
                                            )
        {
            model1Predictions = null;
            model2Predictions = null;
            if (!ModelsAreAvailable())
            {
                return;
            }

            ParsedImageFileName pifn = PicesFeatureVector.ParseImageFileName(imageFileName);
            String sipperFileName    = pifn.sipperFileName;
            uint   scanLineNum       = pifn.scanLineNum;

            PicesFeatureVector fv = new PicesFeatureVector(raster, imageFileName, null, runLog);

            if (instrumentData != null)
            {
                fv.AddInstrumentData(instrumentData.Depth(),
                                     instrumentData.Salinity(),
                                     instrumentData.Oxygen(),
                                     instrumentData.Fluorescence()
                                     );
            }
            else
            {
                PicesDataBase       dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
                PicesInstrumentData pid    = dbConn.InstrumentDataGetByScanLine(sipperFileName, scanLineNum);
                if (pid != null)
                {
                    fv.AddInstrumentData(pid);
                }
                pid = null;
                dbConn.Close();
                dbConn = null;
            }

            if (model1 != null)
            {
                model1Predictions = model1.PredictProbabilities(fv);
            }

            if (model2 != null)
            {
                model2Predictions = model2.PredictProbabilities(fv);
            }

            fv = null;

            return;
        } /* MakePredictions */
        } /* 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 */
예제 #8
0
        private List <String> imageFileErrorList = null;         // Will contain a list of Image File Names that could not be inserted.



        public ImportGroupAssignments()
        {
            runLogMsgQueue = new PicesMsgQueue("ImportGroupAssignemnts");
            runLog         = new PicesRunLog(runLogMsgQueue);
            mainWinConn    = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            InitializeComponent();

            SourceDirectory.Text = PicesSipperVariables.HomeDir();
        }
예제 #9
0
        private void GetRunTimeParameters_Load(object sender, EventArgs e)
        {
            LoadConfiguraionData();
            PicesDataBase dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            dbConn.SipperFileLoadOracle();

            dbConn.Close();
            dbConn = null;
        }
예제 #10
0
        } /* PerformUpdate */

        private void  UpdateProcess()
        {
            PicesDataBase.ThreadInit();
            updateRunning = true;

            PicesRunLog   updRunLog = new PicesRunLog();
            PicesDataBase updDbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(updRunLog);

            sipperFilesTotal   = 0;
            sipperFilesUpdated = 0;

            if (addingNewClass || deletingExistingClass || (mergeClass != null))
            {
                sipperFiles = updDbConn.SipperFileLoad("", "", "");
                if (sipperFiles == null)
                {
                    RunLogAddMsg("Could not retrieve list of SIPPER files update failed." + "\n");
                    updateRunning = false;
                    return;
                }
                sipperFilesTotal = sipperFiles.Count;
            }

            if (addingNewClass)
            {
                UpdateProcessAdd(updDbConn);
            }

            else if (deletingExistingClass)
            {
                UpdateProcessDelete(updDbConn);
            }

            else if (mergeClass != null)
            {
                UpdateProcessMerge(updDbConn);
            }

            else if (nameChangeHasOccured)
            {
                UpdateProcessNameChange(updDbConn);
            }

            else
            {
                UpdateDataFields(updDbConn);
            }

            updDbConn.Close();
            updDbConn = null;
            GC.Collect();

            PicesDataBase.ThreadEnd();
            updateRunning = false;
        } /* UpdateProcess */
        public PredictionBreakDownDisplayDual(PicesDataBase _dbConn,
                                              String _fileName,
                                              TrainingModel2 _trainingModel,
                                              PicesInstrumentData _instrumentData, /**<  Instrument data that goes with image,  if null will read from dtabase. */
                                              PicesRunLog _runLog
                                              )
        {
            if (_runLog == null)
            {
                runLog = new PicesRunLog();
            }
            else
            {
                runLog = _runLog;
            }

            fileName       = _fileName;
            instrumentData = _instrumentData;
            trainingModel  = _trainingModel;

            PicesDataBase dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
            PicesRaster   raster = dbConn.ImageFullSizeFind(fileName);

            if (raster == null)
            {
                return;
            }

            if (_dbConn != null)
            {
                dbFeatureVector = _dbConn.FeatureDataRecLoad(_fileName);
                if (instrumentData == null)
                {
                    PicesDataBaseImage image = dbConn.ImageLoad(fileName);
                    if (image != null)
                    {
                        instrumentData = dbConn.InstrumentDataGetByScanLine(image.SipperFileName, image.TopLeftRow);
                    }
                }
            }

            featureVector = new PicesFeatureVector(raster, fileName, null, runLog);

            if (instrumentData != null)
            {
                featureVector.AddInstrumentData(instrumentData);
            }

            dbConn.Close();
            dbConn = null;
            GC.Collect();

            InitializeComponent();
        }
예제 #12
0
        } /* EnableAllFields */

        private void ClassMaintenance_Load(object sender, EventArgs e)
        {
            lastHeight = Height;
            lastWidth  = Width;

            if (runLog == null)
            {
                runLog = new PicesRunLog();
            }
            mainDbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
            LoadClassesFromDataBase();
        }
예제 #13
0
        public ChartGPSByStation(String _stationName)
        {
            stationName = _stationName;

            statusMsgs = new PicesMsgQueue("ChartGPSByStation-StatusMsgs");
            msgQueue   = new PicesMsgQueue("ChartGPSByStation-RunLog");
            runLog     = new PicesRunLog(msgQueue);

            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "ChartGPSByStation.cfg";

            InitializeComponent();
        }
        } /* 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 */
예제 #15
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\\";
        }
예제 #16
0
파일: ChartGPS.cs 프로젝트: PalakDave/Pices
        } /* AddCruiseToSeries */

        /// <summary>
        /// This next method will be ran as a separate thread; it is responsible for collecting all the data needed to generate the plot.
        /// </summary>
        private void  BuildPlotData()
        {
            if (buildPlotDataRunning)
            {
                return;
            }

            PicesDataBase.ThreadInit();

            threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            buildPlotDataRunning = true;

            timeInterval = (int)TimeInterval.Value;

            series = new List <DataSeriesToPlot> ();
            foreach (PlotRequest pr in plotRequests)
            {
                if (cancelRequested)
                {
                    break;
                }
                AddDeploymentToSeries(pr.deployment, pr.color);
            }

            if (plotCruise && (!cancelRequested))
            {
                AddCruiseToSeries();
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();
            PicesDataBase.ThreadEnd();

            if (cancelRequested)
            {
                statusMsgs.AddMsg("Plotting of data CANCELLED!!!");
            }
            else
            {
                statusMsgs.AddMsg("Building of plot data completed !!!");
            }

            buildPlotDataRunning = false;
            buildPlotDataDone    = true;
        } /* BuildPlotData */
예제 #17
0
        } /* AddDeploymentToSeries */

        /// <summary>
        /// This method will be ran as a separate thread; it is responsible for collecting all the data needed to generate the plot.
        /// </summary>
        private void  BuildPlotData()
        {
            if (buildPlotDataRunning)
            {
                return;
            }

            PicesDataBase.ThreadInit();

            threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            buildPlotDataRunning = true;

            depthIncrement = (int)DepthIncr.Value;
            classToPlot    = PicesClassList.GetUniqueClass(ClassToPlot.Text, "");

            series = new List <DataSeriesToPlot> ();

            foreach (PlotRequest pr in plotRequests)
            {
                if (cancelRequested)
                {
                    break;
                }
                AddDeploymentToSeries(pr.deployment);
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();
            PicesDataBase.ThreadEnd();

            if (cancelRequested)
            {
                statusMsgs.AddMsg("Plotting of data CANCELLED!!!");
            }
            else
            {
                statusMsgs.AddMsg("Building of plot data completed !!!");
            }

            buildPlotDataRunning = false;
            buildPlotDataDone    = true;
        } /* BuildPlotData */
예제 #18
0
 private PicesDataBase  DbConn()
 {
     // I am locking errorMsgs because it is shared by all the classifier threads.
     lock (errorMsgs)
     {
         if (dbConn == null)
         {
             if (dbServer == null)
             {
                 dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(RunLog());
             }
             else
             {
                 dbConn = new PicesDataBase(dbServer, RunLog());
             }
         }
     }
     return(dbConn);
 }
예제 #19
0
        public AssignSelectedImagesToGroup(PicesDataBaseImageList _selImages,
                                           String _suggestedGroupName
                                           )
        {
            selImages = _selImages;
            InitializeComponent();
            GroupName.Text = CleanUpGroupName(_suggestedGroupName);

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

            if (selImages == null)
            {
                MessageBox.Show(this, "Assign Group to Selected Images", "There are no images currently selected.", MessageBoxButtons.OK);
                Close();
            }
        }
예제 #20
0
        public ImportImagesIntoDeployment(String _cruiseName,
                                          String _stationName,
                                          String _deploymentNum
                                          )
        {
            msgQueue = new PicesMsgQueue("ImportImagesIntoDeployment");
            runLog   = new PicesRunLog(msgQueue);

            cruiseName    = _cruiseName;
            stationName   = _stationName;
            deploymentNum = _deploymentNum;

            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            unknownClass = GetClassFromName(mainWinConn, "UnKnown");

            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "ImportImagesIntoDeployment.cfg";

            InitializeComponent();
            //SourceDirectory.Text = PicesSipperVariables.HomeDir ();
        }
예제 #21
0
        } /* ToCmdLine */

        private void  ImportImagesIntoDeploymentProcess()
        {
            importingRunning   = true;
            importingCompleted = false;

            PicesDataBase.ThreadInit();

            PicesRunLog   runLog     = new PicesRunLog();
            PicesDataBase threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            extractionLogEntryId = threadConn.LogEntriesProcessStart("II",
                                                                     "ImportImagesIntoDeployment",
                                                                     ExecutableDateTimeStamp(),
                                                                     ToCmdLine(),
                                                                     ""
                                                                     );
            totalImagesUpdated = 0;

            ImportImagesFromDirectoryStructure(threadConn, sourceDirectory);
            if (cancelImporting)
            {
                runLog.Writeln("\n" + "Importing Images has been Canceled." + "\n\n");
            }
            else
            {
                runLog.Writeln("\n\n" + "Total Images[" + totalImagesUpdated.ToString("###,##0") + "\n\n");
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();

            PicesDataBase.ThreadEnd();

            importingRunning   = false;
            importingCompleted = true;
        } /* ImportImagesIntoDeploymentProcess */
예제 #22
0
        public ChartSizeDepthDistribution(String _cruise,
                                          String _station,
                                          String _deployment,
                                          PicesClass _classToPlot,
                                          bool _includeSubClasses,
                                          char _statistic,
                                          String _cast,
                                          PicesImageSizeDistribution _sizeDistribution,
                                          int _selectedSizeBucket
                                          )
        {
            cruise            = _cruise;
            station           = _station;
            deployment        = _deployment;
            classToPlot       = _classToPlot;
            includeSubClasses = _includeSubClasses;
            cast               = _cast;
            statistic          = _statistic;
            sizeDistribution   = _sizeDistribution;
            selectedSizeBucket = _selectedSizeBucket;
            sizeStartValues    = sizeDistribution.SizeStartValues();
            sizeEndValues      = sizeDistribution.SizeEndValues();
            depthProfile       = sizeDistribution.DepthProfileForSizeBin((uint)selectedSizeBucket);
            volumeSampled      = sizeDistribution.VolumeSampledByDepthBucket();

            if ((selectedSizeBucket >= 0) && (selectedSizeBucket < sizeDistribution.NumSizeBuckets))
            {
                sizeStart = sizeStartValues[selectedSizeBucket];
                sizeEnd   = sizeEndValues  [selectedSizeBucket];
            }

            runLog = new PicesRunLog();

            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            InitializeComponent();
        }
예제 #23
0
        } /* MakePredictions */

        public static void  MakePredictions(PicesRaster raster,
                                            ref PicesPrediction model1Prediction1,
                                            ref PicesPrediction model1Prediction2,
                                            ref PicesPrediction model2Prediction1,
                                            ref PicesPrediction model2Prediction2,
                                            PicesRunLog runLog
                                            )
        {
            String imageFileName = raster.FileName;

            ParsedImageFileName pifn = PicesFeatureVector.ParseImageFileName(imageFileName);
            String sipperFileName    = pifn.sipperFileName;
            uint   scanLineNum       = pifn.scanLineNum;

            PicesFeatureVector fv = new PicesFeatureVector(raster, imageFileName, null, runLog);

            {
                PicesDataBase       dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
                PicesInstrumentData pid    = dbConn.InstrumentDataGetByScanLine(sipperFileName, scanLineNum);
                if (pid != null)
                {
                    fv.AddInstrumentData(pid);
                }
                pid = null;
                dbConn.Close();
                dbConn = null;
            }

            MakePredictions(fv,
                            ref model1Prediction1,
                            ref model1Prediction2,
                            ref model2Prediction1,
                            ref model2Prediction2,
                            runLog
                            );
            fv = null;
        }
예제 #24
0
        } /* ToCmdLine */

        private void  ImportValidatedClassAssignments()
        {
            importingRunning   = true;
            importingCompleted = false;

            PicesDataBase.ThreadInit();

            PicesRunLog   runLog     = new PicesRunLog();
            PicesDataBase threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            extractionLogEntryId = threadConn.LogEntriesProcessStart("IV",
                                                                     "ImportValidatedClass",
                                                                     ExecutableDateTimeStamp(),
                                                                     ToCmdLine(),
                                                                     OSservices.GetRootName(sipperFileName)
                                                                     );
            totalImagesUpdated = 0;

            ImportValidatedClassAssignmentsDir(threadConn, sourceDirectory);
            if (cancelImporting)
            {
                RunLogAddMsg("\n" + "Importing Assignments has been Canceled." + "\n\n");
            }
            else
            {
                RunLogAddMsg("\n\n" + "Total Images[" + totalImagesUpdated.ToString("###,##0") + "\n\n");
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();

            PicesDataBase.ThreadEnd();

            importingRunning   = false;
            importingCompleted = true;
        } /* ImportValidatedClassAssignments */
예제 #25
0
        } /* StartTheBackGroundProcedure */

        private void  BackGroundProcess()
        {
            backGroundRunning = true;

            PicesDataBase.ThreadInit();


            OSservices.CreateDirectoryPath(reportFileDir);

            DateTime n           = DateTime.Now;
            String   logFileName = OSservices.AddSlash(PicesSipperVariables.TempDirectory()) + "InstrumentDataByDeployment_Log_" +
                                   n.Year.ToString("0000") + "-" + n.Month.ToString("00") + "-" + n.Day.ToString("00") + "_" +
                                   n.Hour.ToString("00") + "-" + n.Minute.ToString("00") + "-" + n.Hour.ToString("00") +
                                   ".txt";

            backGroundLog = new PicesRunLog(logFileName);
            PicesDataBase threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(backGroundLog);

            RunLogAddMsg("Cruise           [" + cruiseName + "]" + "\n");
            RunLogAddMsg("Station          [" + stationName + "]" + "\n");
            RunLogAddMsg("Deployment       [" + deploymentNum + "]" + "\n");
            RunLogAddMsg("Start Date/Time  [" + DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss") + "]" + "\n");
            RunLogAddMsg("Active DataBase  [" + threadConn.Server.Description + "]" + "\n");

            PicesSipperDeploymentList deployments = null;

            if (!String.IsNullOrEmpty(deploymentNum))
            {
                PicesSipperDeployment d = threadConn.SipperDeploymentLoad(cruiseName, stationName, deploymentNum);
                if (d != null)
                {
                    deployments = new PicesSipperDeploymentList();
                    deployments.Add(d);
                }
            }
            else
            {
                deployments = threadConn.SipperDeploymentLoad(cruiseName, stationName);
            }

            if (deployments == null)
            {
                RunLogAddMsg("\n\nNo Deployments for Specified Criteria!\n\n");
                return;
            }

            int reportNum = 0;

            foreach (PicesSipperDeployment d in deployments)
            {
                if (cancelBackGround)
                {
                    break;
                }

                reportNum++;

                RunLogAddMsg("Generating Report " + reportNum.ToString() + " of " + deployments.Count.ToString());

                SummarizeInstrumentDataForADeployment(threadConn, d.CruiseName, d.StationName, d.DeploymentNum);
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();

            PicesDataBase.ThreadEnd();

            backGroundRunning = false;
        } /* BackGroundProcess */
예제 #26
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;
        }
예제 #27
0
        } /* StartTheHarvestingProcedure */

        private void  ImportAssignments()
        {
            PicesDataBase.ThreadInit();
            backGroundRunning   = true;
            backGroundCompleted = false;

            PicesDataBase threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            RunLogAddMsg("Source Directory [" + sourceDirectory + "]");
            RunLogAddMsg("Group Name       [" + groupName + "]");
            RunLogAddMsg("Start Date/Time  [" + DateTime.Now.ToString("yyyy-MMM-dd HH:mm:ss") + "]");
            RunLogAddMsg("Active DataBase  [" + threadConn.Server.Description + "]");

            importedFileNames = new List <String> ();

            group = threadConn.ImageGroupLoad(groupName);
            if (group != null)
            {
                // Group already exists;  will delete it.
                RunLogAddMsg("\n" + "Group[" + groupName + "] already exists.   Will remove and replace with new one." + "\n");

                threadConn.ImageGroupDelete(group.ImageGroupId);
            }

            group = new PicesDataBaseImageGroup(-1, groupName, groupDesc, 0);
            threadConn.ImageGroupInsert(group);

            ImportAssignmentsImportDir(sourceDirectory);
            if (cancelBackGround)
            {
                RunLogAddMsg("\n" + "Importing Assignments has been Canceled." + "\n");
            }
            else
            {
                RunLogAddMsg("\n\n" + "Total Images[" + importedFileNames.Count.ToString("###,##0") + "\n");

                RunLogAddMsg("Writing to DataBase Now" + "\n");

                imageFileErrorList = new List <string>();

                int numInserted = 0;

                for (int x = 0; (x < importedFileNames.Count) && (!cancelBackGround); x++)
                {
                    PicesDataBaseImageGroupEntry ige = new PicesDataBaseImageGroupEntry();
                    ige.ImageGroupId  = group.ImageGroupId;
                    ige.ImageFileName = importedFileNames[x];
                    threadConn.ImageGroupEntriesInsert(ige);
                    if (!threadConn.Valid())
                    {
                        imageFileErrorList.Add(importedFileNames[x]);
                        RunLogAddMsg("Image[" + importedFileNames[x] + "]  ***ERROR***");
                    }
                    else
                    {
                        numInserted++;
                    }

                    if ((x % 100) == 0)
                    {
                        RunLogAddMsg("Images Assigned[" + numInserted + "]  Failures[" + imageFileErrorList.Count + "]");
                    }
                }
            }

            threadConn.Close();
            threadConn = null;
            GC.Collect();
            PicesDataBase.ThreadEnd();

            backGroundRunning   = false;
            backGroundCompleted = true;
        } /* ImportAssignments */
예제 #28
0
 private void ReconcileImagesToDataBase_Load(object sender, EventArgs e)
 {
     runLog = new PicesRunLog();
     dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
 }
예제 #29
0
        } /* LoadGroups */

        private void GroupMaintenance_Load(object sender, EventArgs e)
        {
            dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
            LoadGroups();
        }
예제 #30
0
        } /* SizeDistributionForAClass */

        /// <summary>
        /// This method will be ran as a separate thread; it is responsible for collecting all the data needed to generate the plot.
        /// </summary>
        private void  BuildPlotData()
        {
            if (buildPlotDataRunning)
            {
                return;
            }

            PicesDataBase.ThreadInit();

            threadConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            buildPlotDataRunning = true;

            classToPlot = PicesClassList.GetUniqueClass(ClassToPlot.Text, "");

            sbyte ch = (sbyte)statistic;

            downCast = null;
            upCast   = null;

            goalie.StartBlock();

            SizeDistributionForAClass(classToPlot,
                                      IncludeSubClasses.Checked,
                                      ref downCast,
                                      ref upCast
                                      );

            if (cast == "Down")
            {
                bucketsDisplayed = downCast;
            }

            else if (cast == "Up")
            {
                bucketsDisplayed = upCast;
            }

            else
            {
                bucketsDisplayed = new PicesImageSizeDistribution(downCast);
                bucketsDisplayed.AddIn(upCast, runLog);
            }

            integratedDensityDistribution = bucketsDisplayed.IntegratedDensityDistribution();

            threadConn.Close();
            threadConn = null;
            GC.Collect();
            PicesDataBase.ThreadEnd();

            goalie.EndBlock();

            if (cancelRequested)
            {
                statusMsgs.AddMsg("Plotting of data CANCELLED!!!");
            }
            else
            {
                statusMsgs.AddMsg("Building of plot data completed !!!");
            }

            buildPlotDataRunning = false;
            buildPlotDataDone    = true;
        } /* BuildPlotData */