public void SetParameters(ref List <ushort> arr, int wid, int hei, double windowWidth, double windowCentre, bool resetScroll, ViewDicom mainFrm) { bpp = 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; if (signed16Image == true) { winCentre -= short.MinValue; } // Modify the 'sensitivity' of the mouse based on the original window width if (winWidth < 5000) { changeValWidth = 2; changeValCentre = 2; } else if (Width > 40000) { changeValWidth = 50; changeValCentre = 50; } else // it is inbetween 5000 and 40000 { changeValWidth = 25; changeValCentre = 25; } 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(); }
public void SetParameters(ref List <byte> arr, int wid, int hei, double windowWidth, double windowCentre, int samplesPerPixel, bool resetScroll, ViewDicom mainFrm) { if (samplesPerPixel == 1) { bpp = ImageBitsPerPixel.Eight; imgWidth = wid; imgHeight = hei; winWidth = Convert.ToInt32(windowWidth); winCentre = Convert.ToInt32(windowCentre); changeValWidth = 0.1; changeValCentre = 0.1; 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) // 30 July 2010 { bpp = 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(); }