Retinal Model: Static Eye, X Cells, Different Spatial Scales, Color test

This is a model of the retina.  The current assumptions are that the eye is perfectly still and that the x cells, the only current cells modeled, can be characterized by DOG functions.  The output will be generated at 4 spatial scales, in order, automatically, with each successive scale with a peak spatial frequency at 1/2 of the previous cell array (that is, 1 octive lower).

To start using this model, input any 8bit bitmapped image.  The size is limited by the power of your computer and your patience in waiting for output.  Give the path for the image.  But first load this matrix manipulation function.

<< LinearAlgebra`MatrixManipulation`

Input Your image

inpic = 
        Import["C:\My Documents\Research\The Front \
End\Blythe\Red.bmp"];
retarray = inpic[[1, 1] ]; 
    Print["Dimensions of Input Array ",  Dimensions[retarray]]; 
    bigdim = Dimensions[retarray];

Show[inpic];

Print[Max[retarray]]
Print[Min[retarray]]

Set the baseline parameter for the ganglion cell

se  =  2; si = 6;

Run the model and go get lunch.

First separarate out the channel to processes from the complex array.  That is the command after the printing for the channel

\(\(Do[Print["Output for Channel ", channel]; 
        chanArray\  = \ retarray[\([All, All, channel]\)]; 
        Do[ses\  = \ se*2\^\((st - 1)\); sis = si*2\^\((st - 1)\); 
          width = 3*sis; 
          ganglion = 
            Table[\(\((sis/ses)\)\/\(\((ses)\)*\@\(2*Pi\)\)\) 
                    Exp[\(-\(\((\((i - width)\)\^2 + \((j - width)\)\^2)\)\/\((2*ses\^2)\)\)\)] - \(1\/\(\((sis)\)*\@\(2*Pi\)\)\) 
                    Exp[\(-\(\((\((i - width)\)\^2 + \((j - width)\)\^2)\)\/\((2*\((sis)\)\^2)\)\)\)] // N, {i, 2*width + 1}, {j, 
                2*width + 1}]; 
          upi = IntegerPart[\((bigdim[\([1]\)] - \((2*width + 1)\))\)/5]; 
          upj = IntegerPart[\((bigdim[\([2]\)] - \((2*width + 1)\))\)/5]; 
          Q = \((1/\((width)\))\); 
          If[st == 1, 
            If[channel == 1, Print["Make output Array for scale ", st]; 
              scale1Out = Table[0, {x, 3}, {y, upi}, {z, upj}];]]; 
          If[st == 2, 
            If[channel == 1, Print["Make output Array for scale ", st]; 
              scale2Out = Table[0, {x, 3}, {y, upi}, {z, upj}];]]; 
          If[st == 3, 
            If[channel == 1, Print["Make output Array for scale ", st]; 
              scale3Out = 
                Table[0, {x, 3}, {y, upi}, {z, 
                    upj}];]]; 
OutputArray = 
            Table[Q*Apply[Plus, 
                  Apply[Plus, 
                    ganglion*
                      SubMatrix[
                        chanArray, {\((i - 1)\)*5 + 1, \((j - 1)\)*5 + 
                            1}, {2*width + 1, 2*width + 1}]]], {i, 1, 
                upi}, {j, 1, upj}]; 
          If[st == 1, scale1 = OutputArray; 
            Do[Do[scale1Out[\([channel, x, y]\)] = scale1[\([x, y]\)], {x, 1, 
                  upi}], {y, 1, upj}];, 
            If[st == 2, scale2 = OutputArray; 
              Do[Do[scale2Out[\([channel, x, y]\)] = scale2[\([x, y]\)], {x, 
                    1, upi}], {y, 1, upj}];, scale3 = OutputArray; 
              Do[Do[scale3Out[\([channel, x, y]\)] = scale3[\([x, y]\)], {x, 
                    1, upi}], {y, 1, 
                  upj}];]]; 
Print["Output of the Retina at Excitatory SD ", ses, " and Inhibitory SD ", sis]; 
          Show[GraphicsArray[{SurfaceGraphics[OutputArray, \ 
                  Lighting -> False, PlotRange -> {\(-125\), 125}], 
                SurfaceGraphics[OutputArray, 
                  ViewPoint\  -> \ {0, 0, 1000}, Mesh -> False, 
                  Lighting -> False, 
                  PlotRange -> {\(-125\), 125}]}]];, {st, 
            2}];, {channel, 3}];\)\)

Print["Dimensions of Output Array for Scale 1",  
      Dimensions[scale1Out]]; Print[Min[scale1Out]]; 
    Print[Max[scale1Out]]
Print["Dimensions of Output Array for Scale 2",  
      Dimensions[scale2Out]]; Print[Min[scale2Out]]; 
    Print[Max[scale2Out]]