void list(int sock)
{
    char msg[] = {"server/list: Doing a LIST :O\n"};
    FILE* file = fopen(LOGNAME, "ab");
    fputs(msg, file);
    printf("%s", msg);
    fclose(file);

    //Get current filestate
    filestate currState;
    update_files(&currState);
    send_filenames(&currState, sock);
}
Exemple #2
0
void CycleRead::run()
{
  time_t seconds;


  forever {
      mutex.lock();
      QString dcmrawpath = this->_dcmrawpath;
      mutex.unlock();

      read_dcmrawdatapath(dcmrawpath);

//      qDebug()<<"\n _fileblocks.size(): "<< _fileblocks.size();
      for(int i=0; i<_fileblocks.size();++i)
      {
        if(_fileblocks[i].get_lastfile() == false)
        { // set file status to lastfile if max_acq_time is reached
          seconds = time (NULL);
          if(_fileblocks[i].get_cnt_lastfile() == 0)  //first time here
          {
            _fileblocks[i].set_cnt_lastfile(unsigned(seconds));
          }
          if((_fileblocks[i].get_cnt_lastfile()+_max_acq_time) <= unsigned(seconds))
          {
            _fileblocks[i].set_lastfile(true);
          }
        }

//        qDebug()<<"\n fileblocks: "<<_fileblocks[i];

        if(_fileblocks[i].get_lastfile() == true)
        { // start calculation

          emit send_filenames(_fileblocks[i].get_filepath(), _fileblocks[i].get_filename());

          _fileblocks.removeAt(i);
          break;

        }

      }


      //emit send_filenames(_p_file_pool);

      QThread::sleep(int(1));   //sleep for 1 sec
      if (abort)
        return;

  }
}
void diff(int sock)
{
    char msg[] = {"server/diff: Doing a DIFF :O\n"};
    FILE* file = fopen(LOGNAME, "ab");
    fputs(msg, file);
    fclose(file);

    printf("%s", msg);
    filestate serverState;
    filestate clientState;
    filestate diff;

    update_files(&serverState);

    rcv_IDs(&clientState, sock);
    delta(&clientState, &serverState, &diff);
    send_filenames(&diff, sock);
}
Exemple #4
0
IMT_MRGui::IMT_MRGui(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::IMT_MRGui)
{
  // Initialize the first GPU
  GPU0_.allocateGPU(0);
  GPU0_.printInformation(std::cout);

  size_t free;
  size_t total;
  cuMemGetInfo(&free, &total);
  std::cout << "free memory: " << free / 1024 / 1024 << "mb, total memory: " << total / 1024 / 1024 << "mb" << std::endl;

  ui->setupUi(this);

  read_siemens = 0;
  fftobj_ = new agile::FFT<TType>();
  kspacefovobj_ = new agile::KSpaceFOV<TType>();

  open_irgnpara_window = new IRGN_para(); // Be sure to destroy you window somewhere
  open_irgnpara_window->hide();

  _pathsetting = new PathSetting(); // Be sure to destroy you window somewhere
  _pathsetting->hide();

  _specialsetting = new SpecialSetting(); // Be sure to destroy you window somewhere
  _specialsetting->hide();


  setStatusBar();
  setTitleText("");

  future = new QFuture<void>;
  watcher = new QFutureWatcher<void>;
  _cycleread_thread = new CycleRead;
  _cycleread_thread->set_max_acq_time(_specialsetting->get_autoload_timeout());


  _infotext="";

  QObject::connect(this,SIGNAL(sendInfo(QString, bool)),this,SLOT(set_Info(QString, bool)));
  QObject::connect(this,SIGNAL(sendWarning(QString)),this,SLOT(set_Warning(QString)));
  QObject::connect(this,SIGNAL(sendSaveFile(QString,QString)),this,SLOT(set_SaveFile(QString,QString)),Qt::BlockingQueuedConnection);

  QObject::connect(_cycleread_thread, SIGNAL(send_filenames(QStringList, QStringList)),
          this, SLOT(startauto(QStringList, QStringList)));

  _act_index = 0;
  _automatic_on = false;
  _write_file_index=0;

  ui->cb_savingtype->setCurrentIndex(2);
  ui->pb_automatic->setText("Auto Off");

  _postprocess = new agile::PostProcess<TType, TType_real>();


  QLabel* imageLabel = new QLabel(this);
  imageLabel->setBackgroundRole(QPalette::Base);
  imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
  imageLabel->setScaledContents(true);
  QImage image(":/images/wappen.png");
  imageLabel->setPixmap(QPixmap::fromImage(image));
  imageLabel->resize(imageLabel->pixmap()->size());
  imageLabel->setGeometry((this->width() - imageLabel->sizeHint().width()), 40, imageLabel->sizeHint().width(), imageLabel->sizeHint().height());
  imageLabel->show();
}