/** * Creates a new image. * * @param index The identifier of the image. * @return See above. */ public Image createImage(int index) { return createImage(index, false); }
/** * Creates several plates but no containing screen. * * @param plates The number of plates to create. * @param rows The number of rows for plate. * @param cols The number of columns for plate. * @param fields The number of fields. * @param acqs The number of plate acquisitions. * @return See above. */ public OME createPopulatedPlate(int plates, int rows, int cols, int fields, int acqs) { return createPopulatedPlate(plates, rows, cols, fields, acqs, true); }
/** * Creates one 2x2 plate of with a single well sample per well and one * plate acquisition. */ public OME createPopulatedScreen() { return createPopulatedScreen(1, 2, 2, 2, 2); //1, 2, 2, 1, 1 }
populateInstrument(); image.setDescription("Image Description "+index); if (metadata) { image.setImagingEnvironment(createImageEnvironment()); image.setStageLabel(createStageLabel()); BinData data; for (int i = 0; i < SIZE_Z*SIZE_C*SIZE_T; i++) { data = createBinData(SIZE_X, SIZE_Y, BYTES_PER_PIXEL); pixels.addBinData(data); for (int t = 0; t < SIZE_T; t++) { for (int c = 0; c < SIZE_C; c++) { pixels.addPlane(createPlane(z, c, t)); int j = 0; int n = LIGHT_SOURCES.length-1; DetectorSettings ds = createDetectorSettings(0); for (int i = 0; i < SIZE_C; i++) { channel = createChannel(i); channel.setID("Channel:" + index + ":" + i); if (metadata) { if (j == n) j = 0; channel.setLightSourceSettings(createLightSourceSettings(j)); channel.setLightPath(createLightPath()); channel.setDetectorSettings(ds); j++;
private int populateSPW(MetadataStore store, int screens, int plates, int rows, int cols, int fields, int acqs, boolean withMicrobeam) { final XMLMockObjects xml = new XMLMockObjects(); OME ome = null; if (screens==0) { ome = xml.createPopulatedPlate(plates, rows, cols, fields, acqs, withMicrobeam); } else { ome = xml.createPopulatedScreen(screens, plates, rows, cols, fields, acqs, withMicrobeam); } if (withMicrobeam) roiCount = roiCount + plates;; getOmeXmlMetadata().setRoot(new OMEXMLMetadataRoot(ome)); // copy populated SPW metadata into destination MetadataStore getOmeXmlService().convertMetadata(omeXmlMetadata, store); domains = new String[] {FormatTools.HCS_DOMAIN}; return ome.sizeOfImageList(); }
/** * Creates an image with acquisition data. * * @return See above. */ public OME createImageWithAcquisitionData() { populateInstrument(); Image image = createImage(0, true); ObjectiveSettings settings = createObjectiveSettings(0); image.setObjectiveSettings(settings); //Add microbeam Experiment exp = createExperiment(0); ome.addExperiment(exp); MicrobeamManipulation mm = createMicrobeamManipulation(0); exp.addMicrobeamManipulation(mm); image.linkExperiment(exp); image.linkInstrument(instrument); image.linkMicrobeamManipulation(mm); ome.addImage(image); return ome; }
Instrument instrument = new Instrument(); instrument.setID("Instrument:"+index); instrument.setMicroscope(createMicroscope()); if (populate) { for (int i = 0; i < NUMBER_OF_OBJECTIVES; i++) { instrument.addObjective(createObjective(i)); instrument.addDetector(createDetector(i)); instrument.addFilterSet(createFilterSet(index)); for (int i = 0; i < NUMBER_OF_FILTERS; i++) { instrument.addFilter(createFilter(i, CUT_IN, CUT_OUT)); instrument.addDichroic(createDichroic(i)); instrument.addLightSource(createLightSource(LIGHT_SOURCES[i], i));
"."+OME_XML_FORMAT); files.add(outputFile); XMLMockObjects xml = new XMLMockObjects(); XMLWriter writer = new XMLWriter(); writer.writeFile(inFile, xml.createImage(), true);
/** * Generates an <code>OME-XML</code> file. * * @param index The type of image to import. One of the constants defined * by this class. * @return The image file. * @throws Exception Thrown if an error occurred. */ private File createImageFile(int index) throws Exception { // First create an image File f = File.createTempFile("tempFileName","." + OME_XML); XMLMockObjects xml = new XMLMockObjects(); XMLWriter writer = new XMLWriter(); if (index == IMAGE_ROI) { writer.writeFile(f, xml.createImageWithROI(), true); } else if (index == IMAGE_ANNOTATED_DATA) { writer.writeFile(f, xml.createImageWithAnnotatedAcquisitionData(), true); } else { writer.writeFile(f, xml.createImageWithAcquisitionData(), true); } return f; }
/** * Creates and annotates an image. * The following types of annotations are added: * TagAnnotation, TermAnnotation, BooleanAnnotation, LongAnnotation, * CommentAnnotation. * * @return See above. */ public OME createAnnotatedImage() { StructuredAnnotations annotations = new StructuredAnnotations(); int index = 0; Image image = createImage(index); ome.addImage(image); annotations.addCommentAnnotation((CommentAnnotation) createAnnotation( CommentAnnotation.class.getName(), image, index)); annotations.addBooleanAnnotation((BooleanAnnotation) createAnnotation( BooleanAnnotation.class.getName(), image, index)); annotations.addLongAnnotation((LongAnnotation) createAnnotation( LongAnnotation.class.getName(), image, index)); annotations.addTagAnnotation((TagAnnotation) createAnnotation( TagAnnotation.class.getName(), image, index)); annotations.addTermAnnotation((TermAnnotation) createAnnotation( TermAnnotation.class.getName(), image, index)); ome.setStructuredAnnotations(annotations); return ome; }
/** * Creates an image with ROI. * * @return See above. */ public OME createImageWithROI() { int index = 0; Image image = createImage(index, false); ome.addImage(image); ROI roi; for (int i = 0; i < SIZE_C; i++) { roi = createROI(i, 0, i, 0); image.linkROI(roi); ome.addROI(roi); } return ome; }
m.setWidth(new Double(SIZE_X)); m.setHeight(new Double(SIZE_Y)); m.setBinData(createBinData(SIZE_X,SIZE_Y,BYTES_PER_PIXEL)); shape = m; shape.setTheZ(new NonNegativeInteger(z)); shape.setTheT(new NonNegativeInteger(t)); shape.setTransform(createTransform()); shape.setFillColor(new ome.xml.model.primitives.Color(100)); shape.setStrokeColor(new ome.xml.model.primitives.Color(100));
/** * Creates a binary file. * * @return See above. */ public BinaryFile createBinaryFile() { BinaryFile bf = new BinaryFile(); bf.setBinData(createBinData(SIZE_X, SIZE_Y, BYTES_PER_PIXEL)); return bf; }
FileAnnotation f = new FileAnnotation(); f.setID("ImageFileAnnotation:" + index); f.setBinaryFile(createBinaryFile()); annotation = f; FileAnnotation f = new FileAnnotation(); f.setID("PlateFileAnnotation:" + index); f.setBinaryFile(createBinaryFile()); annotation = f; FileAnnotation f = new FileAnnotation(); f.setID("WellFileAnnotation:" + index); f.setBinaryFile(createBinaryFile()); annotation = f;
private int populateSPW(MetadataStore store, int screens, int plates, int rows, int cols, int fields, int acqs, boolean withMicrobeam) { final XMLMockObjects xml = new XMLMockObjects(); OME ome = null; if (screens==0) { ome = xml.createPopulatedPlate(plates, rows, cols, fields, acqs, withMicrobeam); } else { ome = xml.createPopulatedScreen(screens, plates, rows, cols, fields, acqs, withMicrobeam); } if (withMicrobeam) roiCount = roiCount + plates;; getOmeXmlMetadata().setRoot(new OMEXMLMetadataRoot(ome)); // copy populated SPW metadata into destination MetadataStore getOmeXmlService().convertMetadata(omeXmlMetadata, store); domains = new String[] {FormatTools.HCS_DOMAIN}; return ome.sizeOfImageList(); }
populateInstrument(); index++; Image image = createImage(0, true); ObjectiveSettings settings = createObjectiveSettings(0); image.setObjectiveSettings(settings); Experiment exp = createExperiment(0); ome.addExperiment(exp); image.linkExperiment(exp);
"."+OME_XML_FORMAT); files.add(outputFile); XMLMockObjects xml = new XMLMockObjects(); XMLWriter writer = new XMLWriter(); writer.writeFile(inFile, xml.createImage(), true);
"."+OME_XML_FORMAT); files.add(outputFile); XMLMockObjects xml = new XMLMockObjects(); XMLWriter writer = new XMLWriter(); writer.writeFile(inFile, xml.createImage(), true);
/** * Creates an image with a given experiment. The Image is not added to ome. * * @return See above. */ public Image createImageWithExperiment(int index, boolean metadata, Experiment exp) { Image image = createImage(index, metadata); image.linkExperiment(exp); return image; }
/** * Creates a screen with several plates. * * @param plates The number of plates to create. * @param rows The number of rows for plate. * @param cols The number of columns for plate. * @param fields The number of fields. * @param acqs The number of plate acquisitions. * @return See above. */ public OME createPopulatedScreen(int plates, int rows, int cols, int fields, int acqs) { return createPopulatedScreen(1, plates, rows, cols, fields, acqs); }