/// <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 */
} /* MakePredictions */ public static void MakePredictions(PicesRaster raster, ref PicesPrediction model1Prediction1, ref PicesPrediction model1Prediction2, ref PicesPrediction model2Prediction1, ref PicesPrediction model2Prediction2, PicesRunLog runLog ) { String imageFileName = raster.FileName; ParsedImageFileName pifn = PicesFeatureVector.ParseImageFileName(imageFileName); String sipperFileName = pifn.sipperFileName; uint scanLineNum = pifn.scanLineNum; PicesFeatureVector fv = new PicesFeatureVector(raster, imageFileName, null, runLog); { PicesDataBase dbConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog); PicesInstrumentData pid = dbConn.InstrumentDataGetByScanLine(sipperFileName, scanLineNum); if (pid != null) { fv.AddInstrumentData(pid); } pid = null; dbConn.Close(); dbConn = null; } MakePredictions(fv, ref model1Prediction1, ref model1Prediction2, ref model2Prediction1, ref model2Prediction2, runLog ); fv = null; }