[Insight-developers] [Fwd: Re: MetaImage debugging]

Stephen R. Aylward aylward at unc . edu
Thu, 22 Aug 2002 11:28:33 -0400


Thanks Luis and Martin!!!

-------- Original Message --------
Subject: Re: MetaImage debugging
Date: Thu, 22 Aug 2002 17:21:45 +0200
From: Martin Styner <martin_styner@ieee.org>
To: Luis Ibanez <luis.ibanez@kitware.com>
CC: martin.garcia@epfl.ch, "Stephen R. Aylward" <aylward@unc.edu>, 
Julien Jomier <jjomier@cs.unc.edu>
References: <3D641981.2060609@kitware.com> <3D64B948.9010308@ieee.org> 
<3D64E335.2030705@kitware.com>

Hi everybody
The problem is solved ! Here is the info about what was wrong.

It comes down to this: gcc 2.95.2 on solaris 8 requires that upon
opening of an input and output stream with additional flags, one also
specifies the std::io::in, resp std::io::out. My STL book (Josuttis's
The C++ Standard Library) does actually not state, whether user supplied
flags should superseed the default (which is 'in' for input streams and
'out' for output streams) or  get 'OR'-ed with he default. The example
in the book actually shows the 'OR'-ing of 'app' and 'out' for an output
stream.... Maybe other compilers are just more intelligent than the gcc
2.95.2 on solaris 8, since it doesn't make sense to open an input stream
without being able to 'input' anything...

Anyway, the changes thus are: instead of:
someInputStream->open(filename,std::ios::binary)  use
someInputStream->open(filename,std::ios::binary | std::ios::in)

and instead of
someOutputStream->open(filename,std::ios::binary)  use
someOutputStream->open(filename,std::ios::binary | std::ios::out)


I have attached the cvs diff to the end of this email. Julien, thanks in
advance for incorporating the changes into the cvs repository!

similar changes are needed in the following locations:

./Auxiliary/MetaImage/MetaImageLib.cxx:
iReadFilePointer.open(_fname,std::ios::binary);
./Auxiliary/MetaImage/MetaImageLib.cxx:        fp->open(fName,
std::ios::binary );
./Auxiliary/MetaImage/MetaImageLib.cxx:
iWriteFilePointer.open(_headname, std::ios::binary );
./Examples/StreamedWatershedSegmentation/VolumeChunker/vhunchunker.cxx:
   m_ostream.open(fn, std::ios::trunc);
./Examples/StreamedWatershedSegmentation/VolumeChunker/vhunchunker.cxx:
       m_ostream.open(name.c_str(), std::ios::trunc);
./Utilities/MetaIO/metaBlob.cxx:  m_ReadStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaBlob.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaBlob.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary | std::ios::app );
./Utilities/MetaIO/metaEllipse.cxx:  m_ReadStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaEllipse.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaEllipse.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary | std::ios::app );
./Utilities/MetaIO/metaLine.cxx:  m_ReadStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaLine.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaLine.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary | std::ios::app );
./Utilities/MetaIO/metaScene.cxx:  m_ReadStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaScene.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaSurface.cxx:  m_ReadStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaSurface.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaSurface.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary | std::ios::app );
./Utilities/MetaIO/metaTube.cxx:  m_ReadStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaTube.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary);
./Utilities/MetaIO/metaTube.cxx:  m_WriteStream->open(m_FileName,
std::ios::binary | std::ios::app );

best wishes
Martin

Index: Utilities/MetaIO/metaImage.cxx
===================================================================
RCS file: /cvsroot/Insight/Insight/Utilities/MetaIO/metaImage.cxx,v
retrieving revision 1.8
diff -r1.8 metaImage.cxx
582c582
<   m_ReadStream->open(m_FileName, std::ios::binary);
---
  >   m_ReadStream->open(m_FileName, std::ios::binary | std::ios::in);
650c650
<           readStreamTemp->open(fName, std::ios::binary);
---
  >           readStreamTemp->open(fName, std::ios::binary | std::ios::in);
708c708
<         readStreamTemp->open(fName, std::ios::binary);
---
  >         readStreamTemp->open(fName, std::ios::binary | std::ios::in);
736c736
<       readStreamTemp->open(fName, std::ios::binary);
---
  >       readStreamTemp->open(fName, std::ios::binary | std::ios::in);
774c774
<   m_WriteStream->open(m_FileName, std::ios::binary);
---
  >   m_WriteStream->open(m_FileName, std::ios::binary | std::ios::out);
819c819
<           writeStreamTemp->open(fName, std::ios::binary);
---
  >           writeStreamTemp->open(fName, std::ios::binary | 
std::ios::out);
827c827
<         writeStreamTemp->open(dataFileName, std::ios::binary);
---
  >         writeStreamTemp->open(dataFileName, std::ios::binary |
std::ios::out);
1160c1160
<   m_WriteStream->open(m_FileName, std::ios::binary | std::ios::app );
---
  >   m_WriteStream->open(m_FileName, std::ios::binary | std::ios::app |
std::ios::out);
1201c1201
<         writeStreamTemp->open(fName, std::ios::binary);
---
  >         writeStreamTemp->open(fName, std::ios::binary | std::ios::out);
1209c1209
<       writeStreamTemp->open(dataFileName, std::ios::binary);
---
  >       writeStreamTemp->open(dataFileName, std::ios::binary |
std::ios::out);
1335c1335
<   /*m_ReadStream->open(m_FileName, std::ios::binary);
---
  >   /*m_ReadStream->open(m_FileName, std::ios::binary | std::ios::out);
1395c1395
<         readStreamTemp->open(fName, std::ios::binary);
---
  >         readStreamTemp->open(fName, std::ios::binary | std::ios::in);
1443c1443
<       readStreamTemp->open(fName, std::ios::binary);
---
  >       readStreamTemp->open(fName, std::ios::binary | std::ios::in);
1471c1471
<     readStreamTemp->open(fName, std::ios::binary);
---
  >     readStreamTemp->open(fName, std::ios::binary | std::ios::in);





Luis Ibanez wrote:
 >
 > Hi All,
 >
 > I'll like to test the IRC connection if
 > any of you are available...
 >
 > I'm connected right now to "opennet" using
 > the Mozilla client as Martin suggested.
 > (altough any client should do it).
 >
 > The channel is:     #itk-users
 >
 > Here is 9:10 am (east coast),
 >
 > I'll be testing the compilation of the zip that
 > Martin (Garcia) send me.
 >
 > See you on IRC...
 >
 >
 > Luis
 >
 >
 > ================================================
 >
 > Martin Styner wrote:
 >
 >> Hi everybody
 >>
 >> That sounds like a good idea. btw, I have attached the Meta header
 >> (mhd) file of one of our test examples. A good itk-example code would
 >> probably be MetaImageViewer ?
 >>
 >> IRC should be ok, I am using the Mozilla-Chat client. Which IRC server
 >> should we use (e.g. opennet, slashnet)
 >>
 >> How about 4pm our time = 10 am US East Coast ?
 >> Thanks
 >> Martin
 >>
 >
 >



-- 
Martin Styner, PhD. Ing. ETH
Group Head Medical Image Analysis for Orthopedics
M.E. Mueller Institute for Biomechanics
Center for Computed Assisted Surgery
University of Bern
Murtenstrasse 35
P.O.Box 30
CH - 3010 Bern
Switzerland
Tel office: ++41-31-632-8784 , FAX: ++41-31-632-4951
email: Martin.Styner@memot.unibe.ch, martin_styner@ieee.org
WWW: http://cranium.unibe.ch/~mstyner



-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695