@@ -139,7 +139,7 @@ class FindDataService @Inject()(dataServicesHolder: BinaryDataServiceHolder)(imp
139
139
140
140
def createHistogram (dataSource : DataSource , dataLayer : DataLayer ): Fox [List [Histogram ]] = {
141
141
142
- def calculateHistogramValues (data : Array [_ >: UByte with UShort with UInt with ULong with Float ],
142
+ def calculateHistogramValues (data : Array [_ >: UByte with Byte with UShort with UInt with ULong with Float ],
143
143
bytesPerElement : Int ,
144
144
isUint24 : Boolean ) = {
145
145
val counts = if (isUint24) Array .ofDim[Long ](768 ) else Array .ofDim[Long ](256 )
@@ -157,10 +157,14 @@ class FindDataService @Inject()(dataServicesHolder: BinaryDataServiceHolder)(imp
157
157
extrema = (0 , 255 )
158
158
} else
159
159
byteData.foreach(el => counts(el.toInt) += 1 )
160
+ case byteData : Array [Byte ] => {
161
+ byteData.foreach(el => counts(el.toInt + 128 ) += 1 )
162
+ extrema = (- 128 , 128 )
163
+ }
160
164
case shortData : Array [UShort ] =>
161
165
shortData.foreach(el => counts((el / UShort (256 )).toInt) += 1 )
162
- case intData : Array [UInt ] =>
163
- intData .foreach(el => counts((el / UInt (16777216 )).toInt) += 1 )
166
+ case uintData : Array [UInt ] =>
167
+ uintData .foreach(el => counts((el / UInt (16777216 )).toInt) += 1 )
164
168
case longData : Array [ULong ] =>
165
169
longData.foreach(el => counts((el / ULong (math.pow(2 , 56 ).toLong)).toInt) += 1 )
166
170
case floatData : Array [Float ] =>
@@ -186,7 +190,7 @@ class FindDataService @Inject()(dataServicesHolder: BinaryDataServiceHolder)(imp
186
190
for {
187
191
dataConcatenated <- getConcatenatedDataFor(dataSource, dataLayer, positions, mag) ?~> " dataset.noData"
188
192
isUint24 = dataLayer.elementClass == ElementClass .uint24
189
- convertedData = toUnsigned (filterZeroes(convertData(dataConcatenated, dataLayer.elementClass), skip = isUint24))
193
+ convertedData = toMaybeUnsigned (filterZeroes(convertData(dataConcatenated, dataLayer.elementClass), skip = isUint24))
190
194
} yield calculateHistogramValues(convertedData, dataLayer.bytesPerElement, isUint24)
191
195
192
196
if (dataLayer.resolutions.nonEmpty)
0 commit comments