Esempio n. 1
0
        private void hScrollBar2_Scroll(object sender, ScrollEventArgs e)
        {
            int    WW  = 0;
            int    WL  = 0;
            Load   ld  = new Load();
            int    w   = 257;
            int    h   = 268;
            double rWW = (double)this.hScrollBar1.Value / this.hScrollBar1.Maximum;
            double rWL = (double)this.hScrollBar2.Value / this.hScrollBar1.Maximum;

            if (radioButton4.Checked)
            {
                if (CommonRawDataZoom.Length > 0)
                {
                    int[] range = ld.getmax(CommonRawDataZoom);
                    WW    = (int)(rWW * (range[1] - range[0]) + 1); //窗宽
                    WL    = (int)(rWL * (range[1] - range[0]));     //窗位
                    ld.Ww = WW;
                    ld.Wl = WL;
                    this.pictureBox4.Image          = (Image)ld.Extract(CommonRawDataZoom, w, h);
                    this.toolStripStatusLabel1.Text = "当前第" + countshowslice + "张图。" + "窗宽:" + WW + "窗位:" + WL;
                }
            }
            else if (radioButton3.Checked)
            {
                if (CommonproRawDataZoom.Length > 0)
                {
                    int[] range = ld.getmax(CommonproRawDataZoom);
                    WW    = (int)(rWW * (range[1] - range[0]) + 1); //窗宽
                    WL    = (int)(rWL * (range[1] - range[0]));     //窗位
                    ld.Ww = WW;
                    ld.Wl = WL;
                    this.pictureBox2.Image          = (Image)ld.Extract(CommonproRawDataZoom, w, h);
                    this.toolStripStatusLabel1.Text = "当前第" + countshowprojection + "张图。" + "窗宽:" + WW + "窗位:" + WL;
                }
            }
            else
            {
                MessageBox.Show("请先选择操作区域:点击中央区域的四个单选项之一");
            }
        }
Esempio n. 2
0
        private void ShowNextSlice(int i)
        {
            string ww = this.textBox1.Text.ToString();
            string wl = this.textBox2.Text.ToString();
            int    WW = 0;
            int    WL = 0;

            Load ld = new Load();

            int w = 257;
            int h = 268;

            if (radioButton4.Checked)
            {
                try
                {
                    CommonRawDataZoom = new ushort[w * h];
                    Bitmap bp         = new Bitmap(w, h);
                    int    totalslice = ReconstructionSliceRawDataZoom.Count;
                    if (totalslice > 0)
                    {
                        CommonRawDataZoom = ReconstructionSliceRawDataZoom[i - 1];
                        int[] range = ld.getmax(CommonRawDataZoom);
                        if (ww != "" && wl != "")
                        {
                            WW    = int.Parse(ww);
                            WL    = int.Parse(wl);
                            ld.Wl = WW;
                            ld.Ww = WL;
                        }
                        else
                        {
                            if (this.hScrollBar1.Value == 0 && this.hScrollBar2.Value == 0)
                            {
                                WW    = range[1] - range[0];
                                WL    = (int)WW / 2;
                                ld.Ww = WW;
                                ld.Wl = WL;
                            }
                            else
                            {
                                double rWW = (double)this.hScrollBar1.Value / this.hScrollBar1.Maximum;
                                double rWL = (double)this.hScrollBar2.Value / this.hScrollBar1.Maximum;
                                WW    = (int)(rWW * (range[1] - range[0]) + 1); //窗宽
                                WL    = (int)(rWL * (range[1] - range[0]));     //窗位
                                ld.Ww = WW;
                                ld.Wl = WL;
                            }
                        }
                        bp = ld.Extract(CommonRawDataZoom, w, h);
                        this.pictureBox4.Image = (Image)bp;
                        String current_filename = dictory[i - 1];
                        int    xs    = current_filename.LastIndexOf("\\");
                        string name1 = current_filename.Substring(xs + 1);

                        this.toolStripStatusLabel1.Text = "共载入" + totalslice + "张图,这是第" + i + "张图" + name1 + ".窗宽:" + WW + "窗位:" + WL;
                    }
                    else
                    {
                        this.toolStripStatusLabel1.Text = "未将重建结果载入内存";
                    }
                }
                catch (System.Exception e)
                {
                    MessageBox.Show("文件未找到或不符合要求");
                    this.toolStripStatusLabel1.Text = "文件未找到或不符合要求";
                }
            }
            else if (radioButton3.Checked)
            {
                CommonproRawDataZoom = new ushort[w * h];
                if (originalPath == null)
                {
                    MessageBox.Show("请将投影数据载入:LoadData->projection->Normal");
                }
                else
                {
                    try
                    {
                        System.UInt16[] temp = ld.LoadrawData((originalPath + "\\" + i + ".raw"), VOIInfo.nWidth, VOIInfo.nWidth);
                        CommonproRawDataZoom = ld.LinerInterpolation(temp, VOIInfo.nWidth, VOIInfo.nWidth);
                        int[] range = ld.getmax(CommonproRawDataZoom);
                        if (ww != "" && wl != "")
                        {
                            WW    = int.Parse(ww);
                            WL    = int.Parse(wl);
                            ld.Wl = WW;
                            ld.Ww = WL;
                        }
                        else
                        {
                            if (this.hScrollBar1.Value == 0 && this.hScrollBar2.Value == 0)
                            {
                                WW    = range[1] - range[0];
                                WL    = (int)WW / 2;
                                ld.Ww = WW;
                                ld.Wl = WL;
                            }
                            else
                            {
                                double rWW = (double)this.hScrollBar1.Value / this.hScrollBar1.Maximum;
                                double rWL = (double)this.hScrollBar2.Value / this.hScrollBar1.Maximum;
                                WW    = (int)(rWW * (range[1] - range[0]) + 1); //窗宽
                                WL    = (int)(rWL * (range[1] - range[0]));     //窗位
                                ld.Ww = WW;
                                ld.Wl = WL;
                            }
                        }
                        Bitmap bp = new Bitmap(w, h);
                        bp = ld.Extract(CommonproRawDataZoom, w, h);
                        this.pictureBox2.Image          = (Image)bp;
                        this.toolStripStatusLabel1.Text = "这是第" + i + "张图";
                    }
                    catch (System.Exception e)
                    {
                        MessageBox.Show("文件未找到或不符合要求");
                        this.toolStripStatusLabel1.Text = "文件未找到或不符合要求";
                    }
                }
            }
        }