See this link for more details. I want to loop through a raster, 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.
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)
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.
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.
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?