src/Matrix/row_vector.cc
/**
 * ReadSiemens_Nohdr - read and process a Siemens pulse file without header
 * @fin: file stream of the open pulse file
 */
read and process a Siemens pulse file without header
@fin: file stream of the open pulse file
read and process a Siemens pulse file without header @fin : file stream of the open pulse file
row_vector row_vector::ReadSiemens_Nohdr (ifstream& fin)
{
  int pos, numpts, count = 0;
  string line, cooked;
  vector<string> field;
  vector<double> allpts;
  while (fin) {
    getline (fin, line);
    if (line.find ("End_Entry:") < line.length())
      break;
    cooked = row_vector::squeeze (line);
    pos    = row_vector::split (cooked, ' ', field);
    for (unsigned int i = 0; i < field.size(); i++) {
      string snum = field[i];
      const char* cptr = snum.data();
      allpts.push_back (atof (cptr));
      count++;
    }
    field.clear();
  }
  numpts = count / 2;
  vector<double> amps (numpts), phases (numpts);
  row_vector rvec (numpts);
  for (int i = 0; i < numpts; i++) {
    amps[i]   = allpts[i*2];			
    phases[i] = allpts[i*2 + 1];
  }
  for (int i = 0; i < numpts; i++) {				
	rvec.put ( amps[i] * complex_exp (-complexi * DEG2RAD * phases[i]), i);
  }
  return rvec;
}
row_vector row_vector :: ReadSiemens_Nohdr ( ifstream & fin ) { int pos , numpts , count = 0 ; string line , cooked ; vector < string > field ; vector < double > allpts ; while ( fin ) { getline ( fin , line ) ; if ( line . find ( " " ) < line . length ( ) ) break ; cooked = row_vector :: squeeze ( line ) ; pos = row_vector :: split ( cooked , ' ' , field ) ; for ( unsigned int i = 0 ; i < field . size ( ) ; i ++ ) { string snum = field [ i ] ; const char * cptr = snum . data ( ) ; allpts . push_back ( atof ( cptr ) ) ; count ++ ; } field . clear ( ) ; } numpts = count / 2 ; vector < double > amps ( numpts ) , phases ( numpts ) ; row_vector rvec ( numpts ) ; for ( int i = 0 ; i < numpts ; i ++ ) { amps [ i ] = allpts [ i * 2 ] ; phases [ i ] = allpts [ i * 2 + 1 ] ; } for ( int i = 0 ; i < numpts ; i ++ ) { rvec . put ( amps [ i ] * complex_exp ( - complexi * DEG2RAD * phases [ i ] ) , i ) ; } return rvec ; }
ReadSiemens_Nohdr - read and process a Siemens pulse file without header
 @fin: file stream of the open pulse file
ReadSiemens_Nohdr - read and process a Siemens pulse file without header @fin : file stream of the open pulse file
/* No way to know where the amplitudes end and the
       * phases begin.  */ /* Now erase the contents of field, or else they accumulate.  */ //bjs-May2002 //bjs-Aug2001