protected void PerformPerformanceTest(string file)
        {
            if (File.Exists(file))
            {
                double[] elapsed = new double[Iterations];

                TileContents c = new TileContents();

                for (int idx = 0; idx < Iterations; idx++)
                {
                    DateTime dt = DateTime.Now;
                    int count = AquisitionFile.Read(file, c);
                    elapsed[idx] = DateTime.Now.Subtract(dt).TotalSeconds;
                    Console.WriteLine("{0} Acquisition data in {1:F3}", idx, elapsed[idx]);
                    Thread.Sleep(IterationDelay * 1000);
                }

                if (Iterations > 1)
                {
                    Console.WriteLine("Average in {0:F3}", elapsed.Average());
                }
            }
            else
            {
                Console.WriteLine("{0:F3} is not available for testing.", file);
            }
        }
        public Tile()
        {
            ExpectedChannelCount = 2;
            MinTiffFileSize = 0;

            _haveMicroscope = false;
            _haveAcquisition = false;

            _isEvaluated = false;

            Contents = new TileContents();
        }
        public static int Read(string filename, TileContents contents)
        {
            double x = Double.NaN, y = Double.NaN, z = Double.NaN;

            int x_idx = -1, y_idx = -1, z_idx = -1;

            int cutCount = -1;

            // Return the number of expected fields read as a possible quick check for completeness.
            int fieldCount = 0;

            // Relatively ugly, brute force parse.
            if (File.Exists(filename))
            {
                IEnumerable<string> lines = File.ReadLines(filename);

                foreach (var line in lines)
                {
                    var parts = line.Split(':');

                    if (parts.Length == 2)
                    {
                        switch (parts[0].Trim())
                        {
                            case "x_mm":
                                if (!Double.TryParse(parts[1].Trim(), out x))
                                    x = Double.NaN;
                                fieldCount++;
                                break;
                            case "y_mm":
                                if (!Double.TryParse(parts[1].Trim(), out y))
                                    y = Double.NaN;
                                fieldCount++;
                                break;
                            case "z_mm":
                                if (!Double.TryParse(parts[1].Trim(), out z))
                                    z = Double.NaN;
                                fieldCount++;
                                break;
                            case "x":
                                if (!Int32.TryParse(parts[1].Trim(), out x_idx))
                                    x_idx = -1;
                                fieldCount++;
                                break;
                            case "y":
                                if (!Int32.TryParse(parts[1].Trim(), out y_idx))
                                    y_idx = -1;
                                fieldCount++;
                                break;
                            case "z":
                                if (!Int32.TryParse(parts[1].Trim(), out z_idx))
                                    z_idx = -1;
                                fieldCount++;
                                break;
                            case "cut_count":
                                if (!Int32.TryParse(parts[1].Trim(), out cutCount))
                                    cutCount = -1;
                                fieldCount++;
                                break;
                        }
                    }
                }
            }

            contents.Position = new Position<double>() { X = x, Y = y, Z = z };

            contents.LatticePosition = new Position<int>() { X = x_idx, Y = y_idx, Z = z_idx };

            contents.CutCount = cutCount;

            return fieldCount;
        }