/// <summary>
 /// Reads the header only from the specified mwi file.  The header is in xml format.
 /// This is a test.  We may have to jurry rig the thing to ensure it ignores the actual
 /// image content.
 /// </summary>
 /// <param name="filename">Whether this is the mwi or mwh file, this reads the mwh file for the filename.</param>
 public void ReadHeader(string filename)
 {
     string header = Path.ChangeExtension(filename, "mwh");
     XmlSerializer s = new XmlSerializer(typeof(PyramidHeader));
     TextReader r = new StreamReader(header);
     _header = (PyramidHeader) s.Deserialize(r);
     PyramidImageHeader ph = _header.ImageHeaders[0];
     Bounds = new RasterBounds(ph.NumRows, ph.NumColumns, ph.Affine);
     base.Width = _header.ImageHeaders[0].NumColumns;
     base.Height = _header.ImageHeaders[0].NumRows;
     r.Close();
 }
 /// <summary>
 /// This takes an original image and calculates the header content for all the lower resolution tiles.
 /// This does not actually write the bytes for those images.
 /// </summary>
 /// <param name="numRows">The number of rows in the original image</param>
 /// <param name="numColumns">The number of columns in the original image</param>
 /// <param name="affineCoefficients">
 /// the array of doubles in ABCDEF order
 /// X' = A + Bx + Cy
 /// Y' = D + Ex + Fy
 /// </param>
 public void CreateHeaders(int numRows, int numColumns, double[] affineCoefficients)
 {
     _header = new PyramidHeader();
     List<PyramidImageHeader> headers = new List<PyramidImageHeader>();
     int scale = 0;
     long offset = 0;
     int nr = numRows;
     int nc = numColumns;
     while (nr > 2 && nc > 2)
     {
         PyramidImageHeader ph = new PyramidImageHeader();
         ph.SetAffine(affineCoefficients, scale);
         ph.SetNumRows(numRows, scale);
         ph.SetNumColumns(numColumns, scale);
         ph.Offset = offset;
         offset += (ph.NumRows * ph.NumColumns * 4);
         nr = nr/ 2;
         nc = nc / 2;
         scale++;
         headers.Add(ph);
     }
     _header.ImageHeaders = headers.ToArray();
 }