Exemplo n.º 1
0
 public PathSet(float[][,] f, int sthick, int tolthick, DoseKernel dk, StructureSet ss)
 {
     X = f[0].GetLength(0); Y = f[0].GetLength(1); Z = f.GetLength(0);
     DK = dk; SS = ss;
     N = dk.dose.GetLength(0);
     boundaries = FindBoundaries(f);
     SliceThickness = sthick;
     DoseCalculationThickness = SliceThickness * 2;
     TolThickness = tolthick;
     CalculateNumSlices();
     RasterPaths = new ArrayList();
     for (int i = 0; i < NumSlices; i++)
     {
         RasterPath rp = new RasterPath(CompressSection(f, SlicePositions[i], SliceThickness / 2));
         RasterPaths.Add(rp);
     }
     volume = f;
     AttachHandlers();
 }
Exemplo n.º 2
0
 public static void RunAnalysis(PathSet PS, StructureSet SS, double rxlevel)
 {
     double rxdoselevel;
     double rtogindex;
     double lomaxscheib;
     double vantreits;
     PS.DoseSpace = Matrix.Normalize(PS.DoseSpace);
     AnalysisInfo ai = new AnalysisInfo();
     RX = rxlevel;
     int startingz = PS.SlicePositions[0] - (PS.DoseCalculationThickness / 2);
     AnalyzeLesionCoverage(PS.DoseSpace,SS.fj_Tumor,startingz);
     ai.RxLevel = RX;
     ai.LesionVolume = lesionvolume;
     ai.Rx_Volume = totalvolcoveredbyrx;
     ai.RxLesion_Volume = lesioncoveragebyrx;
     ai.RTOG = totalvolcoveredbyrx / lesionvolume;
     ai.LomaxScheib = lesioncoveragebyrx / totalvolcoveredbyrx;
     ai.VantReits = (lesioncoveragebyrx * lesioncoveragebyrx) / (lesionvolume * totalvolcoveredbyrx);
     ai.TestName = System.DateTime.Now.ToShortTimeString();
     AIList.Add(ai);
 }
Exemplo n.º 3
0
        public void CreateTumorObject(int radius)
        {
            N = 161;
            int length = radius + N;
            StructureSet.size = length;

            float[][] tumor = new float[length][];
            float[] slice; float dist;
            for (int z = 0; z < length; z++)
            {
                int x2; int y2; int z2;
                slice = new float[length*length];
                z2 = (int)Math.Pow(z - (length-1) / 2, 2);
                for (int i = 0; i < length; i++)
                {
                    x2 = (int)Math.Pow(i - (length - 1) / 2,2);
                    for (int j = 0; j < length; j++)
                    {
                        y2 = (int)Math.Pow(j - (length - 1) / 2,2);
                        dist = (float)Math.Sqrt(x2 + y2 + z2);
                        if (dist < radius/2)
                            slice[i+j*length] = 1;
                        else
                            slice[i+j*length] = 0;
                    }
                }
                tumor[z] = slice;
            }
            SS = new StructureSet(tumor);
            SS.SI.Size = length;
            SS.SI.CreateTestInfo(radius);
            SS.fj_Tumor = Convert1DJaggedto2DJagged(tumor, length, length);
            Plan_btn.IsEnabled = true;
        }
Exemplo n.º 4
0
        private void LoadStructure_Menu_Click(object sender, RoutedEventArgs e)
        {
            Stream dicomfile = null;

            Microsoft.Win32.OpenFileDialog opendicom = new Microsoft.Win32.OpenFileDialog();
            opendicom.Multiselect = true;
            if (opendicom.ShowDialog() != false)
            {
                if (opendicom.FileNames.GetLength(0) > 1)
                {
                    string h = ""; string t = "";
                    foreach (string s in opendicom.FileNames)
                    {
                        System.IO.FileInfo f = new FileInfo(s);
                        if (f.Extension == ".h")
                            h = s;
                        if (f.Extension == ".txt")
                            t = s;
                    }
                    SS = new StructureSet(h, t);

                }
                else
                {
                    dicomfile = opendicom.OpenFile();
                    //TM = new DICOMRT(opendicom.FileName, 0);
                }

                if (SS.f_structurearray != null)
                {
                    slider2.Minimum = 0;
                    slider2.Maximum = SS.f_structurearray.GetLength(0);
                    tabControl1.SelectedIndex = 1;
                }
                AddStructureLoadedToListBox();
                Plan_btn.IsEnabled = true;
            }
        }