From de9123fd9ee8d26fc3ac820b32babc2b4133c5c2 Mon Sep 17 00:00:00 2001
From: Matthew Webster <mwebster@fmrib.ox.ac.uk>
Date: Wed, 13 Jul 2016 14:37:43 +0000
Subject: [PATCH] fix dims

---
 fslmerge.cc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fslmerge.cc b/fslmerge.cc
index 50f95a6..d5c3df8 100755
--- a/fslmerge.cc
+++ b/fslmerge.cc
@@ -44,7 +44,7 @@ int fmrib_main(int argc, char *argv[])
     return(1);
   }
 
-  int xdimtot(header.dim[0]), ydimtot(header.dim[1]), zdimtot(header.dim[2]), tdimtot(header.dim[3]);
+  int xdimtot(header.dim[1]), ydimtot(header.dim[2]), zdimtot(header.dim[3]), tdimtot(header.dim[4]);
 
   if(direction==4)
   {
@@ -55,10 +55,10 @@ int fmrib_main(int argc, char *argv[])
   for(int vol = 4; vol < argc; vol++)
   {       
     header=reader.loadHeader(string(argv[vol]));
-    if (direction==0) tdimtot+=header.dim[3];
-    if (direction==1) xdimtot+=header.dim[0]; 
-    if (direction==2) ydimtot+=header.dim[1];
-    if (direction==3) zdimtot+=header.dim[2];
+    if (direction==0) tdimtot+=header.dim[4];
+    if (direction==1) xdimtot+=header.dim[1]; 
+    if (direction==2) ydimtot+=header.dim[2];
+    if (direction==3) zdimtot+=header.dim[3];
   }
   volume4D<T> output_volume(xdimtot,ydimtot,zdimtot,tdimtot);
   read_volume4D(input_volume,string(argv[3]));  
-- 
GitLab