示例#1
0
 private Tgm getModel(GtaModelReference gtaModelReference) {
   TgmDataObject tgmDO = null;
   Tgm model = null;
   String path = project.getProjectDirectory() + File.separator + gtaModelReference.getPath();
   try {
     File datasetF = new File(path);
     FileObject datasetFO = FileUtil.createData(datasetF);
     DataObject datasetDO = DataObject.find(datasetFO);
     if (datasetDO != null) {
       tgmDO = (TgmDataObject) datasetDO;
       model = tgmDO.getTgm();
     }
   } catch (DataObjectExistsException ex) {
     Exceptions.printStackTrace(ex);
   } catch (IOException ex) {
     Exceptions.printStackTrace(ex);
   }
   return model;
 }
示例#2
0
 private DatasetTimp[] getDatasets(GtaDatasetContainer gtaDatasetContainer) {
   TimpDatasetDataObject timpDatasetDO = null;
   int numberOfDatasets = gtaDatasetContainer.getDatasets().size();
   datasets = new DatasetTimp[numberOfDatasets];
   for (int i = 0; i < numberOfDatasets; i++) {
     GtaDataset gtaDataset = gtaDatasetContainer.getDatasets().get(i);
     String path = project.getProjectDirectory() + File.separator + gtaDataset.getPath();
     try {
       File datasetF = new File(path);
       FileObject datasetFO = FileUtil.createData(datasetF);
       DataObject datasetDO = DataObject.find(datasetFO);
       if (datasetDO != null) {
         timpDatasetDO = (TimpDatasetDataObject) datasetDO;
         datasets[i] = timpDatasetDO.getDatasetTimp();
       }
     } catch (DataObjectExistsException ex) {
       Exceptions.printStackTrace(ex);
     } catch (IOException ex) {
       Exceptions.printStackTrace(ex);
     }
   }
   return datasets;
 }
示例#3
0
 private Tgm getModel(String filename, String relativeFilePath) {
   TgmDataObject tgmDO;
   Tgm model = null;
   String newPath =
       project.getProjectDirectory()
           + File.separator
           + relativeFilePath
           + File.separator
           + filename;
   try {
     File datasetF = new File(newPath);
     FileObject datasetFO = FileUtil.createData(datasetF);
     DataObject datasetDO = DataObject.find(datasetFO);
     if (datasetDO != null) {
       tgmDO = (TgmDataObject) datasetDO;
       model = tgmDO.getTgm();
     }
   } catch (DataObjectExistsException ex) {
     Exceptions.printStackTrace(ex);
   } catch (IOException ex) {
     Exceptions.printStackTrace(ex);
   }
   return model;
 }
示例#4
0
  private void writeResults(
      TimpResultDataset[] results, GtaModelReference modelReference, String[] nlsprogressResult) {
    Tgm model = getModel(modelReference);
    GtaResult newResultsObject = new GtaResult();
    String freeResultsFilename =
        FileUtil.findFreeFileName(resultsfolder, resultsfolder.getName(), "summary");
    try {
      writeSummary(resultsfolder, freeResultsFilename);
    } catch (IOException ex) {
      Exceptions.printStackTrace(ex);
    }

    if (nlsprogressResult != null) {
      for (int i = 0; i < nlsprogressResult.length; i++) {
        NlsProgress progress = new NlsProgress();
        progress.setRss(nlsprogressResult[i]);
        newResultsObject.getNlsprogress().add(progress);
      }
    }

    for (int i = 0; i < results.length; i++) {
      TimpResultDataset timpResultDataset = results[i];
      timpResultDataset.setType(datasets[i].getType());

      newResultsObject.getDatasets().add(new Dataset());
      newResultsObject.getDatasets().get(i).setDatasetFile(new OutputFile());
      newResultsObject
          .getDatasets()
          .get(i)
          .getDatasetFile()
          .setFilename(datasetContainer.getDatasets().get(i).getFilename());
      newResultsObject
          .getDatasets()
          .get(i)
          .getDatasetFile()
          .setPath(datasetContainer.getDatasets().get(i).getPath());
      newResultsObject.getDatasets().get(i).getDatasetFile().setFiletype(datasets[i].getType());
      newResultsObject.getDatasets().get(i).setId(String.valueOf(i + 1));

      if (model.getDat().getIrfparPanel().getLamda() != null) {
        timpResultDataset.setLamdac(model.getDat().getIrfparPanel().getLamda());
      }

      if (datasets[i].getType().equalsIgnoreCase("flim")) {
        timpResultDataset.setOrheigh(datasets[i].getOriginalHeight());
        timpResultDataset.setOrwidth(datasets[i].getOriginalWidth());
        timpResultDataset.setIntenceIm(datasets[i].getIntenceIm().clone());
        timpResultDataset.setMaxInt(datasets[i].getMaxInt());
        timpResultDataset.setMinInt(datasets[i].getMinInt());
        timpResultDataset.setX(datasets[i].getX().clone());
        timpResultDataset.setX2(datasets[i].getX2().clone());
      }

      try {
        String freeFilename =
            FileUtil.findFreeFileName(
                resultsfolder,
                resultsfolder.getName() + "_d" + (i + 1) + "_" + timpResultDataset.getDatasetName(),
                "timpres");
        timpResultDataset.setDatasetName(freeFilename);
        writeTo = resultsfolder.createData(freeFilename, "timpres");
        ObjectOutputStream stream = new ObjectOutputStream(writeTo.getOutputStream());
        stream.writeObject(timpResultDataset);
        stream.close();

        newResultsObject.getDatasets().get(i).setResultFile(new OutputFile());
        newResultsObject.getDatasets().get(i).getResultFile().setFilename(freeFilename);
        newResultsObject
            .getDatasets()
            .get(i)
            .getResultFile()
            .setPath(FileUtil.getRelativePath(project.getProjectDirectory(), resultsfolder));

      } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
      }
    }
    try {
      writeResultsXml(newResultsObject);
    } catch (IOException ex) {
      Exceptions.printStackTrace(ex);
    }
  }