private void ApplyFilter() { int orignalPage = _cell.Image.Page; _cell.Image.Page = _cell.ActiveSubCell + 1; _region = _cell.Image.GetRegion(null); _cell.RemoveRegion(); HistogramEqualizeType type = HistogramEqualizeType.None; switch (_cbColorSpace.SelectedIndex) { case 0: type = HistogramEqualizeType.Rgb; break; case 1: type = HistogramEqualizeType.Yuv; break; case 2: type = HistogramEqualizeType.Gray; break; } HistogramEqualizeCommand command = new HistogramEqualizeCommand(type); _mainForm.FilterRunCommand(command, false, true); _cell.Image.SetRegion(null, _region, RasterRegionCombineMode.Set); if (_cell.Image.BitsPerPixel == 8) { _cell.SetWindowLevel(_cell.ActiveSubCell, 255, 128); } else if (_cell.Image.BitsPerPixel == 16) { _cell.SetWindowLevel(_cell.ActiveSubCell, 65000, 32000); } _cell.Image.Page = orignalPage; _cell.Invalidate(); }