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 14
14
import net .imglib2 .algorithm .neighborhood .RectangleNeighborhood ;
15
15
import net .imglib2 .algorithm .neighborhood .RectangleNeighborhoodFactory ;
16
16
import net .imglib2 .algorithm .neighborhood .RectangleShape .NeighborhoodsAccessible ;
17
+ import net .imglib2 .type .numeric .IntegerType ;
17
18
import net .imglib2 .type .numeric .RealType ;
18
19
import net .imglib2 .util .Util ;
19
20
import net .imglib2 .view .Views ;
@@ -119,8 +120,15 @@ private void computePlanar(final Position planePos,
119
120
for (int i = 0 ; i < kernel .length ; i ++) {
120
121
sum += kernel [i ] * n [i ];
121
122
}
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
+ }
124
132
125
133
outputRA .setPosition (cursor .getLongPosition (0 ), 0 );
126
134
outputRA .setPosition (cursor .getLongPosition (1 ), 1 );
You can’t perform that action at this time.
0 commit comments