From: jean-pierre roux Date: Thu, 2 Jul 2009 16:06:18 +0000 (+0000) Subject: Fix bug when checking incoherences X-Git-Tag: CREATOOLS.2-0-3~40 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=8793028706f4b66bc966466c5d0009038109a4d3;p=creaBruker.git Fix bug when checking incoherences --- diff --git a/lib/src1/bruker2dicom.cxx b/lib/src1/bruker2dicom.cxx index eac2702..a381993 100644 --- a/lib/src1/bruker2dicom.cxx +++ b/lib/src1/bruker2dicom.cxx @@ -403,7 +403,13 @@ void Bruker2Dicom::DealWithNiveau2(std::string level2Directory, std::string curr std::cout << "And Exception was thrown in DealWithNiveau3 (" << e.what() << "); " << " We skip [" << level2Directory << "]" << std::endl; continue; - } + } + catch (BrukerInitException &e) + { + std::cout << "And Init Exception was thrown in DealWithNiveau3 (" << e.what() << "); " + << " We skip [" << level2Directory << "]" << std::endl; + continue; + } } } } @@ -509,7 +515,7 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr if (!canOpen) { std::cout << "Hopeless! FillMap failed on [" << str_reco << "]" << std::endl; - throw ( BrukerHopelessException ("Hopeless!FillMap failed on 'reco'")); + throw ( BrukerHopelessException ("Hopeless! FillMap failed on 'reco'")); //exit(0); /// \TODO throw an exception ! } //std::cout << "------------------------------------------------------------------------------------------------" << std::cout; @@ -608,8 +614,9 @@ void Bruker2Dicom::DealWithNiveau3(std::string level3Directory, std::string curr } catch (BrukerInitException& e) { - std::cout << "an Exception was throw in CreateImageSet ( ); " << e.what() - << "catched in DealWithNiveau3" << std::endl; + if (verbose) + std::cout << "an Init Exception was thrown in CreateImageSet ( ); " << e.what() + << "catched in DealWithNiveau3" << std::endl; //return; throw (e); } @@ -1118,11 +1125,12 @@ std::vector Bruker2Dicom::CreateImageSet ( ) br_acqp.SetLoopStructure(); std::vector tempVect = br_acqp.GetLoopStructure() ; std::map map = br_acqp.GetBrukerHeaderMap(); + bool result = br_acqp.ObjectVaryingProperties.init(map,tempVect); if (result == false) { - throw ( BrukerInitException ("Bruker2Dicom::CreateImageSet failure ") ); + throw ( BrukerInitException ("ObjectVaryingProperties.init() failure in Bruker2Dicom::CreateImageSet()") ); } br_acqp.SetImageLoopStructure(); @@ -1153,7 +1161,7 @@ std::vector Bruker2Dicom::CreateImageSet ( ) imageOrientation = imageSet[i].getRotationMatrixRPS2XYZ(); std::cout << "\t Orientation " ; for(int i1=0; i1<3;i1++)for(int i2=0; i2<3;i2++) - std::cout << imageOrientation[i1][i2] << " "; + std::cout << imageOrientation[i1][i2] << " ";CreateImageSet //std::cout << "\t Abs Time " << imageSet[i].getAbsoluteTimePosition(); std::cout << "\t Relat Time " << imageSet[i].getRelativeTimePosition(); diff --git a/lib/src1/brukerobjectvaryingproperties.cpp b/lib/src1/brukerobjectvaryingproperties.cpp index f33a396..1222eae 100644 --- a/lib/src1/brukerobjectvaryingproperties.cpp +++ b/lib/src1/brukerobjectvaryingproperties.cpp @@ -100,15 +100,20 @@ int BrukerObjectVaryingProperties::getAcquisitionOrder(unsigned int theValue) c }*/ void BrukerObjectVaryingProperties::computeAcquisitionOrder(std::map & BrukerHM, std::vector & LoopStruct){ - std::vector AcqOrder; - if (BrukerHM[(std::string) "ACQ_obj_order"].GetIntValue().size() != LoopStruct[3]*LoopStruct[1]) throw 7; + std::vector 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 > 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 +210,7 @@ void BrukerObjectVaryingProperties::computePositionTimePerNR(std::map BrukerHM,std::vector LoopStruct) */ -bool BrukerObjectVaryingProperties::init(std::map & BrukerHM, std::vector & LoopStruct) +bool BrukerObjectVaryingProperties::init(std::map &BrukerHM, std::vector &LoopStruct) { try { computeAcquisitionOrder (BrukerHM, LoopStruct); @@ -216,7 +221,13 @@ bool BrukerObjectVaryingProperties::init(std::map 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;