Exemplo n.º 1
0
bool CTiffWriter::writeImageHeader()
{
  // create the out stream if not done so already
  if(0 == m_pImageStream)
  {
    m_pImageStream = new ofstream();
  }

  // open the stream. If already open, reset it
  if(m_pImageStream->is_open())
  {
    m_pImageStream->seekp(0);
  }
  else
  {
    m_pImageStream->open(m_filename.c_str(), ios_base::out|ios_base::binary|ios_base::trunc);
  }
  stringstream Header;
  GetImageHeader(Header);
  Header.seekp(0, ios_base::end);
  m_nOffset =(int) Header.tellp();
  Header.seekg(0, ios_base::beg);
  char *pData = new char[m_nOffset];
  Header.read(pData,m_nOffset);
  m_pImageStream->write(pData,m_nOffset);
  delete []pData;
  return true;
}
Exemplo n.º 2
0
BOOL CHistogram::ValidHeader(ImgHeader h1)
{
   ImgHeader h2 = GetImageHeader(m_numChannels);
   if (h1.type     != h2.type     ) return FALSE;
   if (h1.channels != h2.channels ) return FALSE;
   if (h1.width    != h2.width    ) return FALSE;
   if (h1.height   != h2.height   ) return FALSE;
   if (h1.plane    != h2.plane    ) return FALSE;
   return TRUE;
}