Esempio n. 1
0
        } /* ExtractFamily */

        /// <summary>
        /// Will add in the contents of another SizeDistribution2 instance into this instance.
        /// </summary>
        /// <param name="x">The other 'SizeDistribution2' instance to be accumulated to this instance.</param>
        public void  Add(SizeDistribution2 x)
        {
            if ((x.bucketCount != this.bucketCount) ||
                (x.sizeInitial != this.sizeInitial) ||
                (x.sizeGrowthFactor != this.sizeGrowthFactor) ||
                (x.sizeEndRange != this.sizeEndRange)
                )
            {
                throw new Exception("'SizeDistribution2.Add   ***ERROR***   Dimensions are not the same" + "\n" +
                                    "Left.sizeInitial      [" + sizeInitial.ToString() + "]  Right [" + x.sizeInitial.ToString() + "]" + "\n" +
                                    "Left.sizeGrowthFactor [" + sizeGrowthFactor.ToString() + "]  Right [" + x.sizeGrowthFactor.ToString() + "]" + "\n" +
                                    "Left.sizeEndRange     [" + sizeEndRange.ToString() + "]  Right [" + x.sizeEndRange.ToString() + "]"
                                    );
            }

            foreach (ClassTotals2 ct in x.totals)
            {
                ClassTotals2 classTotals = totals.LookUp(ct.Name);
                if (classTotals == null)
                {
                    classTotals = new ClassTotals2(ct.Name,
                                                   sizeInitial,
                                                   sizeGrowthFactor,
                                                   sizeEndRange,
                                                   bucketCount,
                                                   sizeBucketStart,
                                                   sizeBucketEnd
                                                   );
                    totals.Add(classTotals);
                }
                classTotals.AddIn(ct);
            }
        } /* SizeDistribution2 */
Esempio n. 2
0
        } /* AddFamilyOfClassesToSizeClassTotals */

        /// <summary>
        /// Returns an instance of 'ClassTotals' that contains the ClassTotals that belong to the family of 'ancestor'.
        /// The newly instantiated instance will point to the same instances of 'ClassTotals'  that this instance points to.
        /// As a result you should only call this method after you are done accumulating data.
        /// </summary>
        /// <param name="ancestor"></param>
        /// <returns></returns>
        public SizeDistribution2  ExtractFamilyOfClasses(PicesClass ancestor)
        {
            SizeDistribution2 family = new SizeDistribution2(sizeInitial, sizeGrowthFactor, sizeEndRange);

            ExtractFamily(family, ancestor);
            return(family);
        } /* ExtractFamilyOfClasses */
Esempio n. 3
0
        } /* AssignVallidatedClassAsPredictedClass */

        public void  UpdateClassificationStats(SizeDistribution2 _sizeDistributionDown,
                                               SizeDistribution2 _sizeDistributionUp,
                                               SizeDistribution _depthDistribution_1,
                                               SizeDistribution _depthDistribution_1Down,
                                               SizeDistribution _depthDistribution_1Up,
                                               SizeDistribution _depthDistribution_10,
                                               ref uint _numImagesClassified
                                               )
        {
            _sizeDistributionDown.Add(sizeDistributionDown);
            _sizeDistributionUp.Add(sizeDistributionUp);
            _depthDistribution_1.Add(depthDistribution_1);
            _depthDistribution_1Down.Add(depthDistribution_1Down);
            _depthDistribution_1Up.Add(depthDistribution_1Up);
            _depthDistribution_10.Add(depthDistribution_10);
            _numImagesClassified += numImagesClassified;
        } /* UpdateClassificationStats */
Esempio n. 4
0
        private void  ClassInitialization()
        {
            sizeDistributionDown    = new  SizeDistribution2(0.1f, 1.2f, 10.0f);
            sizeDistributionUp      = new  SizeDistribution2(0.1f, 1.2f, 10.0f);
            depthDistribution_1     = new  SizeDistribution(500, 1);
            depthDistribution_1Down = new  SizeDistribution(500, 1);
            depthDistribution_1Up   = new  SizeDistribution(500, 1);
            depthDistribution_10    = new  SizeDistribution(50, 10);
            classCounts             = new  ClassStatSortedList();

            numImagesClassified = 0;

            pred1 = new PicesPrediction(null, 0, 0.0f);
            pred2 = new PicesPrediction(null, 0, 0.0f);
            if (classifier != null)
            {
                classesInClassifier = classifier.MLClasses();
            }
        }
Esempio n. 5
0
        } /* ExtractFamilyOfClasses */

        private void  ExtractFamily(SizeDistribution2 family,
                                    PicesClass ancestor
                                    )
        {
            ClassTotals2 ct = totals.LookUp(ancestor.Name);

            if (ct != null)
            {
                family.Add(ct);
            }

            if (ancestor.Children != null)
            {
                foreach (PicesClass pc in ancestor.Children)
                {
                    ExtractFamily(family, pc);
                }
            }

            return;
        } /* ExtractFamily */
Esempio n. 6
0
        } /* PrintTabDelDistributionMatrix */

        public void   PrintTabDelDistributionMatrixesForSummaryClasses(System.IO.StreamWriter o,
                                                                       String majorTitle,
                                                                       float volume
                                                                       )
        {
            PicesClassList allKnownClasses   = PicesClassList.GetAllKnownClasses();
            PicesClassList allSummaryClasses = allKnownClasses.ExtractSummarizeClasses();

            allSummaryClasses.SortByName();

            foreach (PicesClass pc in allSummaryClasses)
            {
                SizeDistribution2 familySummary = this.ExtractFamilyOfClasses(pc);
                if (familySummary.totals.Count > 1)
                {
                    o.WriteLine(majorTitle + "      *** Summary of " + pc.Name + " ***");
                    o.WriteLine();
                    familySummary.PrintTabDelDistributionMatrix(o, volume);
                    o.WriteLine();
                    o.WriteLine();
                }
            }
        } /* PrintTabDelDistributionMatrixesForSummaryClasses */