Beispiel #1
0
        public void SetParameters(ref List <ushort> arr, int wid, int hei, double windowWidth,
                                  double windowCentre, bool resetScroll, DXWindow mainFrm)
        {
            bpp       = DossierPatient.ImageBitsPerPixel.Sixteen;
            imgWidth  = wid;
            imgHeight = hei;
            winWidth  = Convert.ToInt32(windowWidth);
            winCentre = Convert.ToInt32(windowCentre);

            sizeImg  = imgWidth * imgHeight;
            sizeImg3 = sizeImg * 3;
            double sizeImg3By4 = sizeImg3 / 4.0;

            DetermineMouseSensitivity();

            pix16         = arr;
            imagePixels16 = new byte[sizeImg3];

            mf             = mainFrm;
            imageAvailable = true;
            if (bmp != null)
            {
                bmp.Dispose();
            }
            ResetValues();
            ComputeLookUpTable16();
            bmp = new Bitmap(imgWidth, imgHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            CreateImage16();
            if (resetScroll == true)
            {
                ComputeScrollBarParameters();
            }
            Invalidate();
        }
Beispiel #2
0
        public void SetParameters(ref List <byte> arr, int wid, int hei, double windowWidth,
                                  double windowCentre, int samplesPerPixel, bool resetScroll, DXWindow mainFrm)
        {
            if (samplesPerPixel == 1)
            {
                bpp             = DossierPatient.ImageBitsPerPixel.Eight;
                imgWidth        = wid;
                imgHeight       = hei;
                winWidth        = Convert.ToInt32(windowWidth);
                winCentre       = Convert.ToInt32(windowCentre);
                changeValWidth  = 0.1;
                changeValCentre = 20.0;
                sizeImg         = imgWidth * imgHeight;
                sizeImg3        = sizeImg * 3;

                pix8         = arr;
                imagePixels8 = new byte[sizeImg3];

                mf             = mainFrm;
                imageAvailable = true;
                if (bmp != null)
                {
                    bmp.Dispose();
                }
                ResetValues();
                ComputeLookUpTable8();
                bmp = new Bitmap(imgWidth, imgHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                CreateImage8();
            }

            if (samplesPerPixel == 3)
            {
                bpp             = DossierPatient.ImageBitsPerPixel.TwentyFour;
                imgWidth        = wid;
                imgHeight       = hei;
                winWidth        = Convert.ToInt32(windowWidth);
                winCentre       = Convert.ToInt32(windowCentre);
                changeValWidth  = 0.1;
                changeValCentre = 0.1;
                sizeImg         = imgWidth * imgHeight;
                sizeImg3        = sizeImg * 3;

                pix24         = arr;
                imagePixels24 = new byte[sizeImg3];

                mf             = mainFrm;
                imageAvailable = true;
                if (bmp != null)
                {
                    bmp.Dispose();
                }
                ResetValues();
                ComputeLookUpTable8();
                bmp = new Bitmap(imgWidth, imgHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                CreateImage24();
            }
            if (resetScroll == true)
            {
                ComputeScrollBarParameters();
            }
            Invalidate();
        }