int main( int argc, char* argv[] ) { /* ------------------ */ /* Parse command line */ /* ------------------ */ gArgs.SetCmdLine( argc, argv ); /* ------- */ /* Convert */ /* ------- */ clock_t t0 = StartTiming(); if( !IDBGetImageDims( gW, gH, gArgs.idb, flog ) ) exit( 42 ); gMeta.Init( gArgs.meta ); if( isAff ) ConvertA(); else ConvertH(); StopTiming( flog, "Convert", t0 ); /* ---- */ /* Done */ /* ---- */ fprintf( flog, "\n" ); fclose( flog ); return 0; }
int main( int argc, char* argv[] ) { gArgs.SetCmdLine( argc, argv ); ReadParams(); ChannelLoop(); for( int i = 0; i < 4; ++i ) RasterFree( ffras[i] ); fprintf( flog, "\n" ); fclose( flog ); return 0; }
int main( int argc, char **argv ) { clock_t t0 = StartTiming(); /* ---------- */ /* Parameters */ /* ---------- */ MPIInit( argc, argv ); if( !gArgs.SetCmdLine( argc, argv ) || !gArgs.GetRanges() ) { MPIExit(); exit( 42 ); } /* ------------ */ /* Initial data */ /* ------------ */ if( !LayerCat( vL, gArgs.tempdir, gArgs.cachedir, gArgs.zolo, gArgs.zohi, false ) ) { MPIExit(); exit( 42 ); } InitTables( gArgs.zilo, gArgs.zihi ); { CLoadPoints *LP = new CLoadPoints; LP->Load( gArgs.tempdir, gArgs.cachedir ); delete LP; } /* ----- */ /* Solve */ /* ----- */ printf( "\n---- Solve ----\n" ); SetSolveParams( gArgs.regtype, gArgs.Wr, gArgs.Etol ); XArray Xevn, Xodd; if( !strcmp( gArgs.mode, "A2A" ) ) { Xevn.Load( gArgs.prior ); if( gArgs.untwist ) UntwistAffines( Xevn ); Xodd.Resize( 6 ); Solve( Xevn, Xodd, gArgs.iters ); } else if( !strcmp( gArgs.mode, "A2H" ) ) { Xevn.Resize( 8 ); { // limit A lifetime XArray *A = new XArray; A->Load( gArgs.prior ); if( gArgs.untwist ) UntwistAffines( *A ); Solve( *A, Xevn, 1 ); delete A; } Xodd.Resize( 8 ); Solve( Xevn, Xodd, gArgs.iters ); } else if( !strcmp( gArgs.mode, "H2H" ) ) { Xevn.Load( gArgs.prior ); Xodd.Resize( 8 ); Solve( Xevn, Xodd, gArgs.iters ); } else if( !strcmp( gArgs.mode, "eval" ) ) { Xevn.Load( gArgs.prior ); if( gArgs.untwist ) UntwistAffines( Xevn ); gArgs.iters = 0; } else { // split Xevn.Load( gArgs.prior ); gArgs.iters = 0; } const XArray& Xfinal = ((gArgs.iters & 1) ? Xodd : Xevn); /* ----------- */ /* Postprocess */ /* ----------- */ if( gArgs.mode[0] == 's' ) { Split S( Xfinal, gArgs.splitmin ); S.Run(); } else { Evaluate( Xfinal ); if( gArgs.mode[0] != 'e' ) Xfinal.Save(); } /* ------- */ /* Cleanup */ /* ------- */ if( !wkid ) { printf( "\n" ); StopTiming( stdout, "Lsq", t0 ); } MPIExit(); VMStats( stdout ); return 0; }