private void AccumulateFrameDataWithYCompression(IDataReader reader, int width, int height, int startScan, int startBin,
                                                         int endBin, ref int[][] frameData, int minMzBin, int maxMzBin, int xCompression, double[] calibTable)
        {
            // each pixel accumulates more than 1 bin of data
            for (var scansData = 0; scansData / xCompression < width && reader.Read(); scansData++)
            {
                var scanNum = GetInt32(reader, "ScanNum");
                ValidateScanNumber(scanNum);

                var currentScan            = scanNum - startScan;
                var compressedBinIntensity = (byte[])(reader["Intensities"]);

                if (compressedBinIntensity.Length == 0)
                {
                    continue;
                }

                var compressedScan = currentScan;
                if (xCompression > 1)
                {
                    compressedScan = currentScan / xCompression;
                }

                var pixelY = 0;

                var binIntensities = IntensityConverterCLZF.Decompress(compressedBinIntensity, out int _);

                foreach (var binIntensity in binIntensities)
                {
                    var binIndex = binIntensity.Item1;
                    if (binIndex < startBin || binIndex < minMzBin)
                    {
                        continue;
                    }
                    if (binIndex > endBin || binIndex > maxMzBin)
                    {
                        break;
                    }

                    double calibratedBin = binIndex;

                    if (height == 1)
                    {
                        frameData[compressedScan][0] += binIntensity.Item2;
                    }
                    else
                    {
                        for (var j = pixelY; j < height; j++)
                        {
                            if (calibTable[j] > calibratedBin)
                            {
                                pixelY = j;
                                frameData[compressedScan][pixelY] += binIntensity.Item2;
                                break;
                            }
                        }
                    }
                }
            }
        }
        private void AccumulateFrameDataNoYCompression(IDataReader reader, int width, int startScan, int startBin, int endBin,
                                                       ref int[][] frameData, int minMzBin, int maxMzBin, int xCompression)
        {
            for (var scansData = 0; (scansData / xCompression < width) && reader.Read(); scansData++)
            {
                var scanNum = GetInt32(reader, "ScanNum");
                ValidateScanNumber(scanNum);

                var currentScan            = scanNum - startScan;
                var compressedBinIntensity = (byte[])(reader["Intensities"]);

                if (compressedBinIntensity.Length == 0)
                {
                    continue;
                }

                var compressedScan = currentScan;
                if (xCompression > 1)
                {
                    compressedScan = currentScan / xCompression;
                }

                var binIntensities = IntensityConverterCLZF.Decompress(compressedBinIntensity, out int _);

                foreach (var binIntensity in binIntensities.Where(x => x.Item1 >= startBin && x.Item1 >= minMzBin && x.Item1 <= endBin && x.Item1 <= maxMzBin))
                {
                    var binIndex = binIntensity.Item1;
                    //if (binIndex < startBin || binIndex < minMzBin)
                    //{
                    //    continue;
                    //}
                    //if (binIndex > endBin || binIndex > maxMzBin)
                    //{
                    //    break;
                    //}
                    frameData[compressedScan][binIndex - startBin] += binIntensity.Item2;
                }
            }
        }