Exemplo n.º 1
0
// process a single acquisition
int RtDataViewer::process(ACE_Message_Block *mb) {
  ACE_TRACE(("RtDataViewer::process"));

  RtStreamMessage *msg = (RtStreamMessage*) mb->rd_ptr();

  // get the current time
  unsigned int time = msg->getCurrentData()->getDataID().getTimePoint();

  // debug
  getDataStore().getAvailableData();

  RtDataID id;
  // find all data requested
  for(vector<string>::iterator i = dataIds.begin(); i != dataIds.end(); i++) {
    id.setFromString(*i);

    if(id.getTimePoint() != DATAID_NUM_UNSET_VALUE
       && id.getTimePoint() != DATAID_NUM_WILDCARD_VALUE) {
      id.setTimePoint(time);
    }

    cout << "RtDataViewer::process: searching for " << id
         << " from " << *i << endl;

    // find the data with the right ID
    RtData *dat = getDataStore().getData(id);

    if(dat == NULL) {
      cout << "RtDataViewer::process: could not find " << id << endl;
      if(logOutput) {
        stringstream logs("");
        logs << "RtDataViewer::process: could not find " << id << endl;
        log(logs);
      }
    }
    else {
      cout << "RtDataViewer::process: found " << dat->getDataID() << endl;
      if(logOutput) {
        stringstream logs("");
        logs << "RtDataViewer::process: found "
             << dat->getDataID() << endl;
        log(logs);
      }
    }
  }

  return 0;
}
Exemplo n.º 2
0
void PlotController::handleData(QString qid) {
    RtDataID id;
    id.setFromString(qid.toStdString());

    if (id.getDataName() == NAME_DESIGN) {
        baseline_box->topLeft->setCoords(0, 10);
        baseline_box->bottomRight->setCoords(getNumDataPointsForErrEst(), -10);

        RtDesignMatrix *design =
            static_cast<RtDesignMatrix*>(getDataStore().getData(id));
        updateTRIndicators();
        plotDesign(design);

        roi_plot->xAxis->setRange(0, design->getNumRows());
        roi_plot->replot();
        motion_plot->xAxis->setRange(0, design->getNumRows());
        motion_plot->replot();
    }
    else if (id.getModuleID() == ID_ROICOMBINE) {
        map<string, int>::const_iterator it = roi_graphs.find(id.getRoiID());
        if (it == roi_graphs.end()) {
            it = roi_graphs.insert(
                     pair<string, int>(id.getRoiID(), roi_plot->graphCount())).first;
            roi_plot->addGraph();
            roi_plot->graph(it->second)->setPen(QPen(roi_colormap.getColorForName(
                                                    id.getRoiID())));
            roi_plot->graph(it->second)->setName(QString(id.getRoiID().c_str()));
            roi_plot->legend->setVisible(true);
        }

        RtActivation *val = static_cast<RtActivation*>(getDataStore().getData(id));
        roi_plot->graph(roi_graphs[id.getRoiID()])->addData(id.getTimePoint(),
                val->getPixel(0));
        roi_plot->replot();
    }
    else if (id.getModuleID() == ID_MOTION) {
        plotMotion(static_cast<RtMotion*>(getDataStore().getData(id)));
    }

    if (id.getTimePoint() != DATAID_NUM_UNSET_VALUE &&
            id.getTimePoint() > current_tr) {
        current_tr = id.getTimePoint();
        updateTRIndicators();
    }
}