コード例 #1
0
  /**
   * Creates a plate.
   *
   * @param rows The number of rows.
   * @param columns The number of columns.
   * @param fields The number of fields.
   * @param numberOfPlateAcquisition The number of plate acquisitions.
   * @param fullImage Pass <code>true</code> to add image with pixels, <code>false</code> to create
   *     a simple image.
   * @return See above.
   */
  public Plate createPlate(
      int rows, int columns, int fields, int numberOfPlateAcquisition, boolean fullImage)
      throws Exception {
    if (numberOfPlateAcquisition < 0) numberOfPlateAcquisition = 0;
    Plate p = new PlateI();
    p.setRows(omero.rtypes.rint(rows));
    p.setColumns(omero.rtypes.rint(columns));
    p.setName(omero.rtypes.rstring("plate name"));
    p.setDescription(omero.rtypes.rstring("plate description"));
    p.setStatus(omero.rtypes.rstring("plate status"));
    p.setExternalIdentifier(omero.rtypes.rstring("external identifier"));
    // now make wells
    Well well;
    WellSample sample;
    List<PlateAcquisition> pas = new ArrayList<PlateAcquisition>();
    PlateAcquisition pa;
    for (int i = 0; i < numberOfPlateAcquisition; i++) {
      pa = new PlateAcquisitionI();
      pa.setName(omero.rtypes.rstring("plate acquisition"));
      pa.setPlate(p);
      pas.add(pa);
    }
    Iterator<PlateAcquisition> i;
    for (int row = 0; row < rows; row++) {
      for (int column = 0; column < columns; column++) {
        well = new WellI();
        well.setRow(omero.rtypes.rint(row));
        well.setColumn(omero.rtypes.rint(column));
        if (pas.size() == 0) {
          for (int field = 0; field < fields; field++) {
            sample = new WellSampleI();
            if (fullImage) sample.setImage(createImage());
            else sample.setImage(simpleImage(0));
            well.addWellSample(sample);
          }
        } else {
          i = pas.iterator();
          while (i.hasNext()) {
            pa = i.next();
            for (int field = 0; field < fields; field++) {
              sample = new WellSampleI();
              if (fullImage) sample.setImage(createImage());
              else sample.setImage(simpleImage(0));
              well.addWellSample(sample);
              pa.addWellSample(sample);
            }
          }
        }

        p.addWell(well);
      }
    }
    return p;
  }
コード例 #2
0
  /**
   * Creates a basic plate and links the wells to the passed reagent.
   *
   * @param rows The number of rows.
   * @param columns The number of columns.
   * @param fields The number of fields.
   * @param r The reagent.
   * @return See above.
   */
  public Plate createPlateWithReagent(int rows, int columns, int fields, Reagent r) {
    Plate p = new PlateI();
    p.setRows(omero.rtypes.rint(rows));
    p.setColumns(omero.rtypes.rint(columns));
    p.setName(omero.rtypes.rstring("plate"));
    // now make wells
    Well well;
    WellSample sample;

    for (int row = 0; row < rows; row++) {
      for (int column = 0; column < columns; column++) {
        well = new WellI();
        well.setRow(omero.rtypes.rint(row));
        well.setColumn(omero.rtypes.rint(column));
        well.linkReagent(r);
        for (int field = 0; field < fields; field++) {
          sample = new WellSampleI();
          sample.setImage(simpleImage(0));
          well.addWellSample(sample);
        }
        p.addWell(well);
      }
    }
    return p;
  }