private void ValidateModelName() { errorProvider1.SetError(ModelName, null); if (String.IsNullOrEmpty(ModelName.Text)) { MessageBox.Show(this, "Model Name is blank"); errorsFound = true; ModelName.Text = modelName; return; } if (ModelName.Text == modelName) { return; } if (runLog == null) { runLog = new PicesRunLog(); } PicesTrainingConfigManaged tc = new PicesTrainingConfigManaged(ModelName.Text, runLog); if (!tc.Valid()) { errorsFound = true; errorProvider1.SetError(ModelName, "Model[" + ModelName.Text + "] is not a valid model"); ModelName.Text = modelName; } else { modelName = ModelName.Text; } } /* ValidateModelName*/
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(); }
public SipperFileDialog(PicesSipperFile _sipperFile, PicesRunLog _runLog ) { runLog = _runLog; if (runLog == null) { runLog = new PicesRunLog(); } sipperFile = _sipperFile; if (sipperFile != null) { // Retrieve an up-to-date version of SipperFile from database. PicesSipperFile tempSipperFile = DbConn().SipperFileRecLoad(sipperFile.SipperFileName); if (tempSipperFile != null) { sipperFile.ReFresh(tempSipperFile); } } addMode = false; InitializeComponent(); }
private void CreateFeatureFiles_Click(object sender, EventArgs e) { ValidateWholeScreen(); if (errorsFound) { return; } DialogResult dr = MessageBox.Show(this, "Do you want to create the Feature Data files?", "Create Feature Data Files", MessageBoxButtons.YesNo); if (dr == DialogResult.No) { return; } if (runLog == null) { runLog = new PicesRunLog(); } CreateFeatureFiles.Enabled = false; DialogTimer.Enabled = true; tuningThread = new Thread(new ThreadStart(CreateTuningFeatureFiles)); tuningThread.Start(); CancelCreateFeatureSelectionButton.Enabled = true; }
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(); }
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(); }
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; } }
} /* MakePredictions */ public static void MakePredictions(PicesFeatureVector featureVector, ref PicesPredictionList model1Predictions, ref PicesPredictionList model2Predictions, PicesRunLog runLog ) { model1Predictions = null; model2Predictions = null; if ((!ModelsAreAvailable()) || (featureVector == null)) { return; } if (model1 != null) { model1Predictions = model1.PredictProbabilities(featureVector); } if (model2 != null) { model2Predictions = model2.PredictProbabilities(featureVector); } return; } /* MakePredictions */
} /* MakePredictions */ public static void MakePredictions(PicesFeatureVector featureVector, ref PicesPrediction model1Prediction1, ref PicesPrediction model1Prediction2, ref PicesPrediction model2Prediction1, ref PicesPrediction model2Prediction2, PicesRunLog runLog ) { if (model1Prediction1 == null) { model1Prediction1 = new PicesPrediction(null, 0, 0.0f); } if (model1Prediction2 == null) { model1Prediction2 = new PicesPrediction(null, 0, 0.0f); } if (model2Prediction1 == null) { model2Prediction1 = new PicesPrediction(null, 0, 0.0f); } if (model2Prediction2 == null) { model2Prediction2 = new PicesPrediction(null, 0, 0.0f); } if (model1 != null) { model1.PredictClass(featureVector, model1Prediction1, model1Prediction2); } if (model2 != null) { model2.PredictClass(featureVector, model2Prediction1, model2Prediction2); } } /* MakePredictions */
private void timer1_Tick(object sender, EventArgs e) { if (closeForm) { timer1.Enabled = false; Close(); runLog = null; return; } if (newModelName != null) { modelName.Text = newModelName; newModelName = null; } lock (runLog) { if (runLog.LineCount() != lastLineCount) { lastLineCount = runLog.LineCount(); String lastLine = runLog.LastLine(); TrainingModelOutput.AppendText(lastLine + "\n"); } } }
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; }
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(); }
public TrainingModelStatus(PicesRunLog _runLog, SipperFileViewer _viewer ) { runLog = _runLog; viewer = _viewer; InitializeComponent(); }
private PicesRunLog RunLog() { if (runLog == null) { runLog = new PicesRunLog(); } return(runLog); }
/// <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 */
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(); }
public ClassMaintenance() { runLog = new PicesRunLog(); runLogGoalie = new PicesGoalKeeper("Harvesting Run Log"); runLogMsgQueue = new Queue <String> (); InitializeComponent(); allowUpdates = PicesSipperVariables.AllowUpdates(); }
} /* 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 SaveRawCTDData(String _sipperFileName) { sipperFileName = _sipperFileName; InitializeComponent(); msgQueue = new PicesMsgQueue("SaveRawCtdData"); runLog = new PicesRunLog(msgQueue); SipperFileName.Text = sipperFileName; ctdFileName = OSservices.RemoveExtension(sipperFileName) + "_ctdData.txt"; CtdFileName.Text = ctdFileName; }
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(); }
} /* EnableAllFields */ private void ClassMaintenance_Load(object sender, EventArgs e) { lastHeight = Height; lastWidth = Width; if (runLog == null) { runLog = new PicesRunLog(); } mainDbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog); LoadClassesFromDataBase(); }
public CruiseMaintenance(PicesDataBase _dbConn, PicesRunLog _runLog ) { dbConn = _dbConn; runLog = _runLog; if (runLog == null) { runLog = new PicesRunLog(); } InitializeComponent(); }
private void CruiseDialog_Load(object sender, EventArgs e) { if (runLog == null) { runLog = new PicesRunLog(); } allowUpdates = PicesSipperVariables.AllowUpdates(); PopulateScreen(); LoadCruiseDetails(); EnableFields(); }
public DeploymentDialog(PicesSipperDeployment _deployment, bool _addingNewDeployment, bool _deletingDeployment ) { allowUpdates = PicesSipperVariables.AllowUpdates(); deployment = _deployment; addingNewDeployment = _addingNewDeployment; deletingDeployment = _deletingDeployment; runLog = new PicesRunLog(); InitializeComponent(); }
public CruiseDialog(PicesSipperCruise _cruise, PicesDataBase _dbConn, PicesRunLog _runLog, bool _addingNewCruise, bool _deletingCruise ) { cruise = _cruise; dbConn = _dbConn; runLog = _runLog; addingNewCruise = _addingNewCruise; deletingCruise = _deletingCruise; InitializeComponent(); }
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(); }
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 */
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\\"; }