Example #1
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 #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
        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 */
        } /* ProcessDirectory */

        private void  ProcessOneImage(String fullImageFileName)
        {
            String             rootName = OSservices.GetRootName(fullImageFileName);
            PicesDataBaseImage i        = dbConn.ImageLoad(rootName);

            if (i != null)
            {
                runStatsImagesInDataBase++;
                return;
            }


            String sipperFileName = null;
            uint   scanLine       = 0;
            uint   scanCol        = 0;

            PicesFeatureVector.ParseImageFileName(fullImageFileName, ref sipperFileName, ref scanLine, ref scanCol);

            if (String.IsNullOrEmpty(sipperFileName) || (scanLine < 1))
            {
                // We are not going to be able to locate this image in the Database.
                runStatsImagesNotInDataBase++;
                reconcilingRunLog.Writeln(fullImageFileName + "\t" + "Name format will not let me derive needed info.");
                return;
            }

            String sqlStr = "call  ImagesLocateClosestImage(" + "\"" + sipperFileName + "\"" + ", " + scanLine.ToString() + ", " + scanCol.ToString() + ")";

            String[][] results = dbConn.QueryStatement(sqlStr, null);
            if ((results == null) || (results.Length < 1))
            {
                runStatsImagesNotInDataBase++;
                reconcilingRunLog.Writeln(fullImageFileName + "\t" + "Could not find an appropriate image in the Database");

                RemoveImage(fullImageFileName);
                return;
            }

            String correctImageFileName = results[0][1];
            String newFullName          = OSservices.AddSlash(OSservices.GetPathPartOfFile(fullImageFileName)) +
                                          correctImageFileName + "." +
                                          OSservices.GetFileExtension(fullImageFileName);

            OSservices.RenameFile(fullImageFileName, newFullName);
            runStatsImagesFixed++;
        } /* ProcessOneImage */