Beispiel #1
0
void shape_rf (RF_PULSE_T *rf, char rfBase[MAX_STR], char rfName[MAX_STR], double pw, double flip,
              double rof1, double rof2)
   {
   if ((ix > 1) && !sglarray) {
     rf->flip = flip;
     return;
   }
   initRf(rf);
   strcpy(rf->pulseBase,rfBase);
   strcpy(rf->pulseName,rfName);
   strcpy(rf->rfcoil,rfcoil);
   rf->rfDuration = pw;
   rf->flip = flip;
   rf->flipmult = 1.0;
   rf->rof1 = rof1;
   rf->rof2 = rof2;

   /* Generate the pulse shape if rf->pulseName is appropriate */
   genRf(rf);

   /* If the pulse shape has not been generated proceed as for init_rf */
   switch (rf->type) {
     case RF_NULL:
       rf->rfDuration = shapelistpw(rfName,pw);  /* Round to 200ns resolution*/
       readRfPulse(rf);

       /* Set actual bandwidth according to pulse duration */
       if ((FP_LT(rf->flip,FLIPLIMIT_LOW)) || (FP_GT(rf->flip,FLIPLIMIT_HIGH)))
         /* use excitation bandwidth */
         rf->bandwidth = rf->header.bandwidth/rf->rfDuration;
       else
         /* use inversion bandwidth */
         rf->bandwidth = rf->header.inversionBw/rf->rfDuration;
              
       break;
     default:
       /* Even though shape is properly quantized for some reason we need to 
          use shapelistpw to round to 200ns resolution, otherwise duration may 
          be significantly wrong ?? */
       rf->rfDuration = shapelistpw(rf->pulseName,pw);
       break;
   }

   switch (rf->error) {
     case ERR_RF_SHAPE_MISSING:
       sgl_abort_message("ERROR: Can not find RF shape '%s.RF'",rfName);
       break;
     case ERR_RF_HEADER_ENTRIES:
       sgl_abort_message("ERROR rf shape '%s': incorrect header information",rfName);
       break;
     default:
       break;
   }
   if ((rf->header.rfFraction < 0) || (rf->header.rfFraction > 1))
     sgl_abort_message("ERROR rf shape '%s': RF Fraction must be between 0 and 1",rfName);
   }
Beispiel #2
0
void init_rf (RF_PULSE_T *rf, char rfName[MAX_STR], double pw, double flip,
              double rof1, double rof2)
   {
   if ((ix > 1) && !sglarray) {
     rf->flip = flip;
     return;
   }
   initRf(rf);
   strcpy(rf->pulseName,rfName);
   strcpy(rf->rfcoil,rfcoil);
   rf->rfDuration = shapelistpw(rfName,pw);  /* Round to 200ns resolution*/
   rf->flip = flip;
   rf->flipmult = 1.0;   /* default to 1, programmer can reassign in sequence */
   rf->rof1 = rof1;
   rf->rof2 = rof2;
   readRfPulse(rf);

   switch (rf->error) {
     case ERR_RF_SHAPE_MISSING:
       sgl_abort_message("ERROR: Can not find RF shape '%s.RF'",rfName);
       break;
     case ERR_RF_HEADER_ENTRIES:
       sgl_abort_message("ERROR rf shape '%s': incorrect header information",rfName);
       break;
     default:
       break;
   }
   if ((rf->header.rfFraction < 0) || (rf->header.rfFraction > 1))
     sgl_abort_message("ERROR rf shape '%s': RF Fraction must be between 0 and 1",rfName);
   }
Beispiel #3
0
pulsesequence()
{
	/* Internal variable declarations *********************/
	char txphase[MAXSTR];
	char rxphase[MAXSTR];
    char blankmode[MAXSTR]={0};
	double  postDelay;
	double rfDuration;
	double acqt;
	int i,ret=-1;
	static int phs1[4] = {0,2,1,3}; /* from T1meas.c */

	/*************************************************/                                     
	/*  Initialize paramter **************************/
	i                = 0;
	postDelay        = 0.5;
	acqt             = 0.0;
	getstr("rxphase",rxphase);
	getstr("txphase",txphase);  

	ret = P_getstring(GLOBAL,"blankmode",blankmode,1,MAXSTR);
    //getparm("blankmode","string",GLOBAL,blankmode,MAXSTR);
	postDelay = tr - at;

   //printf("blankmode=%s\n",blankmode);
                        
	/*************************************************/
	/* check phase setting ***************************/
	if ( (txphase[0] =='n')   && (rxphase[0] =='n') )
	{
		abort_message("ERROR - Select at least one phase [Tx or Rx]\n");   
	}

	/**************************************************/
	/* check pulse width  *****************************/
	rfDuration = shapelistpw(p1pat, p1);     /* assign exitation pulse  duration */
	acqt = rfDuration + rof1 - alfa;
	if (FP_GT(acqt, at))
	{
		abort_message("Pulse duration too long. max [%.3f]    ms\n",(at-rof1+alfa)*1000.0);   
	}
    if(ret==0 && blankmode[0]=='u')
    	obsunblank();
	delay(postDelay);
    
	settable(t1,4,phs1); /*from T1meas.c */
	getelem(t1,ct,v11);  /*from T1meas.c */
	setreceiver(t1);                    
	/*==============================================*/
	/*  START LOOPBACK PULSE SEQUENCE               */
	/*==============================================*/
	status(A);
	obsoffset(resto);

	/* TTL trigger to scope sequence ****************************/       
	sp1on();             

	/* Relaxation delay ***********************************/       
    xgate(ticks);

	/* RF pulse *******************************************/ 
	obspower(tpwr);
	obspwrf(tpwrf);
	ShapedXmtNAcquire(p1pat, rfDuration, v11, rof1, OBSch);

	endacq();
	sp1off();
    if(ret==0 && blankmode[0]=='u')
 		obsunblank();
}
Beispiel #4
0
pulsesequence()
{
	/* Internal variable declarations *********************/
	char txphase[MAXSTR];
	char rxphase[MAXSTR];
        char my_p1pat[MAXSTR];
        char my_p4pat[MAXSTR];
        char my_p2pat[MAXSTR];
        char my_p3pat[MAXSTR];
        char blankmode[MAXSTR]={0};
        char tmpstr[MAXSTR];
	double  postDelay;
	double rfDuration;
	double acqt;
	int i,ret=-1;
	static int phs1[4] = {0,2,1,3}; /* from T1meas.c */
	
	int my_pulseID;
	double my_offsets[64];
	double my_tpwr[64];
	double my_tpwrf[64];
	int my_on_off[64];
	double mytmp;
	int my_numrfch;
	int my_retval;


	

	for(i=0;i<64;i++) my_offsets[i] = 0.0;

	/*************************************************/                                     
	/*  Initialize paramter **************************/
	i                = 0;
	postDelay        = 0.5;
	acqt             = 0.0;
//	getstr("rxphase",rxphase);
//	getstr("txphase",txphase); 
        getstr("p1pat",my_p1pat);
        getstr("p2pat",my_p2pat); 
        getstr("p3pat",my_p3pat); 
        getstr("p4pat",my_p4pat);  
         

	ret = P_getstring(GLOBAL,"blankmode",blankmode,1,MAXSTR);

	if ( P_getreal(CURRENT,"ampargs",&mytmp,2) < 0 )
		mytmp = 0.0;

    if ( P_getreal(GLOBAL, "numrfch", &mytmp, 1) < 0 )
    abort_message("Cannot proceed without global numrfch\n");   
    my_numrfch = (int)(mytmp+0.05);
    if(my_numrfch<2) abort_message("this is a single transmit system and you don't need this pulse sequence\n");   
    if(my_numrfch>16) abort_message("numrfch > 16 not supported \n");   

    printf("mytmp=%f\n",mytmp);
     

 // if((P_getstring(GLOBAL,"rfGroupMap",tmpstr,1,MAXSTR) < 0) || (strlen(tmp) < 2))
 //   {
   // abort_message("global rfGroupMap doesn't exist or is too short\n");   
 // }
 // else // rfGroupMap is set to all 1's for the same number as numrfch so we control everything here in the sequence
  //{
     strncpy(tmpstr,"111111111111111111111111111111111111111111111111111111111111111111",(size_t)my_numrfch);
     tmpstr[my_numrfch]=0;
     P_setstring(CURRENT, "rfGroupMap", tmpstr, 1);
  // }

    //getparm("blankmode","string",GLOBAL,blankmode,MAXSTR);
	postDelay = tr - at;

   //printf("blankmode=%s\n",blankmode);
                        
	/*************************************************/
	/* check phase setting ***************************/
//	if ( (txphase[0] =='n')   && (rxphase[0] =='n') )
//	{
//		abort_message("ERROR - Select at least one phase [Tx or Rx]\n");   
//	}

	/**************************************************/
	/* check pulse width  *****************************/
	rfDuration = shapelistpw(p1pat, pw);     /* assign exitation pulse  duration */
        printf("p1pat: %s\n",my_p1pat);                  
        printf("duration: %e\n",rfDuration);                  
	acqt = rfDuration + rof1 - alfa;
	if (FP_GT(acqt, at))
	{
		abort_message("Pulse duration too long. max [%.3f]    ms\n",(at-rof1+alfa)*1000.0);   
	}
    if(ret==0 && blankmode[0]=='u')
    	obsunblank();
	delay(postDelay);
    
	settable(t1,4,phs1); /*from T1meas.c */
	getelem(t1,ct,v11);  /*from T1meas.c */
	setreceiver(t1);  

        printf("mytmp=%d\n",my_numrfch);                  

	my_pulseID = initRFGroupPulse(rfDuration, my_p1pat, 's',  0.0, 0.0, v11, &my_offsets[0], my_numrfch-1);
        printf("pulse id = %d\n",my_pulseID);
         //modifyRFGroupName(my_pulseID,2,my_p2pat);
         //modifyRFGroupName(my_pulseID,3,my_p3pat);
         // modifyRFGroupName(my_pulseID,4,my_p4pat);

        
	for(i=0;i<64;i++) my_tpwr[i]=0.0;
	for(i=0;i<64;i++) my_tpwrf[i]=0.0;
	for(i=0;i<64;i++) my_on_off[i]=0;

//SAS turn everything off
	for(i=0;i<my_numrfch-1;i++) 

        {
        modifyRFGroupOnOff(my_pulseID, i+1,0);
        printf("here is i=%d\n",i);
        }
	for(i=0;i<my_numrfch-1;i++) modifyRFGroupPwrf(my_pulseID, i+1, 0.0);
	for(i=0;i<my_numrfch-1;i++) modifyRFGroupPwrC(my_pulseID, i+1, 0.0);

//SAS get the parameter arrays into the local arrays

     my_retval=(int)getarray("my_tpwr",my_tpwr);

/*
	printf("my tpwr0 was: %e\n",my_tpwr[0]);
	printf("my tpwr1 was: %e\n",my_tpwr[1]);
	printf("my tpwr2 was: %e\n",my_tpwr[2]);
	printf("my tpwr3 was: %e\n",my_tpwr[3]);
	printf("my tpwr4 was: %e\n",my_tpwr[4]);
	printf("my tpwr5 was: %e\n",my_tpwr[5]);
	printf("my tpwr6 was: %e\n",my_tpwr[6]);
	printf("my tpwr7 was: %e\n",my_tpwr[7]);
*/

     my_retval=(int)getarray("my_on_off",my_tpwrf); //dump the array of reals into a real array

	for(i=0;i<my_numrfch;i++) my_on_off[i] = (int)my_tpwrf[i]; //convert to integer

/*
	printf("my on_off_0 was: %d\n",my_on_off[0]);
	printf("my on_off_1 was: %d\n",my_on_off[1]);
	printf("my on_off_2 was: %d\n",my_on_off[2]);
	printf("my on_off_3 was: %d\n",my_on_off[3]);
	printf("my on_off_4 was: %d\n",my_on_off[4]);
	printf("my on_off_5 was: %d\n",my_on_off[5]);
	printf("my on_off_6 was: %d\n",my_on_off[6]);
	printf("my on_off_7 was: %d\n",my_on_off[7]);
*/
	for(i=0;i<64;i++) my_tpwrf[i]=2047.0;

//SAS set everything to array values

	for(i=0;i<my_numrfch;i++) modifyRFGroupOnOff(my_pulseID, i+1,my_on_off[i]);
	for(i=0;i<my_numrfch;i++) modifyRFGroupPwrf(my_pulseID, i+1, my_tpwrf[i]);
	for(i=0;i<my_numrfch;i++) modifyRFGroupPwrC(my_pulseID, i+1, my_tpwr[i]);


	/*==============================================*/
	/*  START LOOPBACK PULSE SEQUENCE               */
	/*==============================================*/
	status(A);
	obsoffset(resto);

	/* TTL trigger to scope sequence ****************************/       
	sp1on();             

	/* Relaxation delay ***********************************/       
    xgate(ticks);

	/* RF pulse *******************************************/ 
	GroupPulse(my_pulseID, rof1, rof2,  v11, 0);

	endacq();
	sp1off();
    if(ret==0 && blankmode[0]=='u')
 		obsunblank();
}