Exemple #1
0
void AspRegionList::display(spAspCell_t cell, AspTraceList *selTraceList, spAspDataInfo_t dataInfo) {

   double px,py,pw,ph;
   cell->getPixCell(px,py,pw,ph);
   double vx,vy,vw,vh;
   cell->getValCell(vx,vy,vw,vh);
	
   set_clip_region((int)px-1,(int)(py+2*(cell->getCali(VERT))),(int)pw,(int)ph);

   AspRegionMap::iterator itr;
   spAspRegion_t region;

   for (itr = regionMap->begin(); itr != regionMap->end(); ++itr) {
        region = itr->second;
	if(region->dataID != "") {
	   spAspTrace_t trace = selTraceList->getTraceByKey(region->dataID);
	   if(trace != nullAspTrace) {
		region->display(cell,trace,dataInfo);
	   }
        }
   }
   selTraceList->showBCModel(cell); // shown only if model exist and BC not applied

   set_clip_region(0,0,0,0);
}
Exemple #2
0
// cursor1 is lower left, cursor2 is upper right
bool AspRoi::getRoiBox(spAspCell_t cell,double &px, double &py, double &pw, double &ph) {

    if(cell == nullAspCell) return false;

  double vx,vw,vy,vh;
  double pstx, psty, pwd, pht;
  double vstx, vsty, vwd, vht;
  cell->getPixCell(pstx, psty, pwd, pht);
  cell->getValCell(vstx, vsty, vwd, vht);

  // before asign vx,vw,vy,vh, make the following swapping if needed.
  Dpoint_t c1,c2;
  int rank = getRank();
  if(rank==2) {
    
    string xname = cell->getXname();
    string yname = cell->getYname();

    // swap resonances[0] and resonances[1] to match xname, yname if needed
    if(cursor1->resonances[0].name != xname) { // resonances[0] has to be yname
	if(cursor1->resonances[0].name == yname && cursor1->resonances[1].name == xname) { 
	     // swap resonances[0] resonances[1]
	   double tmp=cursor1->resonances[0].freq;
	   string tmpstr=cursor1->resonances[0].name;
	   cursor1->resonances[0].freq=cursor1->resonances[1].freq;
	   cursor1->resonances[0].name=cursor1->resonances[1].name; 
	   cursor1->resonances[1].freq=tmp;
	   cursor1->resonances[1].name=tmpstr;
	   cursor2->resonances[0].freq=cursor1->resonances[0].freq;
	   cursor2->resonances[0].name=cursor1->resonances[0].name; 
	   cursor2->resonances[1].freq=cursor1->resonances[1].freq;
	   cursor2->resonances[1].name=cursor1->resonances[1].name; 
	}
    } 

    if(cursor1->resonances[0].name != xname || cursor1->resonances[1].name != yname) {
/*
	Winfoprintf("Mismatched nucleus names: %s to %s %s to %s.",
		cursor1->resonances[0].name.c_str(), xname.c_str(),
		cursor1->resonances[1].name.c_str(), yname.c_str());
*/
	return false; 
    }

    // swap cursor1 cursor1 so cursor1 is lower left, and cursor2 is upper right
    c1.x = cell->val2pix(HORIZ, cursor1->resonances[0].freq);
    c1.y = cell->val2pix(VERT, cursor1->resonances[1].freq);
    c2.x = cell->val2pix(HORIZ, cursor2->resonances[0].freq);
    c2.y = cell->val2pix(VERT, cursor2->resonances[1].freq);
    if(c1.x>c2.x) {
        double tmp=cursor1->resonances[0].freq;
        cursor1->resonances[0].freq=cursor2->resonances[0].freq;
        cursor2->resonances[0].freq=tmp;
    }
    if(c2.y>c1.y) {
        double tmp=cursor1->resonances[1].freq;
        cursor1->resonances[1].freq=cursor2->resonances[1].freq;
        cursor2->resonances[1].freq=tmp;
    }
    vx=cursor1->resonances[0].freq;
    vw=cursor1->resonances[0].freq-cursor2->resonances[0].freq;
    vy=cursor2->resonances[1].freq;
    vh=cursor1->resonances[1].freq-cursor2->resonances[1].freq;
  } else if(rank == 1) {

    string xname = cell->getXname();
    if(cursor1->resonances[0].name != xname) {
/*
	Winfoprintf("Mismatched nucleus names: %s %s.",
		cursor1->resonances[0].name.c_str(),xname.c_str());
*/
	return false; 
    }

    c1.x = cell->val2pix(HORIZ, cursor1->resonances[0].freq);
    c2.x = cell->val2pix(HORIZ, cursor2->resonances[0].freq);
    if(c1.x>c2.x) {
        // swap cursor1 cursor1 so cursor1 is left, and cursor2 is right
        double tmp=cursor1->resonances[0].freq;
        cursor1->resonances[0].freq=cursor2->resonances[0].freq;
        cursor2->resonances[0].freq=tmp;
    }
    vx=cursor1->resonances[0].freq;
    vw=cursor1->resonances[0].freq-cursor2->resonances[0].freq;
    double percentH;
    if(height>0) percentH = (double)height/100.0;
    else {
	percentH = getReal("aspPref",3,70);
	if(percentH>0) percentH/=100.0;
	else percentH=0.7;
    }
    if(vht<0)
    vy=vsty-percentH*vht;
    else
    vy=vsty-(1.0-percentH)*vht;
    vh=percentH*vht;

  } else return false;

// note, vy is lower left, py is upper left 
  double vp;
  px = cell->val2pix(HORIZ, vx);
  py = cell->val2pix(VERT, vy);
  if(rank==1) {
     P_getreal(CURRENT,"vp",&vp,1);
     py -= cell->getCali(VERT)*vp;
  }
  pw = fabs(vw*pwd/vwd);
  ph = fabs(vh*pht/vht);
//Winfoprintf("roi vx,vy,vw,vh,px,py,pw,ph %f %f %f %f %f %f %f %f",vx,vy,vw,vh,px,py,pw,ph); 

  return true;

}