X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Fsrc1%2Fbrukerobjectvaryingproperties.cpp;h=2d6f733f2ceeeed6f2f1f4a7c48cd99991a6dac8;hb=e290be9f28dc24bfb58f239c098b67c2a76cfbd9;hp=69ddf7f64ddf8778dbbe05af2dd50246c1bbf694;hpb=c23d68fe2d14a4c4f4b164fdc447f38247f0efc3;p=creaBruker.git diff --git a/lib/src1/brukerobjectvaryingproperties.cpp b/lib/src1/brukerobjectvaryingproperties.cpp index 69ddf7f..2d6f733 100644 --- a/lib/src1/brukerobjectvaryingproperties.cpp +++ b/lib/src1/brukerobjectvaryingproperties.cpp @@ -10,7 +10,7 @@ // // #include "brukerobjectvaryingproperties.h" - +//#include "brukerexception.h" BrukerObjectVaryingProperties::BrukerObjectVaryingProperties() @@ -24,94 +24,94 @@ BrukerObjectVaryingProperties::~BrukerObjectVaryingProperties() -void BrukerObjectVaryingProperties::setPositionS(std::map & BrukerHM){ +void BrukerObjectVaryingProperties::computePositionS(std::map & BrukerHM){ std::vector PosiS =BrukerHM[(std::string) "ACQ_slice_offset"].GetDoubleValue(); PositionS =PosiS; }; -void BrukerObjectVaryingProperties::setPositionR(std::map & BrukerHM){ +void BrukerObjectVaryingProperties::computePositionR(std::map & BrukerHM){ PositionR =BrukerHM[(std::string) "ACQ_read_offset"].GetDoubleValue() ; }; -void BrukerObjectVaryingProperties::setPositionP(std::map & BrukerHM){ +void BrukerObjectVaryingProperties::computePositionP(std::map & BrukerHM){ PositionP =BrukerHM[(std::string) "ACQ_phase1_offset"].GetDoubleValue(); }; -void BrukerObjectVaryingProperties::setTE(std::map & BrukerHM){ +void BrukerObjectVaryingProperties::computeTE(std::map & BrukerHM){ TE = BrukerHM[(std::string) "ACQ_echo_time"].GetDoubleValue(); }; -double BrukerObjectVaryingProperties::getTE(int theValue) const{ - if (theValue < TE.size() && theValue >=0) {return TE[theValue];} +double BrukerObjectVaryingProperties::getTE(unsigned int theValue) const{ + if (theValue < TE.size() ) {return TE[theValue];} else throw 0; } -/*void BrukerObjectVaryingProperties::setTE(const std::vector< double >& theValue) +/*void BrukerObjectVaryingProperties::computeTE(const std::vector< double >& theValue) { TE = theValue; }*/ -double BrukerObjectVaryingProperties::getPositionP(int theValue) const{ - if (theValue < PositionP.size() && theValue >=0) return PositionP[theValue]; - else throw 0; +double BrukerObjectVaryingProperties::getPositionP(unsigned int theValue) const{ + if (theValue < PositionP.size() ) return PositionP[theValue]; + else throw 1; } -/*void BrukerObjectVaryingProperties::setPositionP(const std::vector< double >& theValue) +/*void BrukerObjectVaryingProperties::computePositionP(const std::vector< double >& theValue) { PositionP = theValue; }*/ -double BrukerObjectVaryingProperties::getPositionR(int theValue) const{ - if (theValue < PositionR.size() && theValue >=0) return PositionR[theValue]; - else throw 0; +double BrukerObjectVaryingProperties::getPositionR(unsigned int theValue) const{ + if (theValue < PositionR.size() ) return PositionR[theValue]; + else throw 2; } -/*void BrukerObjectVaryingProperties::setPositionR(const std::vector< double >& theValue) +/*void BrukerObjectVaryingProperties::computePositionR(const std::vector< double >& theValue) { PositionP = theValue; }*/ -double BrukerObjectVaryingProperties::getPositionS(int theValue) const{ - if (theValue < PositionS.size() && theValue >=0) return PositionS[theValue]; - else throw 0; +double BrukerObjectVaryingProperties::getPositionS(unsigned int theValue) const{ + if (theValue < PositionS.size() ) return PositionS[theValue]; + else throw 3; } -/*void BrukerObjectVaryingProperties::setPositionS(const std::vector< double >& theValue) +/*void BrukerObjectVaryingProperties::computePositionS(const std::vector< double >& theValue) { PositionP = theValue; }*/ -int BrukerObjectVaryingProperties::getAcquisitionOrder(int theValue) const{ - if (theValue =0) return AcquisitionOrder[theValue]; - else throw 0; +int BrukerObjectVaryingProperties::getAcquisitionOrder(unsigned int theValue) const{ + if (theValue & theValue1, const std::vector< int >& theValue2) +/*void BrukerObjectVaryingProperties::computeAcquisitionOrder(const std::vector< int >& theValue1, const std::vector< int >& theValue2) { AcquisitionOrder.clear(); - if (theValue1.size() != theValue2[3]*theValue2[1]) throw 0; - if (theValue2.size() < 4 ) throw 0; + if (theValue1.size() != theValue2[3]*theValue2[1]) throw 5; + if (theValue2.size() < 4 ) throw 6; for (int i =0 ;i & BrukerHM, std::vector & LoopStruct){ +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 0; - if (LoopStruct.size() < 4 ) throw 0; + if (BrukerHM[(std::string) "ACQ_obj_order"].GetIntValue().size() != LoopStruct[3]*LoopStruct[1]) throw 7; + if (LoopStruct.size() < 4 ) throw 8; for (int i =0 ;i > BrukerObjectVaryingProperties::getOrientation(int theValue) const{ - if (theValue =0)return Orientation[theValue]; - else throw 0; +std :: vector < std :: vector < double > > BrukerObjectVaryingProperties::getOrientation(unsigned int theValue) const{ + if (theValue < Orientation.size())return Orientation[theValue]; + else throw 9; } -/*void BrukerObjectVaryingProperties::setOrientation( std :: vector < double > & theValue1,const std::vector< int >& theValue2) +/*void BrukerObjectVaryingProperties::computeOrientation( std :: vector < double > & theValue1,const std::vector< int >& theValue2) { - if (theValue1.size() != theValue2[3]*9) throw 0; - if (theValue2.size() < 4 ) throw 0; + if (theValue1.size() != theValue2[3]*9) throw 10; + if (theValue2.size() < 4 ) throw 11; int counter=0; for(int i=0;i > BrukerObjectVaryingProperties::getOr } }*/ -void BrukerObjectVaryingProperties::setOrientation(std::map & BrukerHM, std::vector & LoopStruct){ - if (BrukerHM[(std::string) "ACQ_grad_matrix"].GetDoubleValue().size() != LoopStruct[3]*9) throw 0; - if (LoopStruct.size() < 4 ) throw 0; +void BrukerObjectVaryingProperties::computeOrientation(std::map & BrukerHM, std::vector & LoopStruct){ + if (BrukerHM[(std::string) "ACQ_grad_matrix"].GetDoubleValue().size() != LoopStruct[3]*9) throw 12; + if (LoopStruct.size() < 4 ) throw 13; std::vector Temp1D(3,0.0); std::vector > Temp2D; @@ -149,12 +149,12 @@ void BrukerObjectVaryingProperties::setOrientation(std::map=0) return PositionTimePerNR[theValue]; - else throw 0; +double BrukerObjectVaryingProperties::getPositionTimePerNR(unsigned int theValue) const{ + if (theValue & BrukerHM, std::vector & LoopStruct){ +void BrukerObjectVaryingProperties::computePositionTimePerNR(std::map & BrukerHM, std::vector & LoopStruct){ double FloatPositionTimePerNR=BrukerHM[(std::string) "ACQ_repetition_time"].GetDoubleValue()[0]; int i=0; int NA=BrukerHM[(std::string) "NA"].GetIntValue()[0]; @@ -162,8 +162,8 @@ void BrukerObjectVaryingProperties::setPositionTimePerNR(std::map & BrukerHM, std::vector & LoopStruct) { - setAcquisitionOrder( BrukerHM, LoopStruct); - setOrientation(BrukerHM, LoopStruct); - setPositionP(BrukerHM); - setPositionR(BrukerHM); - setPositionS(BrukerHM); - setPositionTimePerNR(BrukerHM, LoopStruct); - setTE(BrukerHM); - + try { + computeAcquisitionOrder (BrukerHM, LoopStruct); + computeOrientation (BrukerHM, LoopStruct); + computePositionP (BrukerHM); + computePositionR (BrukerHM); + computePositionS (BrukerHM); + computePositionTimePerNR(BrukerHM, LoopStruct); + computeTE (BrukerHM); + } + + catch (...) + { + std::cout << "Failure during BrukerObjectVaryingProperties::init " << std::endl; + return false; + } + return true; }