~ubuntu-branches/ubuntu/lucid/fslview/lucid

« back to all changes in this revision

Viewing changes to fsl/miscmaths/miscmaths.cc

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2009-02-06 12:13:24 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090206121324-pib80tw725kqxe45
Tags: 3.0.2+4.1.2-2
* Compile internal libraries as shared libs and install them under
  /usr/lib/fsl/lib, so FSL itself can use them as well.
* Expose FSL's internal libs via RPATH to the included binaries.
  That should be appropriate, since they are built from the same package
  and are not intended to be used by other packages than FSL (hence, no -dev
  package).
* Added patch to prevent fslview from crashing with images that have dim4=0.
  Thanks to Wim Otte.
* Build package with -Wl,--no-undefined.
* Added 'XS-DM-Upload-Allowed: yes' to debian/control.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
  {
72
72
    string cline;
73
73
    while (!fs.eof()) {
 
74
      streampos curpos = fs.tellg();
74
75
      getline(fs,cline);
75
76
      cline += " "; // force extra entry in parsing
76
77
      istringstream ss(cline.c_str());
77
78
      string cc="";
78
79
      ss >> cc;
79
80
      if (isnum(cc)) {
80
 
        fs.seekg(-((int)cline.size()),ios::cur);
 
81
        if (!fs.eof()) { fs.seekg(curpos); } else { fs.clear(); fs.seekg(0,ios::beg); }
81
82
        return cline;
82
83
      }
83
84
    }
446
447
        return a*a + b*b + c*c;
447
448
    }
448
449
 
449
 
  int Identity(Matrix& m)
450
 
    {
451
 
      Tracer tr("Identity");
452
 
      m=0.0;
453
 
      for (int j=1; j<=m.Nrows(); j++)
454
 
        m(j,j)=1.0;
455
 
      return 0;
456
 
    }
457
 
 
458
 
  ReturnMatrix Identity(int num)
459
 
    {
460
 
      Tracer tr("Identity");
461
 
      Matrix eye(num,num);
462
 
      Identity(eye);
463
 
      eye.Release();
464
 
      return eye;
465
 
    }
466
 
 
467
 
 
468
450
  int diag(Matrix& m, const float diagvals[])
469
451
    {
470
452
      Tracer tr("diag");
954
936
      Matrix rotmat(3,3);
955
937
      rotmat = aff3 * scales.i() * (skew.SubMatrix(1,3,1,3)).i();
956
938
      ColumnVector transl(3);
957
 
      //transl = affmat.SubMatrix(1,3,4,4);
958
 
      //transl = transl - (Identity(3) - rotmat)*centre;
959
939
      transl = affmat.SubMatrix(1,3,1,3)*centre + affmat.SubMatrix(1,3,4,4)
960
940
                 - centre;
961
941
      for (int i=1; i<=3; i++)  { params(i+3) = transl(i); }