]> Creatis software - creaBruker.git/blobdiff - lib/src1/brukerobjectvaryingproperties.cpp
Added CMake configuration to enable CDash tests.
[creaBruker.git] / lib / src1 / brukerobjectvaryingproperties.cpp
index f33a396bb10a6754262e0d281d0867d8968e5a8b..66af40deab0839f351a6cb96a7f83a10d173331d 100644 (file)
@@ -1,3 +1,29 @@
+/*
+       # ---------------------------------------------------------------------
+       #
+       # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
+       #                        pour la Santé)
+       # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+       # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+       # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+       #
+       #  This software is governed by the CeCILL-B license under French law and 
+       #  abiding by the rules of distribution of free software. You can  use, 
+       #  modify and/ or redistribute the software under the terms of the CeCILL-B 
+       #  license as circulated by CEA, CNRS and INRIA at the following URL 
+       #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
+       #  or in the file LICENSE.txt.
+       #
+       #  As a counterpart to the access to the source code and  rights to copy,
+       #  modify and redistribute granted by the license, users are provided only
+       #  with a limited warranty  and the software's author,  the holder of the
+       #  economic rights,  and the successive licensors  have only  limited
+       #  liability. 
+       #
+       #  The fact that you are presently reading this means that you have had
+       #  knowledge of the CeCILL-B license and that you accept its terms.
+       # ------------------------------------------------------------------------
+*/
 //
 // C++ Implementation: brukerobjectvaryingproperties
 //
@@ -100,15 +126,20 @@ int  BrukerObjectVaryingProperties::getAcquisitionOrder(unsigned int theValue) c
 }*/
 
 void BrukerObjectVaryingProperties::computeAcquisitionOrder(std::map<std::string, BrukerFieldData> & BrukerHM, std::vector<int> & LoopStruct){
-   std::vector<int> AcqOrder;
-  if (BrukerHM[(std::string) "ACQ_obj_order"].GetIntValue().size() != LoopStruct[3]*LoopStruct[1]) throw 7;
+  std::vector<int> AcqOrder;
+  
+  if (BrukerHM[(std::string) "ACQ_obj_order"].GetIntValue().size() != LoopStruct[3]*LoopStruct[1]) {
+     std::cout << "BrukerHM[(std::string) 'ACQ_obj_order'].GetIntValue().size() " << BrukerHM[(std::string) "ACQ_obj_order"].GetIntValue().size() 
+               << " LoopStruct[3] : " << LoopStruct[3] << " * LoopStruct[1] : " << LoopStruct[1] << " = " << LoopStruct[3]*LoopStruct[1] << std::endl;  
+     throw 7;
+  }
   if (LoopStruct.size() < 4 ) throw 8;
   for (int i =0 ;i<LoopStruct[3];i++)
      AcqOrder.push_back((int) BrukerHM[(std::string) "ACQ_obj_order"].GetIntValue()[i*LoopStruct[1]]/LoopStruct[1]);
   AcquisitionOrder=AcqOrder;
 };
 
-std :: vector < std :: vector < double > >  BrukerObjectVaryingProperties::getOrientation(unsigned int theValue) const{
+std :: vector < std :: vector < double > >  BrukerObjectVaryingProperties::getOrientation(unsigned int theValue) const {
    if (theValue < Orientation.size())return Orientation[theValue];
    //else throw 9;
    else throw BrukerSizeException("Orientation", theValue, Orientation.size() );
@@ -205,7 +236,7 @@ void BrukerObjectVaryingProperties::computePositionTimePerNR(std::map<std::strin
 /*!
     \fn BrukerObjectVaryingProperties::init(std::map<std::string, BrukerFieldData> BrukerHM,std::vector<int> LoopStruct)
  */
-bool BrukerObjectVaryingProperties::init(std::map<std::string, BrukerFieldData> & BrukerHM, std::vector<int> & LoopStruct)
+bool BrukerObjectVaryingProperties::init(std::map<std::string, BrukerFieldData> &BrukerHM, std::vector<int> &LoopStruct)
 {
    try {
       computeAcquisitionOrder (BrukerHM, LoopStruct);
@@ -216,7 +247,13 @@ bool BrukerObjectVaryingProperties::init(std::map<std::string, BrukerFieldData>
       computePositionTimePerNR(BrukerHM, LoopStruct);
       computeTE               (BrukerHM);
    }
-   
+   catch (int i)
+   {
+      std::cout << "Failure during BrukerObjectVaryingProperties::init err code : " << i << std::endl;
+      if (i==7)
+         std::cout << "Probabely non standard acquisition (extra loop not yet dealt with)" << std::endl;
+      return false;   
+   }   
    catch (...)
    {
       std::cout << "Failure during BrukerObjectVaryingProperties::init " << std::endl;