} /* 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 */
} /* ValidateHowManyToHarvest */ private void ValidateSipperFiles() { if (!String.IsNullOrEmpty(sipperFileName)) { sipperFileNames = new String[1]; sipperFileNames[0] = sipperFileName; } else { sipperFileNames = mainWinConn.SipperFileGetList(Cruise.Text, Station.Text, Deployment.Text); } if (sipperFileNames == null) { errorProvider1.SetError(this, "No SIPPER files located."); validationErrorFound = true; } else if (sipperFileNames.Length < 1) { errorProvider1.SetError(this, "No SIPPER files located."); validationErrorFound = true; } else { errorProvider1.SetError(this, ""); } //// Next 5 lines set up to help speed up debugging by reducing the number of images loaded. //String[] temp = new String[2]; //temp[0] = sipperFileNames[1]; //temp[1] = sipperFileNames[2]; //sipperFileNames = temp; } /* ValidateSipperFiles */
} /* 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 */
} /* SaveSampleImages */ private PicesDataBaseImageList RetrievePlanktonDataBySipperFiles() { PicesDataBaseImageList data = new PicesDataBaseImageList(); String[] sipperFileNames = null; if (String.IsNullOrEmpty(sipperFileName)) { sipperFileNames = dbConn.SipperFileGetList(cruise, station, deployment); } else { sipperFileNames = new String[1]; sipperFileNames[0] = sipperFileName; } if (sipperFileNames != null) { for (int idx = 0; (idx < sipperFileNames.Length) && (!cancelRequested); idx++) { String curSipperFileName = sipperFileNames[idx]; backGroundStatus = "Loading[" + (idx + 1).ToString() + " of " + sipperFileNames.Length.ToString() + "] File[" + curSipperFileName + "]"; PicesDataBaseImageList dataThisSipperFile = dbConn.ImagesQuery(null, curSipperFileName, mlClass, classKeyToUse, probMin, probMax, sizeMin, sizeMax, depthMin, depthMax, 0, // Restart ImageId -1, // limit (Max number of images). false // false = Do not include Thumbnail. ); if (dataThisSipperFile != null) { imagesLoaded += (uint)dataThisSipperFile.Count; foreach (PicesDataBaseImage i in dataThisSipperFile) { data.Add(i); } } } } return(data); } /* RetrievePlanktonDataBySipperFiles */
} /* CountImagesMissingFeatureData */ private PicesFeatureVectorList SaveFeatureDataBySipperFiles() { PicesFeatureVectorList data = new PicesFeatureVectorList(); String[] sipperFileNames = null; if (String.IsNullOrEmpty(sipperFileName)) { sipperFileNames = dbConn.SipperFileGetList(cruise, station, deployment); } else { sipperFileNames = new String[1]; sipperFileNames[0] = sipperFileName; } if (sipperFileNames != null) { for (int idx = 0; (idx < sipperFileNames.Length) && (!cancelRequested); idx++) { String curSipperFileName = sipperFileNames[idx]; backGroundStatus = "Loading[" + (idx + 1).ToString() + " of " + sipperFileNames.Length.ToString() + "] File[" + curSipperFileName + "]"; PicesFeatureVectorList dataThisSipperFile = dbConn.FeatureDataGetOneSipperFile(curSipperFileName, mlClass, classKeyToUse, false); if (dataThisSipperFile != null) { imagesLoaded += (uint)dataThisSipperFile.Count; uint numFilteredOut = 0; dataThisSipperFile = FilterFeatureVectorList(dataThisSipperFile, ref numFilteredOut); imagesFilteredOut += numFilteredOut; imagesMissingFeatureData += CountImagesMissingFeatureData(dataThisSipperFile); foreach (PicesFeatureVector fv in dataThisSipperFile) { data.Add(fv); } } } } return(data); } /* SaveFeatureDataBySipperFiles */