示例#1
0
    public void PrintReceptiveField( double[,] field, LinearIndexTo2D convert_1d_2d )
    {
        for( int i = 0; i < afferents.Count; ++i )
          {
           int x, y;
           convert_1d_2d.Convert( afferents[i].index, out x, out y );
           field[x, y] += afferents[i].R;
          }

          return;
    }
示例#2
0
    public void PrintReceptiveFields( System.IO.StreamWriter wrt, LinearIndexTo2D convert_1d_2d )
    {
        double[,] field = new double[convert_1d_2d.w, convert_1d_2d.h];
          for( int x = 0; x < convert_1d_2d.w; ++x )
           for( int y = 0; y < convert_1d_2d.h; ++y )
           {
        field[x, y] = 0.0;
           }

          for( int i = 0; i < pyramids.Count; ++i )
          {
           pyramids[i].PrintReceptiveField( field, convert_1d_2d );
          }

          for( int y = 0; y < convert_1d_2d.h; ++y )
          {
           for( int x = 0; x < convert_1d_2d.w; ++x )
           {
        char c = '░';
        if( field[x, y] > 0.66 )
         c = '▓';
        else if( field[x, y] > 0.33 )
         c = '▒';

        wrt.Write( c );
           }

           wrt.WriteLine( "" );
          }

          return;
    }
示例#3
0
    public void PrintReceptiveFields( string filename, int RF_w, int RF_h )
    {
        LinearIndexTo2D convert = new LinearIndexTo2D( RF_w, RF_h );

          using( System.IO.StreamWriter wrt = new System.IO.StreamWriter( filename ) )
          {
           for( int i = 0; i < columns.Count; ++i )
           {
        wrt.WriteLine( "\nColumn #{0}", i );

        columns[i].PrintReceptiveFields( wrt, convert );
           }
          }

          return;
    }
示例#4
0
    public void DrawReceptiveFields( Bitmap bmp, int x_offset, LinearIndexTo2D convert_1d_2d )
    {
        double[,] field = new double[convert_1d_2d.w, convert_1d_2d.h];
          for( int x = 0; x < convert_1d_2d.w; ++x )
           for( int y = 0; y < convert_1d_2d.h; ++y )
           {
        field[x, y] = 0.0;
           }

          for( int i = 0; i < pyramids.Count; ++i )
          {
           pyramids[i].PrintReceptiveField( field, convert_1d_2d );
          }

          /*
        // ------------ debug
        int n1 = 0;
        for( int y = 0; y < convert_1d_2d.h; ++y )
        {
         for( int x = 0; x < convert_1d_2d.w; ++x )
         {
          if( field[x, y] == 1.0 )
           n1++;
         }
        }
        // ------------
          */

          for( int y = 0; y < convert_1d_2d.h; ++y )
          {
           for( int x = 0; x < convert_1d_2d.w; ++x )
           {
        int z = (int)( 255 * field[x, y] );
        if( z > 255 )
         z = 255;

        // ~~~~~ debug
        //int z = field[x,y]>=0.0 ? 255 : 0;

        Color c = Color.FromArgb( z, z, z );
        bmp.SetPixel( x_offset + x, y, c );
           }
          }

          return;
    }
示例#5
0
    public void DrawReceptiveFields( string filename, int RF_w, int RF_h )
    {
        LinearIndexTo2D convert = new LinearIndexTo2D( RF_w, RF_h );

          Bitmap bmp = new Bitmap( ( RF_w + 1 ) * columns.Count, RF_h );

          for( int i = 0; i < columns.Count; ++i )
          {
           columns[i].DrawReceptiveFields( bmp, i * ( RF_w + 1 ), convert );
          }

          bmp.Save( filename, System.Drawing.Imaging.ImageFormat.Bmp );

          return;
    }