コード例 #1
0
  /**
   * Uses the {@link OMEROMetadataStoreClient} to save all metadata for the current image provided.
   *
   * @param mij Object hosting metadata to save.
   * @return the newly created {@link Pixels} id.
   * @throws FormatException if there is an error parsing metadata.
   * @throws IOException if there is an error reading the file.
   */
  @SuppressWarnings({"unchecked", "rawtypes"})
  public Map<String, List<IObject>> importMetadata(MetadataImportJob mij) throws Throwable {
    notifyObservers(new ImportEvent.LOADING_IMAGE(shortName, 0, 0, 0));

    // 1st we post-process the metadata that we've been given.
    notifyObservers(new ImportEvent.BEGIN_POST_PROCESS(0, null, null, null, 0, null));
    store.setUserSpecifiedName(userSpecifiedName);
    store.setUserSpecifiedDescription(userSpecifiedDescription);
    if (userPixels != null && userPixels.length >= 3)
      // The array could be empty due to Ice-non-null semantics.
      store.setUserSpecifiedPhysicalPixelSizes(userPixels[0], userPixels[1], userPixels[2]);
    store.setUserSpecifiedTarget(userSpecifiedTarget);
    store.setUserSpecifiedAnnotations(annotationList);
    store.postProcess();
    notifyObservers(new ImportEvent.END_POST_PROCESS(0, null, userSpecifiedTarget, null, 0, null));

    notifyObservers(new ImportEvent.BEGIN_SAVE_TO_DB(0, null, userSpecifiedTarget, null, 0, null));
    objects = store.saveToDB(activity);
    pixList = (List) objects.get(Pixels.class.getSimpleName());
    imageList = (List) objects.get(Image.class.getSimpleName());
    plateList = (List) objects.get(Plate.class.getSimpleName());
    notifyObservers(new ImportEvent.END_SAVE_TO_DB(0, null, userSpecifiedTarget, null, 0, null));

    return objects;
  }