[Insight-users] The saved file is always empty

Luis Ibanez luis.ibanez at kitware.com
Mon, 08 Mar 2004 09:47:38 -0500


Hi Chuc,


How are you building this image ?

Have you checked the content of the image ?

You could try somehting like:

  std::ofstream spyfile("spytheimage.txt");
  m_image->Print( spyfile );
  spyfile.close();

in order  to verify the size of regions in
your image...


Regards,


   Luis



-------------------
chuc wrote:
> Hello :
>  
> I had a problem.When I reading an image successfully and want to save it ,
>  
> however ,the image which I saved is empty (0 kB) .
>  
> I don't know where the problem is.      
>                                                             
>  
> This is my code:
>  
> BOOL CMy1Doc::OnSaveDocument(LPCTSTR lpszPathName)
> {
>  // TODO: Add your specialized code here and/or call the base class
>  m_ImageWriter->SetFileName( lpszPathName );
>  m_ImageWriter->SetInput(m_image);
>  
>  try {
>   m_ImageWriter->Update();
>  }
>  catch (itk::ExceptionObject & err)
>  {
>   AfxMessageBox("err");
>  }
> 
>  return CDocument::OnSaveDocument(lpszPathName);
> }
>                                                                                                                      Thanks!!     
> 
>