File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/main/java/net/imagej/ops/filter/sharpen Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1414import net .imglib2 .algorithm .neighborhood .RectangleNeighborhood ;
1515import net .imglib2 .algorithm .neighborhood .RectangleNeighborhoodFactory ;
1616import net .imglib2 .algorithm .neighborhood .RectangleShape .NeighborhoodsAccessible ;
17+ import net .imglib2 .type .numeric .IntegerType ;
1718import net .imglib2 .type .numeric .RealType ;
1819import net .imglib2 .util .Util ;
1920import net .imglib2 .view .Views ;
@@ -119,8 +120,15 @@ private void computePlanar(final Position planePos,
119120 for (int i = 0 ; i < kernel .length ; i ++) {
120121 sum += kernel [i ] * n [i ];
121122 }
122-
123- double value = sum / scale ;
123+
124+ //find the value for the output
125+ double value ;
126+ if (type instanceof IntegerType ) {
127+ value = (sum + scale / 2 ) / scale ;
128+ }
129+ else {
130+ value = sum / scale ;
131+ }
124132
125133 outputRA .setPosition (cursor .getLongPosition (0 ), 0 );
126134 outputRA .setPosition (cursor .getLongPosition (1 ), 1 );
You can’t perform that action at this time.
0 commit comments