public void get_model(IList <int []> instances)
        {
            // Convert
            List <float []> instances_converted = new List <float []>();

            foreach (int [] instance in instances)
            {
                instances_converted.Add(ToolsCollection.ConvertToFloatArray(instance));
            }

            // Transform
            TransformWhiteningOld <Matrix <double> > transform = new TransformWhiteningOld <Matrix <double> >(new AlgebraLinearReal64MathNet(), ToolsCollection.ConvertToTable(instances_converted));
            IList <float[]> instances_transformed = new List <float[]>();

            foreach (float [] instance in instances_converted)
            {
                instances_transformed.Add(transform.Compute(instance));
            }

            // Cluster
            //IClusteringModel<float []> model = d_inner.get_model(instances_transformed); //TODO

            //return new KMeansDefaultWhiteningIntegerArrayModel(transform, model);
            //return null; // TODO
        }
        public float[] RandomSample(int sample_size)
        {
            double[] sample = new double[sample_size];
            Random   random = new Random();

            Normal.Samples(random, sample, Mean, StandardDeviation);
            return(ToolsCollection.ConvertToFloatArray(sample));
        }
        public int [] cluster_instances(IList <int []> instances)
        {
            IList <float []> instances_converted = new List <float []>();

            foreach (int [] instance in instances)
            {
                instances_converted.Add(ToolsCollection.ConvertToFloatArray(instance));
            }
            //return d_inner.cluster_instances(instances_converted);
            return(null);
        }
        public Renderer2DProjectionBool(int bitmap_size_x, int bitmap_size_y, float angle_axial_radians, float angle_slice_radians, float[] image_focus, float image_distance)
        {
            this.bitmap_size_x = bitmap_size_x;
            this.bitmap_size_y = bitmap_size_y;

            //isometric projection
            //http://www.wolframalpha.com/input/?i=%7B%7B1%2C+0+%2C0%7D%2C%7B0%2C+cos%28a%29%2C+sin%28a%29%7D%2C%7B0%2C+-sin%28a%29%2C+cos%28a%29%7D%7D.%7B%7Bcos%28b%29%2C+0%2C+-sin%28b%29%7D%2C%7B0%2C1%2C0%7D%2C%7Bsin%28b%29%2C+0+%2C+cos%28b%29%7D%7D
            float a = angle_slice_radians;
            float b = angle_axial_radians;

            this.projection_vector_x = ToolsCollection.ConvertToFloatArray(new double[] { Math.Cos(b), Math.Sin(a) * Math.Sin(b), Math.Cos(a) * Math.Sin(b) });
            this.projection_vector_y = ToolsCollection.ConvertToFloatArray(new double[] { 0, Math.Cos(a), -Math.Sin(a) });
            this.projection_vector_z = ToolsCollection.ConvertToFloatArray(new double[] { -Math.Sin(b), Math.Sin(a) * Math.Cos(b), Math.Cos(a) * Math.Cos(b) });
            this.image_focus         = image_focus;
        }
Beispiel #5
0
        public RendererImageRaster3DToBitmapMask3D(int bitmap_size_x, int bitmap_size_y, float angle_axial_radians, float angle_slice_radians, float[] image_focus, float image_distance)
        {
            this.bitmap_size_x = bitmap_size_x;
            this.bitmap_size_y = bitmap_size_y;
            //float [] vector_view = new float[3]; // unit vector in the direction we view, 0,0 is from the top the regular way,  should produce [0 0 0]
            //(0,0 should procux x = [1 0 0], y = [0 1 0])

            //isometric projection
            //http://www.wolframalpha.com/input/?i=%7B%7B1%2C+0+%2C0%7D%2C%7B0%2C+cos%28a%29%2C+sin%28a%29%7D%2C%7B0%2C+-sin%28a%29%2C+cos%28a%29%7D%7D.%7B%7Bcos%28b%29%2C+0%2C+-sin%28b%29%7D%2C%7B0%2C1%2C0%7D%2C%7Bsin%28b%29%2C+0+%2C+cos%28b%29%7D%7D
            float a = angle_slice_radians;
            float b = angle_axial_radians;

            this.projection_vector_x = ToolsCollection.ConvertToFloatArray(new double[] { Math.Cos(b), Math.Sin(a) * Math.Sin(b), Math.Cos(a) * Math.Sin(b) });
            this.projection_vector_y = ToolsCollection.ConvertToFloatArray(new double[] { 0, Math.Cos(a), -Math.Sin(a) });
            this.projection_vector_z = ToolsCollection.ConvertToFloatArray(new double[] { -Math.Sin(b), Math.Sin(a) * Math.Cos(b), Math.Cos(a) * Math.Cos(b) });
            this.image_focus         = image_focus;
        }