#include #include #include "Fourier.h" #include "SphericalGrid.h" #include "cmdLineParser.h" #include int main(int argc,char* argv[]){ // Read the parameters in from the command line cmdLineString Source,Target,Out; cmdLineReadable Ref,Axial; cmdLineInt Rot; char* paramNames[]={"source","target","out"}; cmdLineReadable* params[]={&Source,&Target,&Out}; cmdLineParse(argc-1,&argv[1],paramNames,sizeof(paramNames)/sizeof(char*),params); if(!Source.set){ fprintf(stderr,"You must specify a source file\n"); return EXIT_FAILURE; } if(!Target.set){ fprintf(stderr,"You must specify a target file\n"); return EXIT_FAILURE; } if(!Out.set){ fprintf(stderr,"You must specify an output file\n"); return EXIT_FAILURE; } SphericalGrid<> source,target,out; RotationGrid<> euler; FourierKeyS2<> sourceKey,targetKey; FourierKeySO3<> keySO3; HarmonicTransform<> hForm; WignerTransform<> wForm; float matrix[3][3]; // Read in the input spherical function if(!source.read(Source.value)){ fprintf(stderr,"Failed to read in: %s\n",Source.value); return EXIT_FAILURE; } if(!target.read(Target.value)){ fprintf(stderr,"Failed to read in: %s\n",Target.value); return EXIT_FAILURE; } if(source.resolution()!=target.resolution()){ fprintf(stderr,"Source and target resolutions differ: %d != %d\n",source.resolution(),target.resolution()); return EXIT_FAILURE; } // Allocate memory keySO3.resize(source.resolution()); // Compute the spherical harmonic transform hForm.ForwardFourier(source,sourceKey); hForm.ForwardFourier(target,targetKey); // Compute the aligning rotation here, writing out the 3x3 matrix // into "matrix" // ... SphericalGrid<>::Rotate(source,matrix,out); out.write(Out.value); return EXIT_SUCCESS; }