r121: *** empty log message ***
[ctsim.git] / src / if-2.cpp
index 951b4314087747e03ace04230e6ef9d435f8133b..cbf0e79c44c3f695e7f6b897ed0e8331cc883dbc 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: if-2.cpp,v 1.7 2000/06/25 17:32:24 kevin Exp $
+**  $Id: if-2.cpp,v 1.8 2000/06/26 21:15:24 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -126,12 +126,12 @@ if2_main (int argc, char *const argv[])
   in_file2 = argv[optind + 1];
   out_file = argv[optind + 2];
 
-  pim_in1 = new ImageFile (in_file1);
-  pim_in2 = new ImageFile (in_file2);
+  pim_in1 = new ImageFile ();
+  pim_in2 = new ImageFile ();
   ImageFile& im_in1 = *pim_in1;
   ImageFile& im_in2 = *pim_in2;
 
-  if (! im_in1.fileRead() || ! im_in2.fileRead()) {
+  if (! im_in1.fileRead(in_file1) || ! im_in2.fileRead(in_file2)) {
       sys_error (ERR_WARNING, "Error reading an image");
       return (1);
   }
@@ -146,12 +146,8 @@ if2_main (int argc, char *const argv[])
       return(1);
   }
 
-  pim_out = new ImageFile (out_file, im_in1.nx(), im_in1.ny());
+  pim_out = new ImageFile (im_in1.nx(), im_in1.ny());
   ImageFile& im_out = *pim_out;
-  if (! im_out.fileCreate()) {
-    sys_error (ERR_WARNING, "Could not open output file %s", out_file);
-    return (1);
-  }
 
   string strOperation;
   ImageFileArray v1 = im_in1.getArray();
@@ -202,12 +198,11 @@ if2_main (int argc, char *const argv[])
     cout << "d=" << d << ", r=" << r << ", e=" << e << endl;
   }
 
-  im_out.arrayDataWrite();
   im_out.labelsCopy (im_in1, "if-2 file 1: ");
   im_out.labelsCopy (im_in2, "if-2 file 2: ");
   im_out.labelAdd (Array2dFileLabel::L_HISTORY, strOperation.c_str());
 
-  im_out.fileClose();
+  im_out.fileWrite(out_file);
 
   return (0);
 }