// // C++ Implementation: brukerobjectvaryingproperties // // Description: // // // Author: denis grenier , (C) 2009 // // Copyright: See COPYING file that comes with this distribution // // #include "brukerobjectvaryingproperties.h" //#include "brukerexception.h" BrukerObjectVaryingProperties::BrukerObjectVaryingProperties() { } BrukerObjectVaryingProperties::~BrukerObjectVaryingProperties() { } void BrukerObjectVaryingProperties::setPositionS(std::map & BrukerHM){ std::vector PosiS =BrukerHM[(std::string) "ACQ_slice_offset"].GetDoubleValue(); PositionS =PosiS; }; void BrukerObjectVaryingProperties::setPositionR(std::map & BrukerHM){ PositionR =BrukerHM[(std::string) "ACQ_read_offset"].GetDoubleValue() ; }; void BrukerObjectVaryingProperties::setPositionP(std::map & BrukerHM){ PositionP =BrukerHM[(std::string) "ACQ_phase1_offset"].GetDoubleValue(); }; void BrukerObjectVaryingProperties::setTE(std::map & BrukerHM){ TE = BrukerHM[(std::string) "ACQ_echo_time"].GetDoubleValue(); }; 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) { TE = theValue; }*/ 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) { PositionP = theValue; }*/ 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) { PositionP = theValue; }*/ 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) { PositionP = theValue; }*/ int BrukerObjectVaryingProperties::getAcquisitionOrder(unsigned int theValue) const{ if (theValue & theValue1, const std::vector< int >& theValue2) { AcquisitionOrder.clear(); if (theValue1.size() != theValue2[3]*theValue2[1]) throw 5; if (theValue2.size() < 4 ) throw 6; for (int i =0 ;i & BrukerHM, std::vector & LoopStruct){ std::vector AcqOrder; 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(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) { if (theValue1.size() != theValue2[3]*9) throw 10; if (theValue2.size() < 4 ) throw 11; int counter=0; for(int i=0;i & 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; std::vector > > Temp3D; int i, j ,k; for(i=0;i<3;i++) Temp2D.push_back(Temp1D); for (i=0;i & 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]; int NAE=BrukerHM[(std::string) "NAE"].GetIntValue()[0]; double temp; /* les loop de 0 a  3 ne sont pas concernes par le temps car ils creent presque systematiquement un melange temporel des donnees, c'est pour cela que je ne calcule qu'un temps moyen a  partir de celles -ci */ for (i=4; i<(LoopStruct.size()-1);i++) { FloatPositionTimePerNR=FloatPositionTimePerNR*LoopStruct[i]; } FloatPositionTimePerNR=FloatPositionTimePerNR*NA*NAE/2000.0; if (BrukerHM[(std::string) "ACQ_temporal_delay"].GetDoubleValue().size()==1) { temp=BrukerHM[(std::string)"ACQ_temporal_delay"].GetDoubleValue()[0]/1000.0; for (i=1; i<=LoopStruct.back();i++) { PositionTimePerNR.push_back(FloatPositionTimePerNR+ (2*FloatPositionTimePerNR+temp)*(i-1)); } } if (BrukerHM[(std::string) "ACQ_temporal_delay"].GetDoubleValue().size()!=1&& BrukerHM[(std::string) "ACQ_temporal_delay"].GetDoubleValue().size()!=(LoopStruct.back()-1)) { throw 15; } if (BrukerHM[(std::string) "ACQ_temporal_delay"].GetDoubleValue().size()!=1&& BrukerHM[(std::string) "ACQ_temporal_delay"].GetDoubleValue().size()==(LoopStruct.back()-1)) { PositionTimePerNR[0] = FloatPositionTimePerNR; for (int i=1; i<=LoopStruct.back();i++) { PositionTimePerNR[i] = PositionTimePerNR[i-1]+ (2*FloatPositionTimePerNR+BrukerHM[(std::string) "ACQ_temporal_delay"].GetDoubleValue()[i-1]/1000.0); } } } /*! \fn BrukerObjectVaryingProperties::init(std::map BrukerHM,std::vector LoopStruct) */ bool BrukerObjectVaryingProperties::init(std::map & BrukerHM, std::vector & LoopStruct) { setAcquisitionOrder( BrukerHM, LoopStruct); setOrientation(BrukerHM, LoopStruct); setPositionP(BrukerHM); setPositionR(BrukerHM); setPositionS(BrukerHM); setPositionTimePerNR(BrukerHM, LoopStruct); setTE(BrukerHM); return true; }