From 1a56f9236f745e6db474dc6ec96fa5fc62f4ef97 Mon Sep 17 00:00:00 2001
From: Matthew Webster <mwebster@fmrib.ox.ac.uk>
Date: Fri, 8 Aug 2008 14:08:39 +0000
Subject: [PATCH] beta of fslfromascii

---
 fslfromascii.cc | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100755 fslfromascii.cc

diff --git a/fslfromascii.cc b/fslfromascii.cc
new file mode 100755
index 0000000..7ff89f4
--- /dev/null
+++ b/fslfromascii.cc
@@ -0,0 +1,37 @@
+//     fsl2ascii.cc - convert AVW to raw ASCII text
+//     Stephen Smith and Matthew Webster, FMRIB Image Analysis Group
+//     Copyright (C) 2001-2005 University of Oxford  
+//     COPYRIGHT  
+#include "newimage/newimageall.h"
+#include "miscmaths/miscmaths.h"
+#include <fstream>
+
+using namespace NEWIMAGE;
+using namespace MISCMATHS;
+
+void print_usage(const string& progname) {
+  cout << endl;
+  cout << "Usage: fslfromascii <input> <xsize> <ysize> <zsize> <tsize> <output>" << endl;
+}
+
+
+int main(int argc,char *argv[])
+{
+  if (argc != 7) 
+  { 
+     print_usage(string(argv[0]));
+     return 1; 
+  }
+  volume4D<float> output_volume(atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]));
+  ifstream input(argv[1]);
+  for(int t=0;t<=output_volume.maxt();t++)
+    for(int z=0;z<=output_volume.maxz();z++)
+      for(int y=0;y<=output_volume.maxy();y++)
+	for(int x=0;x<=output_volume.maxx();x++)
+	  input >> output_volume(x,y,z,t);
+	    save_volume4D(output_volume,string(argv[6]));
+  input.close();
+  return 0;
+}
+
+
-- 
GitLab