public Bitmap GetBitmap(double min, double max, ScaleTypes scaleType)
        {
            ScaleMap scale;

            lastScale     = scaleType;
            lastBitmapMin = min;
            lastBitmapMax = max;

            switch (scaleType)
            {
            default:
            case ScaleTypes.Linear:
                scale = new ScaleLinear(min, max);
                break;

            case ScaleTypes.Log:
                scale = new ScaleLog(min, max);
                break;

            case ScaleTypes.Power:
                scale = new ScalePow(min, max);
                break;

            case ScaleTypes.SquareRoot:
                scale = new ScaleSqrt(min, max);
                break;

            case ScaleTypes.HistogramEqualization:
                scale = new HistogramEqualization(this, min, max);
                break;
            }

            try
            {
                switch (DataType)
                {
                case DataTypes.Byte:
                    return(GetBitmapByte(min, max, scale));

                case DataTypes.Int16:
                    return(GetBitmapShort(min, max, scale));

                case DataTypes.Int32:
                    return(GetBitmapInt(min, max, scale));

                case DataTypes.Float:
                    return(GetBitmapFloat(min, max, scale));

                case DataTypes.Double:
                    return(GetBitmapDouble(min, max, scale));

                case DataTypes.None:
                default:
                    return(new Bitmap(100, 100));
                }
            }
            catch
            {
                return(new Bitmap(10, 10));
            }
        }
Пример #2
0
        public Bitmap GetBitmap(double min, double max, ScaleTypes scaleType)
        {
            ScaleMap scale;
            lastScale = scaleType;
            lastBitmapMin = min;
            lastBitmapMax = max;

            switch (scaleType)
            {
                case ScaleTypes.Linear:
                    scale = new ScaleLinear(min, max);
                    break;
                case ScaleTypes.Log:
                    scale = new ScaleLog(min, max);
                    break;
                case ScaleTypes.Power:
                    scale = new ScalePow(min, max);
                    break;
                case ScaleTypes.SquareRoot:
                    scale = new ScaleSqrt(min, max);
                    break;
                case ScaleTypes.HistogramEqualization:
                    scale = new HistogramEqualization(this, min, max);
                    break;
                default:
                    // use linear otherwise
                    scale = new ScaleLinear(min, max);
                    break;
            }

            try
            {
                switch (DataType)
                {
                    case DataTypes.Byte:
                        return GetBitmapByte(min, max, scale);
                    case DataTypes.Int16:
                        return GetBitmapShort(min, max, scale);
                    case DataTypes.Int32:
                        return GetBitmapInt(min, max, scale);
                    case DataTypes.Float:
                        return GetBitmapFloat(min, max, scale);
                    case DataTypes.Double:
                        return GetBitmapDouble(min, max, scale);
                    default:
                        // case DataTypes.None:
                        return new Bitmap(100, 100);
                }
            }
            catch
            {
                return new Bitmap(10,10);
            }
        }