コード例 #1
0
        public static bool CalculateDescriptorInSpecificValue(Cl3DModel.Cl3DModelPointIterator p_Point, ref string descriptor)
        {
            descriptor +=   p_Point.X.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " +
                            p_Point.Y.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " +
                            p_Point.Z.ToString(System.Globalization.CultureInfo.InvariantCulture) + " " +
                            p_Point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.Mean_25).ToString(System.Globalization.CultureInfo.InvariantCulture) + " " +
                            p_Point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.Gaussian_25).ToString(System.Globalization.CultureInfo.InvariantCulture) + " " +
                            p_Point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.ShapeIndex_25).ToString(System.Globalization.CultureInfo.InvariantCulture) + " " +
                            p_Point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.CurvednessIndex_25).ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";

            bool ret = true;
            List<Cl3DModel.Cl3DModelPointIterator> neighborhood = null;
            for (int i = 5; i <= 10; i += 5)
            {
                ClTools.GetNeighborhoodWithGeodesicDistance(out neighborhood, p_Point, i);
                double Mean = 0;
                double Gaussian = 0;
                double SI = 0;
                double Curvadness = 0;
                int count = 0;
                double[] Histogram = new double[10];
                foreach (Cl3DModel.Cl3DModelPointIterator point in neighborhood)
                {
                    if (!point.GetFlag(0))
                    {
                        try
                        {
                            double SITemp = point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.ShapeIndex_25);
                            Histogram[(int)(SITemp * 9)]++;
                            Mean += point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.Mean_25);
                            Gaussian += point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.Gaussian_25);
                            SI += SITemp;
                            Curvadness += point.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.CurvednessIndex_25);
                            count++;
                        }
                        catch (Exception)
                        { }
                        point.SetFlag(0, true);
                       // point.Color = ClTools.GetColorRGB(((float)i) / 25, 1f);
                    }
                }
                if (count == 0)
                {
                    ret = false;
                }
                else
                {
                    descriptor += (Mean /= count).ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";
                    descriptor += (Gaussian /= count).ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";
                    descriptor += (SI /= count).ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";
                    descriptor += (Curvadness /= count).ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";
                    for (int j = 0; j < 10; j++)
                    {
                        descriptor += (Histogram[j] /= count).ToString(System.Globalization.CultureInfo.InvariantCulture) + " ";
                    }

                }
            }
            foreach (Cl3DModel.Cl3DModelPointIterator point in neighborhood)
            {
                point.SetFlag(0, false);
            }

            return ret;
        }