/* xf3d_hmsIST au program written by Sven G. Hyberts from a template by Wolfgang Bermel */ /* further developed by Clemens Anklin clemens.anklin@bruker.com */ /* the present implementation is limited to reconstruction of 3-dimensional spectra */ /* 150602 - cga: nc_proc = 0 option with xf2 nd2d works around scaling issue optional transform in f2 and f1 added abs2.water to the result of xf2 nd2d Requires brr2pipe.exe, hmsIST.exe and pipe2brr.exe in /prog/bin These biary programs are available on request and for MacOS, Linux and Windows7 */ #undef DEBUG int argc; char **args; /* the present implementation is limited to reconstruction of 3-dimensional NUSpectroscopy, /cga */ int fntype; char path1[1024]; char path2[1024]; char path4[1024]; FILE *fptr3; /* xf2 nd2d does a transform along the acquisition dimension irrespective of the dimensionality of the dataset (it always produces a 2rr and 2ri). Spectra in f2 are packed and in the order of nuslist */ GETCURDATA char answer[8], answer2[8]; /* ask for ABS after f3 transform. Use standard code from abs2.water */ float dwater=4.7, delta=0.1; GETSTRING( "Perform f2 and f1 transform after reconstruction (y , n)",answer2); GETSTRING( "Perform ABS after f3 transform (y , n)", answer ); if (( strcmp( answer, "yes" ) == 0 ) || ( strcmp( answer, "y" ) == 0 )) { GETFLOAT("Enter chemical shift of water in ppm : ",dwater); GETFLOAT("Enter distance from water in ppm : ",delta); } /*FETCHPAR ("FnTYPE", &fntype) FETCHPARS ("FnTYPE", &fntype) STOREPAR( "FnTYPE", 0 ) STOREPARS( "FnTYPE", 0 ) */ /*STOREPAR( "FnTYPE", fntype) STOREPARS( "FnTYPE", fntype)*/ /* Setup of parameters in proc*s to be consistent with 3rrr that will be returned from reconstruction */ int xN, yN, dN; FETCHPARN( 1, "SI", &yN ); FETCHPARN( 2, "SI", &xN ); FETCHPARN( 3, "SI", &dN ); int xTD, yTD, dTD; FETCHPARN( 1, "TD", &yTD ); FETCHPARN( 2, "TD", &xTD ); FETCHPARN( 3, "TD", &dTD ); STOREPARNS( 1, "SI", yN ); STOREPARNS( 2, "SI", xN ); STOREPARNS( 3, "SI", dN ); STOREPARNS( 1,"STSI", yN ); STOREPARNS( 2,"STSI", xN ); STOREPARNS( 3,"STSI", dN ); STOREPARNS( 1, "TDeff", yTD); STOREPARNS( 2, "TDeff", yTD); STOREPARNS( 3, "TDeff", dTD ); STOREPARNS( 1, "FT_mod", 0); STOREPARNS( 2, "FT_mod", 0); STOREPARNS( 1, "XDIM", yN); STOREPARNS( 2, "XDIM", xN); STOREPARNS( 3, "XDIM", dN); STOREPARNS( 1, "WDW", 0); STOREPARNS( 2, "WDW", 0); STOREPARNS( 1, "PH_mod", 0); STOREPARNS( 2, "PH_mod", 0); STOREPARNS( 1, "ME_mod", 0); STOREPARNS( 2, "ME_mod", 0); yN /=2; xN /=2; yTD /=2; xTD /=2; (void)strcpy(path1, PROCPATH("")); (void)chdir(path1); #ifdef DEBUG fprintf( stderr, "%s\n", path1); #endif if ( CPR_exec("xf2 nd2d nc_proc 0 1000",WAIT_TERM) ) ABORT DATASET(name, expno, 1000, disk, user); SETCURDATA /* do abs2.water on dataset created by xf2 nd2d */ if (( strcmp( answer, "yes" ) == 0 ) || ( strcmp( answer, "y" ) == 0 )) { STOREPAR("ABSF1",100.0) STOREPAR("ABSF2",dwater+delta) ABS2 STOREPAR("ABSF1",dwater-delta) STOREPAR("ABSF2",-100.0) ABS2 } int stsi3; FETCHPARS("STSI", &stsi3); (void)strcpy(path2, ACQUPATH("pdata")); (void)strcat(path2, "/1000/"); (void)chdir(path2); #ifdef DEBUG fprintf( stderr, "%s\n", path2); #endif /***** check and execute brr2pipe *****/ char path[1024]; char args_arg[1024]; char nuslist[1024]; Show_status( "Reconstruction with hmsIST..."); (void)sprintf(path,"%s/bin/brr2pipe.exe", PathXWinNMRProg() ); if (access(path, F_OK)) { (void)sprintf(text, "file %s does not exist", path); STOPMSG(text); } (void)sprintf( args_arg, "%s %s", path, "-in 2rr -dim 2 -out .test.nus" ); if ( system( args_arg ) < 0 ) STOP /***** check and execute hmsIST *****/ (void)sprintf(path,"%s/bin/hmsIST.exe", PathXWinNMRProg() ); if (access(path, F_OK)) { (void)sprintf(text, "file %s does not exist", path); STOPMSG(text); } (void)strcpy(nuslist, ACQUPATH("nuslist") ); (void)sprintf( args_arg, "%s -in .test.nus -over 1 -i_mult 0.70 -e_mult 0.70 -itr 25 -out .test.phf -dim 2 -xN %d -yN %d -sched %s", path, xTD, yTD, nuslist ); #ifdef DEBUG fprintf( stderr, args_arg ); fprintf( stderr, "\n"); #endif if ( system( args_arg ) < 0 ) STOP /***** check and execute pipe2brr *****/ (void)sprintf(path,"%s/bin/pipe2brr.exe", PathXWinNMRProg() ); if (access(path, F_OK)) { (void)sprintf(text, "file %s does not exist", path); STOPMSG(text); } #ifdef DEBUG fprintf( stderr, "%s\n", path2); #endif (void)chdir(path1); (void)sprintf( args_arg, "%s -in %s/.test.phf -dim 2 -xTD %d -yTD %d -xN %d -yN %d -out 3rrr", path, path2, xTD, yTD, xN, yN ); #ifdef DEBUG fprintf( stderr, args_arg ); fprintf( stderr, "\n"); #endif if ( system( args_arg ) < 0 ) STOP /* switchback to original procnoand check if TD is larger or smaller than processed size, adjust tdeff in f1 and f2 Process in f2 und f1 if desired */ DATASET(name, expno, 1, disk, user); SETCURDATA VIEWDATA int tdeff1, tdeff2; if ( yTD > yN ) { tdeff1 = yN*2; } else { tdeff1 = yTD*2; } if ( xTD > xN ) { tdeff2 = xN*2; } else { tdeff2 = xTD*2; } STOREPARNS( 1, "TDeff", tdeff1 ); STOREPARNS( 2, "TDeff", tdeff2 ); STOREPARS("STSI", stsi3); (void)sprintf(path4,PROCPATH("title")); fptr3 = fopen(path4,"at"); fprintf(fptr3,"This NUS data was reconstructed using hmsIST \n please cite \n Sven G. Hyberts, Alexander G. Milbrandt, Andreas B. Wagner, Haribabu Arthanari and Gerhard Wagner, \n Application of iterative soft thresholding for fast reconstruction of NMR data non-uniformly sampled with multidimensional Poisson Gap scheduling \n J Biomol NMR 52, 315-327 (2012). http://dx.doi.org/10.1007/s10858-012-9611-z "); fclose(fptr3); if (( strcmp( answer2, "yes" ) == 0 ) || ( strcmp( answer2, "y" ) == 0 )) { XCMD("ftnd 2") XCMD("ftnd 1") } QUIT