Ejemplo n.º 1
0
    static void Main( string[] args )
    {
        List<int[]> images = new List<int[]>();

          string[] files = System.IO.Directory.GetFiles( @"..\..\Images\samples", "*.bmp" );
          foreach( string filename in files )
          {
           int[] image = Load( filename );
           images.Add( image );
          }

          MacroColumn macro = new MacroColumn( images[0].Length, 5 );

          //do_draw_column_activity = true;

          //  macro.PrintReceptiveFields( "fields.txt", 16, 16 );
          //macro.DrawReceptiveFields( "fields.bmp", w, h );

          macro.on_iteration_end = DrawColumnActivity;

          for( int v_cycle = 0; v_cycle < 1000; ++v_cycle )
          {
           if( ( v_cycle % 5 ) == 0 )
           {
        int i = (int)( Init.rnd.NextDouble() * images.Count );
        int[] input_image = images[i];
        macro.SetInputData( input_image );
           }

           macro.Do_VCycle( true );
           Console.WriteLine( "cycle #={2} total_afferent_weight={0} count_afferents={1}", macro.GetTotalAfferentWeight(), macro.CountActiveAfferents(), v_cycle );

           //   macro.DrawReceptiveFields( string.Format( "fields_{0}.bmp", v_cycle ), w, h );

           if( ( v_cycle % 10 ) == 0 )
           {
        // выведем карты афферентной чувствительности для каждой микроколонки
        //macro.PrintReceptiveFields( "fields.txt", w, h );
        string filename = string.Format( "fields_{0}.bmp", v_cycle );
        macro.DrawReceptiveFields( filename, w, h );
        wrt_seq.WriteLine( "{0}", filename );
        wrt_seq.Flush();
           }
           /**/
          }

          return;
    }