Skip to content
Snippets Groups Projects
Commit b0a3d565 authored by Christian Beckmann's avatar Christian Beckmann
Browse files

*** empty log message ***

parent ff383277
No related branches found
No related tags found
No related merge requests found
...@@ -4,89 +4,85 @@ ...@@ -4,89 +4,85 @@
/* CCOPYRIGHT */ /* CCOPYRIGHT */
#include <iostream> #include "libvis/miscplot.h"
#include "newmatap.h"
#include "newmatio.h"
#include "newimage/newimageall.h"
#include "miscmaths/miscmaths.h" #include "miscmaths/miscmaths.h"
#include "miscmaths/miscprob.h" #include "miscmaths/miscprob.h"
#include <string> #include "utils/options.h"
#include "utils/log.h" #include <vector>
#include "melgmix.h"
#include "meloptions.h" using namespace MISCPLOT;
#include "melhlprfns.h" using namespace MISCMATHS;
#include <time.h> using namespace Utilities;
#include "miscmaths/miscprob.h" using namespace std;
// The two strings below specify the title and example usage that is
// printed out as the help or usage message
using namespace std; string title="test (Version 1.0)\nCopyright(c) 2007, University of Oxford (Christian F. Beckmann)";
using namespace Utilities; string examples="test int";
using namespace NEWIMAGE;
using namespace Melodic;
Option<bool> help(string("--help"), false,
string(" display this message"),
false, no_argument);
Option<int> num(string("--num"), 1,
string("number of iterations"),
false, requires_argument);
void usage(void) int nonoptarg;
{
cout << "Usage: test infile ICfile [mixfile]" << endl; ////////////////////////////////////////////////////////////////////////////
exit(1);
}
int main(int argc, char *argv[]) // Local functions
int do_work(int argc, char* argv[])
{ {
Matrix Mats;
Matrix mat;
Matrix A,C; mat = normrnd(300,(int)num.value())+2;
RowVector B;
cout << "BLAH " << num.value() << endl;
Mats = normrnd(5,10); for (int i=1; i <= (int)num.value();i++){
std_pca(Mats,C,A,B); cout << "Processing " << i << endl;
miscplot newplot;
cout << " STD PCA : " << endl << A << endl << endl << B << endl << endl; ColumnVector col;
em_pca(Mats, A, B, 4); col = mat.Column(i);
cout << " EM PCA : " << endl << A << endl << endl << B << endl << endl; newplot.add_bpdata(col);
newplot.boxplot(string("test")+num2str(i)+string(".png"),string("TEST"));
string RAWfname; }
RAWfname = string(argv[1]); return 0;
volume4D<float> RawData;
volumeinfo VolInfo;
cout << " Reading orig. data " << RAWfname << " ... " << endl<< endl;
read_volume4D(RawData,RAWfname,VolInfo);
Matrix mat;
volume<float> RawData2;
read_volume(RawData2,RAWfname);
print_size(RawData2);
A = normrnd(7,3);
C = normrnd(5,3);
cout << " here " << endl;
Mats = krprod(A,C);
cout << " A : " << A << endl << endl;
cout << " B : " << C << endl << endl;
cout << " C : " << Mats << endl << endl;
write_ascii_matrix(string("A"),A);
write_ascii_matrix(string("B"),C);
write_ascii_matrix(string("C"),Mats);
Matrix tmpA, tmpB;
tmpA = zeros(A.Nrows(),A.Ncols());
tmpB = zeros(C.Nrows(),C.Ncols());
krfact(Mats, tmpA, tmpB);
cout << " A2 : " << tmpA << endl << endl;
cout << " B2 : " << tmpB << endl << endl;
write_ascii_matrix(string("A2"),tmpA);
write_ascii_matrix(string("B2"),tmpB);
tmpA = krapprox(Mats,tmpA.Nrows());
write_ascii_matrix(string("C2"),tmpA);
return 0;
} }
////////////////////////////////////////////////////////////////////////////
int main(int argc,char *argv[])
{
Tracer tr("main");
OptionParser options(title, examples);
try {
// must include all wanted options here (the order determines how
// the help message is printed)
options.add(help);
options.add(num);
options.parse_command_line(argc, argv);
// line below stops the program if the help was requested or
// a compulsory option was not set
if ( (help.value()) || (!options.check_compulsory_arguments(true)) )
{
options.usage();
exit(EXIT_FAILURE);
}
} catch(X_OptionError& e) {
options.usage();
cerr << endl << e.what() << endl;
exit(EXIT_FAILURE);
} catch(std::exception &e) {
cerr << e.what() << endl;
}
// Call the local functions
return do_work(argc,argv);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment