Example #1
0
        private void StatsTimer_Tick(object sender, EventArgs e)
        {
            if (statsLoader == null)
            {
                StatsTimer.Enabled  = false;
                StartButton.Enabled = true;
                return;
            }

            PicesClassStatisticList stats = statsLoader.GetStatsAlreadyLoaded();

            if (stats != null)
            {
                imageCount = 0;
                foreach (PicesClassStatistic stat in stats)
                {
                    imageCount += stat.Count;
                }
                ImageCount.Text = imageCount.ToString("##,###,##0");
            }

            if (statsLoader.DoneLoading)
            {
                statsLoader         = null;
                StatsTimer.Enabled  = false;
                StartButton.Enabled = true;
            }
        }
        } /* LoadStatsForSelectedGroup */

        private void  LoadStatsForOneSipperFile(String sfn)
        {
            curSipperFileName = sfn;
            PicesClassStatisticList nextBunch = dbConn.ImageGetClassStatistics
                                                    (null, // ImageGroup
                                                    sfn,
                                                    mlClass,
                                                    classKeyToUse,
                                                    probMin, probMax,
                                                    sizeMin, sizeMax,
                                                    depthMin, depthMax
                                                    );

            if ((nextBunch == null) || (nextBunch.Count < 1))
            {
                return;
            }

            blocker.StartBlock();
            if (loadedStats == null)
            {
                loadedStats = new PicesClassStatisticList();
            }
            loadedStats.Add(nextBunch);
            imageCountTotal += nextBunch.ImageCountTotal;

            newStatsAvailable = true;
            blocker.EndBlock();
        } /* LoadStatsForOneSipperFile */
Example #3
0
        public PicesClassStatisticList  ToPicesClassStatisticList()
        {
            PicesClassStatisticList result = new PicesClassStatisticList();
            IList <ClassStat>       stats  = this.Values;

            foreach (ClassStat cs in stats)
            {
                result.Add(new PicesClassStatistic(cs.mlClass, cs.count));
            }

            return(result);
        } /* ToPicesClassStatisticList */
        private void  LoadStatsForSelectedGroup()
        {
            PicesClassStatisticList nextBunch = null;

            if (allSipperFiles || (!String.IsNullOrEmpty(sipperFileName)))
            {
                nextBunch = dbConn.ImageGetClassStatistics
                                (selectedImageGroup, // ImageGroup
                                sipperFileName,
                                mlClass,
                                classKeyToUse,
                                probMin, probMax,
                                sizeMin, sizeMax,
                                depthMin, depthMax
                                );
            }
            else
            {
                nextBunch = dbConn.ImageGetClassStatistics
                                (selectedImageGroup, // ImageGroup
                                cruiseName,
                                stationName,
                                deploymentNum,
                                mlClass,
                                classKeyToUse,
                                probMin, probMax,
                                sizeMin, sizeMax,
                                depthMin, depthMax
                                );
            }

            if (nextBunch == null)
            {
                return;
            }

            blocker.StartBlock();
            if (loadedStats == null)
            {
                loadedStats = new PicesClassStatisticList();
            }
            loadedStats.Add(nextBunch);
            imageCountTotal  += nextBunch.ImageCountTotal;
            newStatsAvailable = true;
            blocker.EndBlock();

            nextBunch = null;
        } /* LoadStatsForSelectedGroup */
        //  return to the caller current accumulated statistics
        //  then remove from my own internal list 'loadedStats'.
        public PicesClassStatisticList  GetStatsAlreadyLoaded()
        {
            PicesClassStatisticList statsToReturn = null;

            blocker.StartBlock();
            if (loadedStats != null)
            {
                statsToReturn = new PicesClassStatisticList();
                foreach (PicesClassStatistic stat in loadedStats)
                {
                    statsToReturn.Add(stat);
                }
            }
            blocker.EndBlock();
            return(statsToReturn);
        }
        //  return to the caller current accumulated statistics
        //  then remove from my own internal list 'loadedStats'.
        public PicesClassStatisticList  GetStatsAlreadyLoadedIfNew()
        {
            PicesClassStatisticList statsToReturn = null;

            blocker.StartBlock();

            if (newStatsAvailable)
            {
                if (loadedStats != null)
                {
                    statsToReturn = new PicesClassStatisticList();
                    foreach (PicesClassStatistic stat in loadedStats)
                    {
                        statsToReturn.Add(stat);
                    }
                }
                newStatsAvailable = false;
            }

            blocker.EndBlock();
            return(statsToReturn);
        }