public void SetParameters(ref List <ushort> arr, int wid, int hei, double windowWidth,
                                  double windowCentre, bool resetScroll, Dicom 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;

            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();
        }
        public void UpdateWindowLevel(int winWidth, int winCentre, ImageBitsPerPixel bpp)
        {
            int winMin = Convert.ToInt32(winCentre - 0.5 * winWidth);
            int winMax = winMin + winWidth;

            this.windowLevelControl.SetWindowWidthCentre(winMin, winMax, winWidth, winCentre, bpp, signedImage);
        }
      public void SetParameters(ref List <byte> arr, int wid, int hei, double windowWidth,
                                double windowCentre, bool resetScroll)
      {
          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];


          imageAvailable = true;
          if (bmp != null)
          {
              bmp.Dispose();
          }
          ResetValues();
          ComputeLookUpTable8();
          bmp = new Bitmap(imgWidth, imgHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
          CreateImage8();
      }
Exemple #4
0
        public void SetParameters(ref List <byte> arr, int wid, int hei, double windowWidth,
                                  double windowCentre, int samplesPerPixel, bool resetScroll)
        {
            if (samplesPerPixel == 1)
            {
                bpp             = 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             = 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();
        }
Exemple #5
0
        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();
        }
Exemple #6
0
 public void SetWindowWidthCentre(int minVal, int maxVal, int widthVal, int centreVal,
                                  ImageBitsPerPixel bpp, bool sign)
 {
     winMin      = minVal;
     winMax      = maxVal;
     winWidth    = widthVal;
     winCentre   = centreVal;
     iBpp        = bpp;
     signedImage = sign;
     Invalidate();
 }
 public void SetWindowWidthCentre(int minVal, int maxVal, int widthVal, int centreVal, 
     ImageBitsPerPixel bpp, bool sign)
 {
     winMin = minVal;
     winMax = maxVal;
     winWidth = widthVal;
     winCentre = centreVal;
     iBpp = bpp;
     signedImage = sign;
     Invalidate();
 }
Exemple #8
0
 public void UpdateWindowLevel(int winWidth, int winCentre, ImageBitsPerPixel bpp)
 {
     try {
         int winMin = Convert.ToInt32(winCentre - 0.5 * winWidth);
         int winMax = winMin + winWidth;
         this.windowLevelControl.SetWindowWidthCentre(winMin, winMax, winWidth, winCentre, bpp, signedImage);
     }
     catch (Exception ex)
     {
         MessageBoxResult result = Xceed.Wpf.Toolkit.MessageBox.Show(ex.Message, Medicus.Properties.Resources.SiteWeb, MessageBoxButton.OK, MessageBoxImage.Stop);
     }
 }
 public void UpdateWindowLevel(int winWidth, int winCentre, ImageBitsPerPixel bpp)
 {
     int winMin = Convert.ToInt32(winCentre - 0.5 * winWidth);
     int winMax = winMin + winWidth;
     this.windowLevelControl.SetWindowWidthCentre(winMin, winMax, winWidth, winCentre, bpp, signedImage);
 }
        public void SetParameters(ref List<ushort> arr, int wid, int hei, double windowWidth, double windowCentre, bool resetScroll, MainForm 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, MainForm 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();
        }
        public void SetParameters(ref List<ushort> arr, int wid, int hei, double windowWidth,
            double windowCentre, bool resetScroll, MainForm 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;

            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();
        }