public void ReAllocate(CShape s, Type ti, int bandSize,object memory, bool deleteWhenDone, int rowSize)
        {
            // Set up the type_id, shape, and size info
            m_shape = s;                        // image shape (dimensions)
            m_pTI = ti;                      // pointer to type_info class
              //  m_bandSize = bandSize;                 // size of each band in bytes
            m_bandSize = 1; //try this modification as stated below
            m_pixSize = m_bandSize * s.nBands;    // stride between pixels in bytes
               // m_pixSize = 1 * s.nBands; //change this since in c# each channel only takes up "One" unit of memory so the pixel is defined by the number of channels

            // Do the real allocation work
            //in c++ bool is 0 so if rowsize was zero it would do the more complicated step
               // m_rowSize = (rowSize>0) ? m_pixSize * rowSize :     // stride between rows in bytes
               //               (m_pixSize * s.width + 7) & -8;     // round up to 8 (quadwords)
            m_rowSize = (rowSize > 0) ? m_pixSize * rowSize :
                                        (s.nBands * s.width);
            int nBytes = m_rowSize * s.height;
            if (memory == null && nBytes > 0)          // allocate if necessary
            {
                memory = new double[(nBytes + 7) / 8];
                m_memory = new List<double>();
                for (int i = 0; i < nBytes; i++)
                {
                    m_memory.Add(0);
                }
                if (memory == null)
                    throw new Exception(string.Format("CImage::Reallocate: could not allocate %d bytes", nBytes));
            }
              //  m_memStart = (char*)memory;           // start of addressable memory
               // m_memory.ReAllocate(nBytes, memory, deleteWhenDone);
        }
 // " ignoring the number of bands?
 public bool SameIgnoringNBands(CShape reference)
 {
     // Are two shapes the same ignoring the number of bands?
     return (width == reference.width &&
             height == reference.height);
 }
 public CImage(CShape s, Type ti, int bandSize)
 {
     SetDefaults();
     ReAllocate(s, ti, bandSize, null, true, 0);
 }
 public void ReAllocate(CShape c, Type ti, int bandSize, bool evenIfShapeDiffers = false)
 {
     if (!evenIfShapeDiffers && c == m_shape && ti == m_pTI && bandSize == m_bandSize)
         return;
     ReAllocate(c, ti, bandSize, 0, true, 0);
 }