renjianshun

How can I use IMapAlgebraOp to achieve the Raster Neiborhood Statistics?

Discussion created by renjianshun on Feb 16, 2014
I have a code like this:
...................
IGeoDataset pGeoDataset = pDataset as IGeoDataset;
 IMapAlgebraOp rsalgebra = new RasterMapAlgebraOpClass();
 IRasterAnalysisEnvironment rasAnaEnv = (IRasterAnalysisEnvironment)rsalgebra;
...................

 rsalgebra.BindRaster(pGeoDataset, "R");
//FocalStatistics([R],NbrRectangle(7,7,"CELL"),"MINORITY","NODATA")
String mpastr = "FocalStatistics([R]," + "NbrRectangle(7,7," + "\"" + "CELL" + "\"" + ")," + "\"" + "MINORITY" + "\"" + "," + "\"" + "NODATA" + "\"" + ")";                                                                
IGeoDataset outGetDataset=rsalgebra.Execute(mpastr);

I use ArcEngine 10.1 SDK and want achieve the FocalStatistics function same as in ArcGIS Desktop. I run this code and get messages"
ERROR 010328: Syntax error at or near symbol ,.
ERROR 010267: Syntax error in parsing grid expression.
But when I use the text got when run the code by tracks 'String var mpastr' in the code,I got "  FocalStatistics([R],NbrRectangle(7,7,"CELL"),"MINORITY","NODATA")    " ,and get write result in ArcGIS Desktop.
I want to know how can I write the expression as mpastr to excute FocalStatistics Functions?
Thanks!

Outcomes