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

*** empty log message ***

parent 4df535e6
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ XFILES = avwcpgeom avwmerge avwnvols avwsplit \
avwinterleave_8UI avwinterleave_8SI avwinterleave_16UI avwinterleave_16SI avwinterleave_32UI avwinterleave_32SI avwinterleave_32R avwinterleave_64R \
avwroi_8UI avwroi_8SI avwroi_16UI avwroi_16SI avwroi_32UI avwroi_32SI avwroi_32R avwroi_64R \
avwfill_8UI avwfill_8SI avwfill_16UI avwfill_16SI avwfill_32UI avwfill_32SI avwfill_32R avwfill_64R \
avwstats avwcomplex avwstats++ avwfft avwmeants avwcheck avwswapdim avwconv avwslice avworient
avwstats avwcomplex avwstats++ avwfft avwmeants avwcheck avwswapdim avwconv avwslice avworient avwpspec
SCRIPTS = avwval avwchpixdim avwanimate sliceanimate avwsize avwinfo avwedithd avwchfiletype
FSCRIPTS = fmriborient
......@@ -113,3 +113,6 @@ avworient: avworient.o
avwslice: avwslice.cc
${CXX} ${CXXFLAGS} ${LDFLAGS} -o avwslice avwslice.cc ${LIBS}
avwpspec: avwpspec.o
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ avwpspec.o ${LIBS}
/* avwswapdim.cc
Christian F. Beckmann, FMRIB Image Analysis Group
Copyright (C) 2003-2004 University of Oxford */
/* CCOPYRIGHT */
#include "newmatap.h"
#include "newmatio.h"
#include "newimage/newimageall.h"
#include "newimage/fmribmain.h"
using namespace NEWIMAGE;
void print_usage(const string& progname) {
cout << "Usage: " << progname << " <input> [options] [output]" << endl;
cout << endl;
cout << " " << endl;
cout << " " << endl;
cout << " e.g. " << progname << " " << endl;
}
ReturnMatrix calcFFT(const Matrix& Mat)
{
Matrix res;
for(int ctr=1; ctr <= Mat.Ncols(); ctr++)
{
ColumnVector tmpCol;
tmpCol=Mat.Column(ctr);
ColumnVector FtmpCol_real;
ColumnVector FtmpCol_imag;
ColumnVector tmpPow;
if(tmpCol.Nrows()%2 != 0){
Matrix empty(1,1); empty=0;
tmpCol &= empty;}
RealFFT(tmpCol,FtmpCol_real,FtmpCol_imag);
tmpPow = pow(FtmpCol_real,2)+pow(FtmpCol_imag,2);
tmpPow = tmpPow.Rows(2,tmpPow.Nrows());
//if(opts.logPower.value()) tmpPow = log(tmpPow);
if(res.Storage()==0){res= tmpPow;}else{res|=tmpPow;}
}
res.Release();
return res;
} //Matrix calcFFT()
int generate_masks(volume4D<float> &mask, volume4D<float> &masknz, const volume4D<float> &vin, float& lthr, float& uthr)
{
mask = binarise(vin,lthr,uthr,exclusive);
masknz = mask * (1.0f - binarise(vin,0.0f, 0.0f));
return 0;
}
int generate_masks(const volume4D<float> &mask, volume4D<float> &masknz, const volume4D<float> &vin)
{
masknz = mask * (1.0f - binarise(vin,0.0f, 0.0f));
return 0;
}
int fmrib_main_float(int argc, char* argv[])
{
string inname=argv[1];
string maskname="";
string outname="";
cout << argc << endl;
if(argc>2)
outname=argv[2];
else
outname=inname;
Matrix iMat, oMat;
volume4D<float> vout;
volume<float> smask, smasknz;
volumeinfo volinfo;
{
volume4D<float> vin, mask, masknz;
read_volume4D(vin,argv[1],volinfo);
float lthr=0, uthr=0;
generate_masks(mask,masknz,vin,lthr,uthr);
smask=mask[0];
smasknz=masknz[0];
iMat = vin.matrix(smasknz);
}
oMat = calcFFT(iMat);
vout.setmatrix(oMat,smasknz);
int retval=0;
retval = save_volume4D(vout,outname,volinfo);
return retval;
}
int main(int argc,char *argv[])
{
Tracer tr("main");
string progname=argv[0];
if (argc<3) {
print_usage(progname);
return 1;
}
return fmrib_main_float(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