Beispiel #1
0
        } /* SaveImagesByClass */

        private void  SaveImagesInList(PicesDataBaseImageList list,
                                       String dirName
                                       )
        {
            dirName = OSservices.AddSlash(dirName);
            curDir  = dirName;
            foreach (PicesDataBaseImage i in list)
            {
                if (cancelRequested)
                {
                    break;
                }

                String      fullName = dirName + i.ImageFileName + ".bmp";
                PicesRaster r        = dbConn.ImageFullSizeFind(i.ImageFileName);
                if (r == null)
                {
                    imagesFailedToExtract++;
                }
                else
                {
                    r.Save(fullName);
                }
                imagesSaved++;
            }
        } /* SaveImagesInList */
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="classes"></param>
        /// <param name="_rootDir">Root directory of training library that contains examples for the classes.</param>
        /// <param name="_activeClasses">List of classes that current classifier supports;  these classes will be highlighted.</param>
        public SelectAPicesClass(PicesClassList classes,
                                 String _rootDir,
                                 PicesClassList _activeClasses
                                 )
        {
            activeClasses = _activeClasses;
            rootDir       = OSservices.AddSlash(_rootDir);
            InitializeComponent();

            activeClassFont = new Font(MLClassChoices.Font.FontFamily, MLClassChoices.Font.SizeInPoints + 1, FontStyle.Bold);

            selectedNode = null;

            PicesClass root        = classes.RootNode;
            bool       activeClass = false;

            AddSubTreeToClassChoser(root, MLClassChoices.Nodes, ref activeClass, 0);
            if (selectedNode != null)
            {
                MLClassChoices.SelectedNode = selectedNode;
            }

            MLClassChoices.ExpandAll();

            //foreach  (PicesClass pc in root.Children)
            //  AddSubTreeToClassChoser (pc, MLClassChoices.Nodes, ref activeClass);
        }
Beispiel #3
0
        } /* SaveImagesByDepthImcrements */

        private void  SaveImagesByClass()
        {
            images.Sort(PicesDataBaseImageList.SortOrderType.soClassName, false);

            int idx = 0;
            PicesDataBaseImage i = images[0];

            while ((idx < images.Count) && (!cancelRequested))
            {
                String className    = i.Class1Name;
                String curClassName = className;

                curDir = OSservices.AddSlash(DestinationDirectory.Text) + className;

                try { Directory.CreateDirectory(curDir); }  catch (Exception)  {}

                PicesDataBaseImageList imagesThisClass = new PicesDataBaseImageList();

                while ((idx < images.Count) && (!cancelRequested) && (className == curClassName))
                {
                    imagesThisClass.Add(i);
                    idx++;
                    if (idx < images.Count)
                    {
                        i         = images[idx];
                        className = i.Class1Name;
                    }
                }

                SaveImagesInList(imagesThisClass, curDir);
            }
        } /* SaveImagesByClass */
        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();
        }
Beispiel #5
0
        public DisplayPicesImages(String _dir)
        {
            InitializeComponent();

            dir  = OSservices.AddSlash(_dir);
            Text = dir;

            thumbNails = new List <FlowLayoutPanel> ();

            DirectoryInfo di = null;

            try  { di = new DirectoryInfo(dir); }
            catch (Exception)  { di = null; }
            if (di == null)
            {
                return;
            }

            try  { files = di.GetFiles("*.*"); }  catch (Exception)  { files = null; }
            if (files != null)
            {
                files = ReduceToImageFiles(files);
                UpdateDisplayTimer.Enabled = true;
            }
        }
Beispiel #6
0
        private string  ConstructInstrumentFileName(string sipperFileName)
        {
            String instDataDir = OSservices.AddSlash(PicesSipperVariables.SipperInterfaceDir()) + "InstrumentData";

            if (instDataDir == "")
            {
                instDataDir = OSservices.AddSlash(PicesSipperVariables.SipperInterfaceDir()) + "InstrumentData";
            }
            OSservices.CreateDirectory(instDataDir);

            string instDataRootName = sipperFileName;

            if (instDataRootName == "")
            {
                instDataRootName = "InstrumentData";
            }
            else
            {
                instDataRootName = instDataRootName + "_InstrumentData";
            }

            string instDataFileName = OSservices.AddSlash(instDataDir) + instDataRootName + ".txt";

            return(instDataFileName);
        } /* ConstructInstrumentFileName */
        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();
        }
Beispiel #8
0
        private void ImageGrid_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            String      fileName = OSservices.AddSlash(rootDir) + (String)ImageGrid.Rows[e.RowIndex].Cells[2].Value;
            ImageEditor ie       = new ImageEditor(fileName);

            ie.ShowDialog();
            ie.Dispose();
            ie = null;
        }
Beispiel #9
0
        } /* PaintErrorRetreivingCammeraLineData   */

        private void  SaveImageInLogDirectory()
        {
            if (chartBuff != null)
            {
                DateTime d           = DateTime.Now;
                string   logFileDir  = OSservices.AddSlash(PicesSipperVariables.SipperInterfaceLogDir()) + "CameraLines";
                string   logFileName = OSservices.AddSlash(logFileDir) + "CameraLine_" + d.ToString("yyyy-MM-dd_HHmmss") + ".jpg";
                OSservices.CreateDirectory(logFileDir);
                chartBuff.Save(logFileName);
            }
        } /* SaveImageInLogDirectory */
Beispiel #10
0
        private void  ConfigurationLoad()
        {
            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "ImageViewer.cfg";
            System.IO.StreamReader i = null;
            dataFieldAssignments    = new int[4];
            dataFieldAssignments[0] = PicesInstrumentData.GetFieldNum("Depth");
            dataFieldAssignments[1] = PicesInstrumentData.GetFieldNum("Temperature");
            dataFieldAssignments[2] = PicesInstrumentData.GetFieldNum("Oxygen");
            dataFieldAssignments[3] = PicesInstrumentData.GetFieldNum("Salinity");

            try { i = new System.IO.StreamReader(configFileName); }  catch (Exception) { i = null; }
            if (i != null)
            {
                String nextLine = null;

                while (true)
                {
                    try  { nextLine = i.ReadLine(); }  catch (Exception) { break; }
                    if (nextLine == null)
                    {
                        break;
                    }

                    nextLine = nextLine.Trim();

                    if ((nextLine.Length < 3) || (nextLine.Substring(0, 2) == "//"))
                    {
                        continue;
                    }

                    String[] fields = nextLine.Split('\t');
                    if (fields.Length != 2)
                    {
                        continue;
                    }

                    String fieldName  = fields[0];
                    String fieldValue = fields[1];

                    switch (fieldName)
                    {
                    case  "DataLabel0":  dataFieldAssignments[0] = PicesInstrumentData.GetFieldNum(fieldValue);   break;

                    case  "DataLabel1":  dataFieldAssignments[1] = PicesInstrumentData.GetFieldNum(fieldValue);   break;

                    case  "DataLabel2":  dataFieldAssignments[2] = PicesInstrumentData.GetFieldNum(fieldValue);   break;

                    case  "DataLabel3":  dataFieldAssignments[3] = PicesInstrumentData.GetFieldNum(fieldValue);   break;
                    }
                }

                i.Close();
            }
        } /* ConfigurationLoad */
Beispiel #11
0
        public SipperSimulator(String sipperFileName)
        {
            InitializeComponent();

            if (String.IsNullOrEmpty(sipperFileName))
            {
                sipperFileName = "C:\\Pices\\SipperFiles\\WB0813\\WB0813DSH09\\WB0813DSH09_03.spr";
            }

            //ConvertCTDfile ();

            simulatorDir = OSservices.AddSlash(OSservices.AddSlash(PicesSipperVariables.SipperInterfaceDir()) + "Simulator");

            configRec      = new SipperConfigRec();
            currentDataRow = new InstrumentData();

            conversationBuffer   = Queue.Synchronized(new Queue());
            serialPortBuffers    = new SerialPortBuffer[3];
            serialPortBuffers[0] = new SerialPortBuffer(512);
            serialPortBuffers[1] = new SerialPortBuffer(512);
            serialPortBuffers[2] = new SerialPortBuffer(512);

            // SplitFile ();
            // ChkFile ();
            //LoadSipperFile();

            ctdData         = new List <char>();
            ctdDataNextByte = 0;

            pitchRollData        = new ArrayList();
            pitchRollDataNextRow = 0;

            ExtractDataFromSIPPERFile(sipperFileName);

            LoadCameraLines();

            batteryPack  = new BatteryPack();
            sipperCamera = new SipperCamera();

            ctdThread      = new Thread(new ThreadStart(CTDDataInstrument));
            ctdThread.Name = "SipperCtdData";
            ctdThread.Start();

            pitchRollThread      = new Thread(new ThreadStart(PitchRollDataInstrument));
            pitchRollThread.Name = "SipperPitchRollData";
            pitchRollThread.Start();

            batteryPackThread      = new Thread(new ThreadStart(BatteryPackInstrument));
            batteryPackThread.Name = "SipperBatteryData";
            batteryPackThread.Start();

            LoadSipperFilesNames();
        }
Beispiel #12
0
        public GetRunTimeParameters()
        {
            msgQueue = new PicesMsgQueue("GradeTrainingModel");
            runLog   = new PicesRunLog(msgQueue);

            InitializeComponent();
            noAgreementClass = PicesClassList.GetUniqueClass("NoAgreement", "");

            configFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "GradeTrainingModel.txt";

            LoadTrainingModelComboBox();
            InitializeTrainAndPredLevelFields();
            EnableComponentsForParameterEntry();
        }
Beispiel #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();
        }
Beispiel #14
0
        public void  LoadImageGrid()
        {
            if (predictions.Count < 1)
            {
                return;
            }

            lastHeight = Height;
            lastWidth  = Width;

            ImageGrid.Rows.Clear();

            bool firstPass = true;

            foreach (KeyValuePair <String, Prediction> pair in predictions)
            {
                Prediction p = pair.Value;
                if (firstPass)
                {
                    KnownClass.Text     = p.knowClass.Name;
                    PredictedClass.Text = p.predClass.Name;
                }

                Object[] data = new Object[3];

                String fullFileName = null;
                {
                    String fn = p.FileName;
                    if ((fn.Length > 2) && (fn[1] == ':'))
                    {
                        fullFileName = fn;
                    }
                    else
                    {
                        fullFileName = OSservices.AddSlash(rootDir) + p.FileName;
                    }
                }

                //Bitmap  i = new Bitmap (fileName);

                //int  heightToDisplay = Math.Min (300, i.Height + 4);
                //heightToDisplay = Math.Max (50, heightToDisplay);

                data[0] = fullFileName;
                data[1] = p.prob;
                data[2] = p.FileName;

                ImageGrid.Rows.Add(data);
            }
        } /* LoadImageGrid */
Beispiel #15
0
        public SipperDiskManager()
        {
            destDir = OSservices.AddSlash(PicesSipperVariables.HomeDir()) + "SipperFiles";
            OSservices.CreateDirectory(destDir);

            InitializeComponent();

            UpdateAvailableBytes();
            DownLoadDir.Text = destDir;

            selectedFiles = new SipperFileControlBlockList();
            UpdateAvailableBytes();

            oldHeight = this.Height;
            oldWidth  = this.Width;
        }
Beispiel #16
0
        public TimePlot(SipperConfigRec _sipperConfigRec,
                        InstrumentDataList _history
                        )
        {
            OSservices.CreateDirectory(PicesSipperVariables.ConfigurationDirectory());
            timePlotConfigFileName = OSservices.AddSlash(PicesSipperVariables.ConfigurationDirectory()) + "TimePlotConfig.txt";

            sipperConfigRec = _sipperConfigRec;
            history         = _history;
            InitializeComponent();
            InitializeVariables();
            LoadConfiguration();

            SetToLiveMode();
            updateChartTimer.Enabled = true;
        }
        private void CreateFeatureSelectionDataSets_Load(object sender, EventArgs e)
        {
            modelNames = TrainingModel2.GetListOfTrainingModels();
            if (modelNames != null)
            {
                foreach (String s in modelNames)
                {
                    ModelName.Items.Add(s);
                }
            }

            ModelName.Text = initialModelName;

            UpdatePercentageFields();
            DestinationDirectory.Text = OSservices.AddSlash(PicesSipperVariables.DataFilesDirectory()) + "FeatureSelection";
        }
        private void DestinationBrowseButton_Click(object sender, EventArgs e)
        {
            FeatureFileNamePrompter fnfp = new FeatureFileNamePrompter(true);

            fnfp.Directory = OSservices.GetPathPartOfFile(DestinationFileName.Text);
            fnfp.FileName  = OSservices.GetRootNameWithExtension(DestinationFileName.Text);
            fnfp.Format    = FileFormat.Text;
            fnfp.ShowDialog();
            DialogResult dr = fnfp.Result;

            if (dr == DialogResult.OK)
            {
                DestinationFileName.Text = OSservices.AddSlash(fnfp.Directory) + fnfp.FileName;
                FileFormat.Text          = fnfp.Format;
            }
        }
        } /* 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 */
Beispiel #20
0
        public InstrumentDataByDeploymentProfile(String _cruiseName,
                                                 String _stationName,
                                                 String _deploymentNum,
                                                 PicesClass _mlClass
                                                 )
        {
            cruiseName    = _cruiseName;
            stationName   = _stationName;
            deploymentNum = _deploymentNum;
            mlClass       = _mlClass;

            reportFileDir = OSservices.AddSlash(PicesSipperVariables.PicesReportDir()) + "InstrumentSummariesByDeployment";

            runLogGoalie = new PicesGoalKeeper("InstrumentDataByDeploymentProfile");

            InitializeComponent();
        }
Beispiel #21
0
        //SMP751001034_02_00025491_3588



        private void  SaveSampleImages(PicesDataBaseImageList planktonData)
        {
            PicesClassList classes = planktonData.ExtractListOfClasses();

            if (classes == null)
            {
                return;
            }

            String sampleDir = OSservices.AddSlash(OSservices.GetPathPartOfFile(dataFileName)) +
                               OSservices.GetRootName(dataFileName) +
                               "_SampleImages";

            sampleDir = OSservices.AddSlash(sampleDir);
            OSservices.CreateDirectoryPath(sampleDir);

            foreach (PicesClass pc in classes)
            {
                String classSampleDir = OSservices.AddSlash(sampleDir + pc.Name);
                OSservices.CreateDirectoryPath(classSampleDir);
                PicesDataBaseImageList examplesThisClass = planktonData.ExtractExamplesForAGivenClass(pc);
                examplesThisClass.RandomizeOrder();

                int numWritten = 0;
                foreach (PicesDataBaseImage i in examplesThisClass)
                {
                    String imageRootName = OSservices.GetRootName(i.ImageFileName);

                    PicesRaster fullSizeImage = dbConn.ImageFullSizeFind(imageRootName);
                    if (fullSizeImage != null)
                    {
                        String imageFileName = classSampleDir + imageRootName + ".bmp";
                        fullSizeImage.Save(imageFileName);
                        ++numWritten;
                    }
                    if (numWritten >= includeSampleImagesNumPerClass)
                    {
                        break;
                    }
                }
            }
        } /* SaveSampleImages */
Beispiel #22
0
        } /* CopyImageToClipboard */

        private void  SaveImage(Object sender, EventArgs e)
        {
            String imageFileName = lastSelectedImage;

            PicesRaster pr = dbConn.ImageFullSizeFind(imageFileName);

            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.Description         = "Select directory to save images to";
            fbd.ShowNewFolderButton = true;
            fbd.SelectedPath        = lastSaveImageDir;
            DialogResult dr = fbd.ShowDialog();

            if (dr == DialogResult.OK)
            {
                if (lastSaveImageDir != fbd.SelectedPath)
                {
                    lastSaveImageDir = fbd.SelectedPath;
                }

                String destDir = OSservices.AddSlash(fbd.SelectedPath);

                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(destDir);
                if (!di.Exists)
                {
                    MessageBox.Show(this, "No Such Directory [" + destDir + "]", "Save Images", MessageBoxButtons.OK);
                    return;
                }

                String fullFileName = destDir + imageFileName + ".bmp";

                try { pr.Save(fullFileName); }
                catch (Exception e3)
                {
                    MessageBox.Show(this,
                                    "Exception occurred saving image\n\n" + e3.ToString(),
                                    "Save Image",
                                    MessageBoxButtons.OK
                                    );
                }
            }
        } /* SaveImage */
        } /* ValidateAll */

        private void  StartTheBackGroundProcedure()
        {
            DateTime n           = DateTime.Now;
            String   logFileName = OSservices.AddSlash(PicesSipperVariables.TempDirectory()) + "ImportGroupAssignments_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);

            cancelBackGround = false;
            backGroundThread = new Thread(new ThreadStart(ImportAssignments));
            backGroundThread.Start();

            BackGroundTimer.Enabled  = true;
            SourceDirectory.Enabled  = false;
            BrowseSourceDir.Enabled  = false;
            GroupName.Enabled        = false;
            GroupDescription.Enabled = false;
        } /* StartTheHarvestingProcedure */
        } /* ProcessOneImage */

        private void  RemoveImage(String fullImageFileName)
        {
            String dir             = OSservices.GetPathPartOfFile(fullImageFileName);
            String rootNameWithExt = OSservices.GetRootNameWithExtension(fullImageFileName);
            String subDir          = "";

            if (SourceDirectory.Text.Length < dir.Length)
            {
                subDir = dir.Substring(SourceDirectory.Text.Length);
                if ((subDir.Length > 0) && (subDir[0] == '\\'))
                {
                    subDir = subDir.Substring(1);
                }
            }

            String destDir = removalDestRootDir;

            if (subDir.Length > 0)
            {
                destDir = OSservices.AddSlash(destDir) + subDir;
                OSservices.CreateDirectoryPath(destDir);
            }

            FileInfo fi = null;

            try  { fi = new FileInfo(fullImageFileName); }  catch (Exception) { fi = null; }
            if (fi != null)
            {
                String destFileName = OSservices.AddSlash(destDir) + rootNameWithExt;
                try
                {
                    fi.MoveTo(destFileName);
                    reconcilingRunLog.Writeln(rootNameWithExt + "\t" + "Removed");
                }
                catch (Exception e)
                {
                    reconcilingRunLog.Writeln(rootNameWithExt + "\t" + "Error Removing[" + e.ToString() + "]");
                    MessageBox.Show("RemoveImage[" + fullImageFileName + "]" + "\n\n" + e.ToString());
                }
            }
        } /* RemoveImage*/
        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 ();
        }
Beispiel #26
0
        public SaveImagesToDisk(PicesDataBase _dbConn,
                                String _cruise,
                                String _station,
                                String _deployment,
                                String _sipperFileName,
                                PicesDataBaseImageList _images
                                )
        {
            dbConn         = _dbConn;
            images         = _images;
            cruise         = _cruise;
            station        = _station;
            deployment     = _deployment;
            sipperFileName = _sipperFileName;

            runLog = new PicesRunLog();
            InitializeComponent();
            DestinationDirectory.Text = OSservices.AddSlash(OSservices.AddSlash(PicesSipperVariables.HomeDir()) + "SavedImages");
            OSservices.CreateDirectoryPath(DestinationDirectory.Text);

            //  PicesTempDirectory ());
            if (!String.IsNullOrEmpty(cruise))
            {
                DestinationDirectory.Text += cruise;
                if (!String.IsNullOrEmpty(station))
                {
                    DestinationDirectory.Text += "-" + station;
                    if (!String.IsNullOrEmpty(deployment))
                    {
                        DestinationDirectory.Text += "-" + deployment;
                        if (!String.IsNullOrEmpty(sipperFileName))
                        {
                            DestinationDirectory.Text += "-" + sipperFileName;
                        }
                    }
                }
            }

            ImageCount.Text = images.Count.ToString("###,##0");
        }
        private void  StartReconciliationThread()
        {
            String   rootName    = OSservices.GetRootNameOfDirectory(SourceDirectory.Text);
            DateTime d           = DateTime.Now;
            String   logFileName = OSservices.AddSlash(PicesSipperVariables.TempDirectory()) + rootName + "_ReconcileImageNames_" +
                                   d.ToString("yyyyMMdd-HHmmss") + ".txt";

            // Any images that are not in the Database that are to be removed will be moved to the subdirectory structure below.
            removalDestRootDir = "c:\\Temp\\PicesDatabaseImageReconciliationRemovedImages\\" + rootName;
            OSservices.CreateDirectoryPath(removalDestRootDir);

            reconcilingRunLog = new PicesRunLog(logFileName);


            Start.Enabled                 = false;
            SourceDirectory.ReadOnly      = true;
            SourceDirectoryBrowse.Enabled = false;
            reconcilingThread             = new Thread(new ThreadStart(ReconciliationThread));
            reconcilingThread.Start();
            Cancel.Enabled        = true;
            RunStatsTimer.Enabled = true;
        } /* StartReconciliationThread */
Beispiel #28
0
        } /* LoadNextImageFromDir */

        private String  LocateRootName(String rootName)
        {
            String subDir = null;

            if (!String.IsNullOrEmpty(dir))
            {
                subDir = OSservices.LookForFile(rootName + ".bmp", dir);
            }

            if (String.IsNullOrEmpty(subDir))
            {
                if (!String.IsNullOrEmpty(dir2))
                {
                    subDir = OSservices.LookForFile(rootName + ".bmp", dir2);
                    if (subDir == null)
                    {
                        return(null);
                    }
                }
            }

            return(OSservices.AddSlash(subDir) + rootName + ".bmp");
        } /* LocateRootName */
Beispiel #29
0
        public DisplayPicesImages(String _dir,
                                  String _dir2,
                                  ProbNamePair[]  _nameList
                                  )
        {
            InitializeComponent();

            dir  = OSservices.AddSlash(_dir);
            dir2 = OSservices.AddSlash(_dir2);

            nameList = _nameList;

            Text = dir;

            if (!String.IsNullOrEmpty(dir) && !String.IsNullOrEmpty(dir2))
            {
                Text = OSservices.GetRootNameOfDirectory(dir) + " vs " + OSservices.GetRootNameOfDirectory(dir2);
            }

            thumbNails = new List <FlowLayoutPanel> ();

            DirectoryInfo di = null;

            try  { di = new DirectoryInfo(dir); }
            catch (Exception)  { di = null; }
            if (di == null)
            {
                return;
            }

            try  { files = di.GetFiles("*.*"); }  catch (Exception)  { files = null; }
            files = ReduceToImageFiles(files);
            if (files != null)
            {
                UpdateDisplayTimer.Enabled = true;
            }
        }
Beispiel #30
0
        private void  SaveImagesByDepthImcrements()
        {
            images.Sort(PicesDataBaseImageList.SortOrderType.soDepth, false);

            int idx = 0;
            PicesDataBaseImage i = images[0];

            while ((idx < images.Count) && (!cancelRequested))
            {
                int depthIndex    = DepthIndex(i.Depth);
                int curDepthIndex = depthIndex;

                int fromDepth = depthIndex * increments;
                int toDepth   = (depthIndex + 1) * increments;

                String depthSubDirName = fromDepth.ToString("000") + "-" + toDepth.ToString("000");
                curDir = OSservices.AddSlash(DestinationDirectory.Text) + depthSubDirName;

                try { Directory.CreateDirectory(curDir); }  catch (Exception)  {}

                PicesDataBaseImageList imagesThisDepthIndex = new PicesDataBaseImageList();

                while ((idx < images.Count) && (!cancelRequested) && (depthIndex == curDepthIndex))
                {
                    imagesThisDepthIndex.Add(i);
                    idx++;
                    if (idx < images.Count)
                    {
                        i          = images[idx];
                        depthIndex = DepthIndex(i.Depth);
                    }
                }

                SaveImagesInList(imagesThisDepthIndex, curDir);
            }
        } /* SaveImagesByDepthImcrements */