From 3035b67ed9345b5fccf5bc11dd4bb6b37b70208e Mon Sep 17 00:00:00 2001
From: Jesper Andersson <jesper.andersson@ndcn.ox.ac.uk>
Date: Fri, 1 Mar 2024 13:46:20 +0000
Subject: [PATCH] Coordinated check of readout time with eddy

---
 topupfns.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/topupfns.cpp b/topupfns.cpp
index f8e6bfb..b0387d1 100644
--- a/topupfns.cpp
+++ b/topupfns.cpp
@@ -78,6 +78,9 @@ topup_clp::topup_clp(const Utilities::Option<string>&            imain,
 
   // Check file with Phase-encode vectors and read-out times
   if (int(_datafile.N()) != nvols) throw TopupException(string("topup_clp::topup_clp: Mismatch between ")+imain.value()+string(" and ")+datain.value());
+  for (unsigned int i=0; i<_datafile.N(); i++) {
+    if (_datafile.ReadOutTime(i+1) < 0.01 || _datafile.ReadOutTime(i+1) > 0.2) throw TopupException("topup_clp::topup_clp: Unrealistic read-out time, should be in range 0.01-0.2 s");
+  }
 
   // Go through all parameters that are defined
   // Once per level and make sure they agree
-- 
GitLab