See [this link][1] for more details. 

## **The Problem:** ##
I want to loop through a continuous raster (one that has no attribute table), cell by cell, and get the value of the cell. I want to take those values and run the following conditionals on them, emulating the map algebra steps detailed below without actually using the raster calculator.

**The analysis needed:**
-------------------

If cell value is greater than top and bottom cells, give value of 1:

    Con("raster" > FocalStatistics("raster", NbrIrregular("C:\filepath\kernel_file.txt"), "MAXIMUM"), 1, 0)

Where kernel file looks like this:

    3 3 
    0 1 0
    0 0 0
    0 1 0

If cell value is greater than left and right cells, give value of 1:

    Con("raster" > FocalStatistics("raster", NbrIrregular("C:\filepath\kernel_file.txt"), "MAXIMUM"), 1, 0)

Where kernel file looks like this:

    3 3 
    0 0 0
    1 0 1
    0 0 0  

If cell value is greater than topleft and bottomright cells, give value of 1:

    Con("raster" > FocalStatistics("raster", NbrIrregular("C:\filepath\kernel_file.txt"), "MAXIMUM"), 1, 0)

Where kernel file looks like this:

    3 3 
    1 0 0
    0 0 0
    0 0 1 

If cell value is greater than bottomleft and topright cells, give value of 1:

    Con("raster" > FocalStatistics("raster", NbrIrregular("C:\filepath\kernel_file.txt"), "MAXIMUM"), 1, 0)

Where kernel file looks like this:

    3 3 
    0 0 1
    0 0 0
    1 0 0 

If **any** one of the adjacent cells has a value EQUAL to the center cell, give the output raster a value of 1 ([using focal variety with two nearest neighborhood calculations][2])


**Why not use map algebra?**
------------------------

Now it has been noted below that my solution could be solved using map algebra but as seen above this is a grand total of six raster calculations, plus one to combine all of the rasters created together. It seems to me that it is **much** more efficient to go cell-by-cell and do all of the comparisons at once in each cell instead of looping through each individually seven times and utilizing quite a bit of memory to create seven rasters. 

**How should the problem be attacked?**
-----------------------------------

The link above advises to use IPixelBlock interface, however it is unclear from ESRI documentation whether you are actually accessing a single cell value itself through IPixelBlock, or if you are accessing multiple cell values from the size of the IPixelBlock you set. A good answer should suggest a method for accessing the cell values of a continuous raster and provide an explanation of the methodology behind the code, if not apparently obvious.

**In summary:**
---------------

What is the best method to loop through every cell in a CONTINUOUS raster (which has **no attribute table**) to access its cell values? A good answer need not implement the analysis steps described above, it needs only to provide a methodology to access cell values of a raster.



  [1]: http://forums.esri.com/Thread.asp?c=93&f=993&t=144111
  [2]: http://gis.stackexchange.com/questions/70776/efficiently-check-for-equal-adjacent-values-in-raster-calculator