Example #1
0
        /*  По умолчанию область*/
        private void Reset_Click(object sender, EventArgs e)
        {
            if (pixels8 != null || pixels16 != null)
            {
                if ((pixels8.Count > 0) || (pixels16.Count > 0))
                {
                    EraseHistogramArray();
                    winWidth             = dec.windowWidth;
                    winCentre            = dec.windowCentre;
                    ImagePlane.viewcolor = false;
                    if (bpp == 8)
                    {
                        if (spp == 1)
                        {
                            ImagePlane.SetParameters(ref pixels8, imageWidth, imageHeight, winWidth, winCentre, spp, false, this, histogram, inkColor);
                        }
                    }

                    if (bpp == 16)
                    {
                        ImagePlane.SetParameters(ref pixels16, intercept, imageWidth, imageHeight, winWidth, winCentre, false, this, ref histogram, inkColor);
                    }
                }
            }
            else
            {
                MessageBox.Show("Загрузите DICOM файл перед восстановлением параметров!");
            }
        }
Example #2
0
        private void DisplayData()
        {
            imageWidth  = dec.width;
            imageHeight = dec.height;
            bpp         = dec.bitsAllocated; // количество бит на пиксель
            winCentre   = dec.windowCentre;  // средняя величина между самым ярким и самым тусклым пикселем
            winWidth    = dec.windowWidth;   // разница между самым ярким и самым тусклым пикселем
            spp         = dec.samplesPerPixel;
            if (dec.rescaleIntercept < 0)
            {
                dec.signedImage = true;
            }
            signedImage = dec.signedImage;
            ImagePlane.Signed16Image = dec.signedImage; // short или ushort изображение
            ImagePlane.NewImage      = true;
            histogram = new long[256];
            if (spp == 1 && bpp == 8)
            {
                pixels8.Clear();
                pixels16.Clear();
                dec.GetPixels8(ref pixels8);
                if (winCentre == 0 && winWidth == 0)
                {
                    winWidth  = 256;
                    winCentre = 128;
                }
                ImagePlane.SetParameters(ref pixels8, imageWidth, imageHeight, winWidth, winCentre, spp, true, this, histogram, inkColor);
            }
            if (spp == 1 && bpp == 16)
            {
                pixels16.Clear();
                pixels8.Clear();
                dec.GetPixels16(ref pixels16);
                intercept = (short)dec.rescaleIntercept;
                slope     = (short)dec.rescaleSlope;

                // Учитываем Modality LUT
                if (dec.rescaleIntercept < 0)
                {
                    for (int i = 0; i < pixels16.Count; i++)
                    {
                        pixels16[i] = (ushort)(((short)(pixels16[i] * slope + intercept)) + 32768);
                    }
                }
                if (winCentre == 0 && winWidth == 0)
                {
                    winWidth  = 65536;
                    winCentre = 32768;
                }

                if (!navi)
                {
                    for (int i = 0; i < pixels16.Count; i++)
                    {
                        pixels_volume.Add(pixels16[i]);
                    }
                }

                ImagePlane.SetParameters(ref pixels16, intercept, imageWidth, imageHeight, winWidth, winCentre, true, this, ref histogram, inkColor);
                ColoredTFobj.PassAlong(this);
            }

            /* если у нас 16bpp lossless CT изображение */
            if (spp == 1 && bpp == 16 && dec.compressedImage)
            {
                // позже доделать чтение lossless и учет предсказателя, притом что дерево уже построенно правильно и есть сырые данные
            }
        }