Example #1
0
        } /* DeriveRandomDistByDepth */

        private PicesDataBaseImageList  GetDatabaseImageRecords(PicesDataBase threadConn,
                                                                List <ImageEntry> images
                                                                )
        {
            RunLogAddMsg("Extracting Images from the database." + "\n");
            PicesDataBaseImageList dataBaseImages = new PicesDataBaseImageList();

            foreach (ImageEntry ie  in  images)
            {
                if (cancelHarvesting)
                {
                    break;
                }

                PicesDataBaseImage dbi = threadConn.ImageLoad(ie.imageId);
                if (dbi == null)
                {
                    RunLogAddMsg("GetDatabaseImageRecords   ***ERROR***   Could not get ImageId[" + ie.imageId + "]" + "\n");
                }
                else
                {
                    dataBaseImages.Add(dbi);
                    if ((dataBaseImages.Count % 100) == 0)
                    {
                        RunLogAddMsg("Images Extracted " + dataBaseImages.Count + " of " + images.Count + "\n");
                    }
                }
            }

            return(dataBaseImages);
        } /* GetDatabaseImageRecords */
Example #2
0
        private void  LoadImageDepthStats(PicesDataBase threadConn,
                                          String cruiseName,
                                          String stationName,
                                          String deploymentNum,
                                          ref List <ImagesDepthStats> downCast,
                                          ref List <ImagesDepthStats> upCast
                                          )
        {
            String sqlStr = "call ImagesStatsByUpAndDownCast(";

            sqlStr += "\"" + cruiseName + "\"" + ", ";
            sqlStr += "\"" + stationName + "\"" + ", ";
            sqlStr += "\"" + deploymentNum + "\"" + ", ";
            if (mlClass == null)
            {
                sqlStr += "\"\", ";
            }
            else
            {
                sqlStr = "\"" + mlClass.Name + "\"" + ", ";
            }
            sqlStr += "1.0);";

            downCast = null;
            upCast   = null;

            String[]   cols    = { "UpCast", "BucketIdx", "BucketDepth", "ImageCount", "TotalPixelCount" };
            String[][] results = threadConn.QueryStatement(sqlStr, cols);

            if (results == null)
            {
                RunLogAddMsg("Error Retrieving Images Cout Statistics.");
                RunLogAddMsg(threadConn.LastErrorDesc());
                return;
            }

            downCast = new List <ImagesDepthStats> ();
            upCast   = new List <ImagesDepthStats> ();

            foreach (String[] row in results)
            {
                bool  goingUp         = (row[0] == "1");
                int   bucketIdx       = PicesKKStr.StrToInt(row[1]);
                float bucketDepth     = PicesKKStr.StrToFloat(row[2]);
                int   imageCount      = PicesKKStr.StrToInt(row[3]);
                int   totalPixelCount = PicesKKStr.StrToInt(row[4]);

                ImagesDepthStats stats = new ImagesDepthStats(goingUp, bucketIdx, bucketDepth, imageCount, totalPixelCount);
                if (!goingUp)
                {
                    downCast.Add(stats);
                }
                else
                {
                    upCast.Add(stats);
                }
            }

            return;
        } /* LoadImageDepthStats */
Example #3
0
        } /* WriteTabDelToStream */

        private void ChartAbundanceByDeployment_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (buildPlotDataRunning)
            {
                if (e.CloseReason == CloseReason.WindowsShutDown)
                {
                    CancelBackGroundThread();
                    while (buildPlotDataRunning)
                    {
                        Thread.Sleep(100);
                    }
                }
                else
                {
                    MessageBox.Show(this, "Plot data is being collected; press \"Cancel Button\" to Stop before exiting.", "Form Closing", MessageBoxButtons.OK);
                    e.Cancel = true;
                    return;
                }
            }

            SaveConfiguration();

            mainWinConn.Close();
            mainWinConn = null;
            GC.Collect();
        }
        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();
        }
Example #5
0
        } /* UpdateProcessDelete */

        private void  UpdateProcessMerge(PicesDataBase updDbConn)
        {
            RunLogAddMsg("Merging Class [" + selectedClass.Name + "]  into [" + mergeClass.Name + "]" + "\n");
            // First:   Update the Images table.
            // Second:  Update Classes table.

            String sqlCmd = "Call MLClassMergeComprehensive (" + "\"" + selectedClass.Name + "\"" + ", " +
                            "\"" + mergeClass.Name + "\"" +
                            ")";

            updDbConn.QueryStatement(sqlCmd, null);

            PicesClassList.UpdateParent(mergeClass, selectedClass);

            if (mergeClass.Parent != null)
            {
                if (mergeClass.Parent.Children != null)
                {
                    mergeClass.Parent.Children.Remove(mergeClass);
                }
            }
            selectedClass.StoredOnDataBase = false;

            selectedClass = mergeClass;
        } /* UpdateProcessMerge */
Example #6
0
        private void  UpdateProcessDelete(PicesDataBase updDbConn)
        {
            RunLogAddMsg("Deleting Class[" + selectedClass.Name + "]" + "\n");
            // Go through each sipper file and change the class name in there related Images table entries.

            TimeSpan startProcessTime = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;

            PicesDataBaseLogEntry logEntry =
                updDbConn.LogEntriesProcessStart("DL",
                                                 "ClassMaintenanceDelete",
                                                 ExecutableDateTimeStamp(),
                                                 "ClassMaintenance::UpdateProcessDelete " + selectedClass.Name,
                                                 ""
                                                 );

            String sqlCmd = "Call MLClassDeleteComprehensive (\"" + selectedClass.Name + "\")";

            updDbConn.QueryStatement(sqlCmd, null);

            PicesClassList.UpdateParent(selectedClass, selectedClass.Parent);

            if (selectedClass.Parent != null)
            {
                if (selectedClass.Parent.Children != null)
                {
                    selectedClass.Parent.Children.Remove(mergeClass);
                }
            }

            TimeSpan endProcessTime = System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;

            updDbConn.LogEntriesProcessEnd(logEntry, (float)((startProcessTime - endProcessTime).TotalSeconds), "Done");

            selectedClass.StoredOnDataBase = false;
        } /* UpdateProcessDelete */
        } /* StartProcessingThread */

        private void  Processing()
        {
            processingThreadRunning = true;
            PicesDataBase.ThreadInit();

            RunLogAddMsg("Retrieving list of SIPPER Files\n");

            dbConn.CancelFlag = false;

            String[] sipperFileNames = null;
            if (String.IsNullOrEmpty(sipperFileName))
            {
                sipperFileNames = dbConn.SipperFileGetList(cruise, station, deployment);
            }
            else
            {
                sipperFileNames    = new String[1];
                sipperFileNames[0] = sipperFileName;
            }

            if (sipperFileNames == null)
            {
                RunLogAddMsg("\n\n  ***ERROR***   Not SIPPETR files names were returned.\n\n");
            }
            else
            {
                ProcessSipperFiles(sipperFileNames);
            }

            PicesDataBase.ThreadEnd();
            processingThreadCompleted = true;
            processingThreadRunning   = false;
        } /* Processing */
Example #8
0
        public DisplayPicesImages(PicesDataBase _dbConn,
                                  PicesImageSizeDistribution _sizeDistribution,
                                  int _selectedSizeIndex,
                                  float _depthMin,
                                  float _depthMax,
                                  PicesDataBaseImageList _picesImages
                                  )
        {
            InitializeComponent();
            thumbNails = new List <FlowLayoutPanel> ();

            dbConn            = _dbConn;
            sizeDistribution  = _sizeDistribution;
            picesImages       = _picesImages;
            selectedSizeIndex = _selectedSizeIndex;
            depthMin          = _depthMin;
            depthMax          = _depthMax;

            float[] startValues = sizeDistribution.SizeStartValues();
            float[] endValues   = sizeDistribution.SizeEndValues();

            if ((selectedSizeIndex >= 0) && (selectedSizeIndex < startValues.Length))
            {
                String t = "Size Range [" + startValues[selectedSizeIndex].ToString("###,##0.000") + " - " + endValues[selectedSizeIndex].ToString("#,###,##0.000") + "]";
                if (depthMax > 0.0f)
                {
                    t = t + "   Depth Range [" + depthMin.ToString("##0.0") + " - " + depthMax.ToString("##0.0") + "]";
                }
                Text = t;
            }

            UpdateDisplayTimer.Enabled = true;
        }
Example #9
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();
        }
        private void ReconcileImagesToDataBase_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (reconcilingRunning)
            {
                if (e.CloseReason == CloseReason.UserClosing)
                {
                    DialogResult dr = MessageBox.Show(this, "Reconciliation Process is still running!   Cancel Process Yes/No ?", "Cancel Reconciliation", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.No)
                    {
                        e.Cancel = true;
                        return;
                    }
                }

                formIsClosing = true;
                CancelRecondiliationThread();

                if (dbConn != null)
                {
                    dbConn.Close();
                    dbConn = null;
                    GC.Collect();
                }
            }
        }
Example #11
0
        PlanktonClassStatisticsLoader statsLoader = null; // To determine total number of images that will be saved.


        public SavePlanktonData(PicesDataBase _dbConn,
                                PicesDataBaseImageGroup _group,
                                String _cruise,
                                String _station,
                                String _deployment,
                                String _sipperFileName,
                                PicesClass _mlClass,
                                char _classKeyToUse,
                                float _probMin,
                                float _probMax,
                                int _sizeMin,
                                int _sizeMax,
                                float _depthMin,
                                float _depthMax
                                )
        {
            dbConn         = _dbConn;
            group          = _group;
            cruise         = (_cruise == null) ? "" : _cruise;
            station        = (_station == null) ? "" : _station;
            deployment     = (_deployment == null) ? "" : _deployment;
            sipperFileName = (_sipperFileName == null) ? "" : _sipperFileName;
            mlClass        = _mlClass;
            classKeyToUse  = _classKeyToUse;

            probMin  = _probMin;
            probMax  = _probMax;
            sizeMin  = _sizeMin;
            sizeMax  = _sizeMax;
            depthMin = _depthMin;
            depthMax = _depthMax;

            runLog = new PicesRunLog();
            InitializeComponent();
        }
Example #12
0
        private void  SaveImages()
        {
            PicesDataBase.ThreadInit();
            savingThreadRunning   = true;
            imagesSaved           = 0;
            imagesFailedToExtract = 0;

            if (images != null)
            {
                SaveGivenImageList();
            }

            else if (group != null)
            {
                SaveImagesByGroup();
            }

            else
            {
                SaveImagesBySipperFiles();
            }

            savingThreadCompleted = true;
            savingThreadRunning   = false;
            PicesDataBase.ThreadEnd();
        } /* SaveImages */
Example #13
0
        public TreeNodeStation(PicesDataBase _dbConn,
                               PicesRunLog _runLog,
                               PicesSipperStation _station
                               )
        {
            dbConn  = _dbConn;
            runLog  = _runLog;
            station = _station;
            LoadDeploymentDetails();

            Text = ToString();

            ContextMenuStrip cms = new ContextMenuStrip();

            cms.Items.Add("Edit Station Parameters", null, EditStationParameters);

            if (PicesSipperVariables.AllowUpdates())
            {
                if (Nodes.Count < 1)
                {
                    cms.Items.Add("Delete Station", null, DeleteStation);
                }
                cms.Items.Add("Add a new Deployment", null, AddANewDeployment);
            }
            this.ContextMenuStrip = cms;
        }
Example #14
0
        public TreeNodeCruise(PicesDataBase _dbConn,
                              PicesRunLog _runLog,
                              PicesSipperCruise _cruise
                              )
        {
            dbConn = _dbConn;
            runLog = _runLog;
            cruise = _cruise;
            LoadStationDetails();

            Text = ToString();

            if (PicesSipperVariables.AllowUpdates())
            {
                ContextMenuStrip cms = new ContextMenuStrip();
                cms.Items.Add("Edit Cruise Parameters", null, EditCruiseParameters);

                if (Nodes.Count < 1)
                {
                    cms.Items.Add("Delete Cruise", null, DeleteCruise);
                }

                cms.Items.Add("Add a new Station", null, AddANewStation);
                this.ContextMenuStrip = cms;
            }
        }
Example #15
0
        } /* DatePicesInstrumentComparer */

        private void  FindScanRates(PicesDataBase threadConn,
                                    String cruiseName,
                                    String stationName,
                                    String deploymentNum,
                                    ref float scanRateMin,
                                    ref float scanRateMax
                                    )
        {
            // Because Scan Rates are stored with each individual SIPPER File we will need to
            // peruse though all of them for this deployment. Ideally they will all have the
            // same scan rate.
            scanRateMin = scanRateMax = 24950.0f;
            PicesSipperFileList sipperFiles = threadConn.SipperFileLoad(cruiseName, stationName, deploymentNum);

            if (sipperFiles == null)
            {
                return;
            }
            scanRateMin = float.MaxValue;
            scanRateMax = float.MinValue;

            foreach (PicesSipperFile sf in sipperFiles)
            {
                scanRateMin = Math.Min(scanRateMin, sf.ScanRate);
                scanRateMax = Math.Max(scanRateMax, sf.ScanRate);
            }
        } /* FindScanRates */
        public PredictionBreakDownDisplay(PicesDataBase _dbConn,
                                          PicesDataBaseImage _image,
                                          PicesRaster _raster,
                                          TrainingModel2 _trainingModel,
                                          PicesInstrumentData _instrumentData, /*!<  Instrument data that goes with image, if null will read from database. */
                                          PicesRunLog _runLog
                                          )
        {
            if (_runLog == null)
            {
                runLog = new PicesRunLog();
            }
            else
            {
                runLog = _runLog;
            }

            if (_image == null)
            {
                return;
            }

            fileName       = _image.ImageFileName;
            instrumentData = _instrumentData;
            trainingModel  = _trainingModel;

            PicesRaster raster = _raster;

            if (_dbConn != null)
            {
                if (raster == null)
                {
                    raster = _dbConn.ImageFullSizeFind(fileName);
                }

                if (instrumentData == null)
                {
                    instrumentData = _dbConn.InstrumentDataGetByScanLine(_image.SipperFileName, _image.TopLeftRow);
                }

                dbFeatureVector = _dbConn.FeatureDataRecLoad(fileName);
            }

            if (raster == null)
            {
                return;
            }

            //raster = raster.ConnectedComponent ();

            featureCalcImages = new PicesRasterList();
            featureVector     = new PicesFeatureVector(raster, fileName, featureCalcImages, runLog);
            if (instrumentData != null)
            {
                featureVector.AddInstrumentData(instrumentData);
            }

            InitializeComponent();
        }
Example #17
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 */
Example #18
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 */
Example #19
0
 private void  CloseMySQL()
 {
     if (mainWinConn != null)
     {
         mainWinConn.Close();
         mainWinConn = null;
         GC.Collect();
     }
 }
Example #20
0
 private PicesDataBase  DbConn()
 {
     if (dbConn == null)
     {
         weOwnDbConn = true;
         dbConn      = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);
     }
     return(dbConn);
 }
Example #21
0
 private void CruiseMaintenance_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (weOwnDbConn)
     {
         dbConn.Close();
         dbConn = null;
         GC.Collect();
     }
 }
        /// <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 */
Example #24
0
        private void GetRunTimeParameters_Load(object sender, EventArgs e)
        {
            LoadConfiguraionData();
            PicesDataBase dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            dbConn.SipperFileLoadOracle();

            dbConn.Close();
            dbConn = null;
        }
Example #25
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();
        }
Example #26
0
 private void StationDialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (weOwnDbConn)
     {
         dbConn.Close();
         dbConn = null;
         GC.Collect();
         weOwnDbConn = false;
     }
 }
Example #27
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();
        }
Example #29
0
        } /* UpdateProcessNameChange */

        private void  UpdateDataFields(PicesDataBase updDbConn)
        {
            updDbConn.MLClassUpdate(selectedClass.Name, newClassEntry);
            if (newClassEntry.Parent != origParent)
            {
                if ((origParent != null) && (origParent.Children != null))
                {
                    origParent.Children.Remove(selectedClass);
                }
            }
        } /* UpdateDataFields */
Example #30
0
        static void Main()
        {
#if DEBUG
            PicesMethods.StartMemoryLeakDetection();
#endif
            PicesSipperVariables.InitializeEnvironment();
            PicesDataBase.Initialization();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new PicesCommander());
            GC.Collect();
        }