Esempio n. 1
0
        private void PhaseRetrivalIteration(DataTable Dt, string SavePath)
        {
            if (Dt.NumUse() < 4)
            {
                Output("Please select at least four images, "
                       + "including a focal image, a reference image and at least two median images.");
                return;
            }

            if (Dt.NumType("Focal") != 1)
            {
                Output("Please select one and only one focal image.");
                return;
            }

            if (Dt.NumType("Reference") != 1)
            {
                Output("Please select one and only one reference image.");
                return;
            }

            string        FocalName  = null;
            int           FocalDist  = 0;
            List <String> MedianName = new List <string>();
            List <int>    MedianDist = new List <int>();
            string        ExportName = null;

            foreach (DataRow Dr in Dt.Rows)
            {
                if (Dr["Type"].ToString() == "Focal")
                {
                    FocalName = Dr.GetName();
                    FocalDist = int.Parse(Dr["Distance"].ToString());
                }

                if (Dr["Type"].ToString() == "Median")
                {
                    MedianName.Add(Dr.GetName());
                    MedianDist.Add(int.Parse(Dr["Distance"].ToString()));
                    ExportName = "RetrievedPhase";
                }

                if (Dr["Type"].ToString() == "Reference")
                {
                    continue;
                }
            }

            MWCharArray    MWMedianName = new MWCharArray(MedianName.ToArray());
            MWNumericArray MWMedianDist = new MWNumericArray(1, MedianDist.Count, MedianDist.ToArray());

            StreamWriter CancelWriter = new StreamWriter(SavePath + "\\Cancel.log");

            CancelWriter.BaseStream.SetLength(0);
            CancelWriter.WriteLine("Continue");
            CancelWriter.Dispose();

            Mf.RetrieveReferencePhase(SavePath, ExportName, MWParameter, 10000, FocalName, FocalDist, MWMedianName, MWMedianDist);
            Token.ThrowIfCancellationRequested();
        }