From 05ed7aa115b08b485aeed2658c798b133d71178d Mon Sep 17 00:00:00 2001
From: Nicola Vigano <nicola.vigano@esrf.fr>
Date: Thu, 12 Jul 2012 19:14:37 +0000
Subject: [PATCH] TomoUtils: added a function to generate infoVol data
 structure (for gtRead*)

Signed-off-by: Nicola Vigano <nicola.vigano@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@658 4c865b51-4357-4376-afb4-474e03ccb993
---
 zUtil_DataStructures/gtCreateInfoVol.m      | 15 +++++++++++++++
 zUtil_TomoUtils/gtGetHST_FileNamesAndType.m |  2 +-
 zUtil_TomoUtils/gtHST_info.m                |  6 +-----
 3 files changed, 17 insertions(+), 6 deletions(-)
 create mode 100644 zUtil_DataStructures/gtCreateInfoVol.m

diff --git a/zUtil_DataStructures/gtCreateInfoVol.m b/zUtil_DataStructures/gtCreateInfoVol.m
new file mode 100644
index 00000000..08cbb7d1
--- /dev/null
+++ b/zUtil_DataStructures/gtCreateInfoVol.m
@@ -0,0 +1,15 @@
+function infoVol = gtCreateInfoVol(volSize, dtype, dbyteorder)
+    if (~exist('dtype', 'var'))
+        dtype = 'float32';
+    end
+    if (~exist('dbyteorder', 'var'))
+        [~, ~, dbyteorder] = computer();
+    end
+
+    infoVol.volSizeX = volSize(1);
+    infoVol.volSizeY = volSize(2);
+    infoVol.volSizeZ = volSize(3);
+
+    infoVol.ftype = dtype;
+    infoVol.fbyteorder = dbyteorder;
+end
diff --git a/zUtil_TomoUtils/gtGetHST_FileNamesAndType.m b/zUtil_TomoUtils/gtGetHST_FileNamesAndType.m
index e683fff1..35cb1143 100644
--- a/zUtil_TomoUtils/gtGetHST_FileNamesAndType.m
+++ b/zUtil_TomoUtils/gtGetHST_FileNamesAndType.m
@@ -81,7 +81,7 @@ function [fnames, fpath, datatype] = gtGetHST_FileNamesAndType(full_fname)
         throw(Mexc);
     end
 
-    % Deciding Filetype
+    % Guessing most likely Filetype
     if isfield(fnames, 'raw')
         % going with the 8 bit file
         datatype = 'uint8';
diff --git a/zUtil_TomoUtils/gtHST_info.m b/zUtil_TomoUtils/gtHST_info.m
index 9e5d6f83..f8e6233f 100644
--- a/zUtil_TomoUtils/gtHST_info.m
+++ b/zUtil_TomoUtils/gtHST_info.m
@@ -53,13 +53,9 @@ function hst_header = gtHST_info(full_fname)
         bytespervoxel = 1;
     end
 
-    hst_header.volSizeX = volSizeX;
-    hst_header.volSizeY = volSizeY;
-    hst_header.volSizeZ = volSizeZ;
+    hst_header = gtCreateInfoVol([volSizeX volSizeY volSizeZ], true_ftype, fbyteorder);
     hst_header.bytespervoxel = bytespervoxel;
     hst_header.fpath = fpath;
     hst_header.fname_final = fname_final;
-    hst_header.fbyteorder = fbyteorder;
-    hst_header.ftype = true_ftype;
     hst_header.fname_prefix = fnames.prefix;
 end
-- 
GitLab