/** * Parses the specified file and returns the document. * * @param file The file to parse. * @return Document * @throws Exception Thrown if an error occurred. */ public Document parseFile(File file) throws Exception { return parseFile(file, null); }
/** * Writes the data to the file. Binary data will be added. * * @param file The file to handle. * @param ome The element to write to the file. * @throws Exception Thrown if an error occurred while writing the XML file. */ public void writeFile(File file, OME ome) throws Exception { writeFile(file, ome, 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 }
/** * Validates the specified input. * * @param input * The input to validate * @throws Exception * Thrown if an error occurred during the validation */ private void validate(File input) throws Exception { OmeValidator validator = new OmeValidator(); validator.parseFile(input); }
/** * Creates a new image. * * @param index The identifier of the image. * @return See above. */ public Image createImage(int index) { return createImage(index, false); }
/** * Validate the specified file * Any validation errors thrown as an exception. * @param file The file to parse. * @param schemaStreamArray The schema as array of stream sources used to validate the specified file. * @throws Exception Thrown if an error occurred. */ public void validateFile(File file, StreamSource[] schemaStreamArray) throws Exception { // try parsing the file parseFileWithStreamArray(file, schemaStreamArray); }
/** * 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); }
/** * Initializes the various services. * @throws Exception Thrown if an error occurred. */ @BeforeClass protected void setUp() throws Exception { resolver = new SchemaResolver(); }
/** * Creates a default plate * * @param numberOfPlates The total number of plates. * @param index The index of the plate. * @param numberOfPlateAcquisition The number of plate acquisition to add. * @return See above. */ public Plate createPlate(int numberOfPlates, int index, int numberOfPlateAcquisition) { return createPlate(numberOfPlates, index, ROWS, COLUMNS, FIELDS, numberOfPlateAcquisition); }
/** * Validate the specified file * Any validation errors are sent to StdErr, not thrown as an exception. * @param file The file to parse. * @param schemaStreamArray The schema as array of stream sources used to validate the specified file. * @throws Exception Thrown if other (NON-VALIDATION) errors occurred. */ public void validateFileToStdError(File file, StreamSource[] schemaStreamArray) throws Exception { // try parsing the file parseFileWithStreamArrayToSdtErr(file, schemaStreamArray); }
/** Creates and populates the instrument. */ private void populateInstrument() { if (instrument != null) return; instrument = createInstrument(true); ome.addInstrument(instrument); }
/** * 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; }
public void validateFile(File file, File schema) throws Exception { // try parsing the file parseFile(file, schema); }
/** * 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); }
/** * 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; }
/** * Validate the specified file * @param file The file to parse. * @param schemaStreamArray The schema as array of stream sources used to validate the specified file. * @return true if no errors */ public boolean isValidFile(File file, StreamSource[] schemaStreamArray) { try { // try parsing the file and return true if no errors parseFileWithStreamArray(file, schemaStreamArray); return true; } catch (Exception e) { return false; } }
/** * Creates a populated plate with images. * * @param numberOfPlates The total number of plates. * @param index The index of the 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 acquisition to add. * @return See above. */ public Plate createPlate(int numberOfPlates, int index, int rows, int columns, int fields, int numberOfPlateAcquisition) { return createPlate(numberOfPlates, index, rows, columns, fields, numberOfPlateAcquisition, true); }
/** * Validate the specified file * @param file The file to parse. * @param schema The schema used to validate the specified file. * @return true if no errors */ public boolean isValidFile(File file, File schema) { try { // try parsing the file and return true if no errors parseFile(file, schema); return true; } catch (Exception e) { return false; } }
/** * Creates several screens each with several plates. * * @param screens The number of screens to create. * @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 screens, int plates, int rows, int cols, int fields, int acqs) { return createPopulatedScreen(screens, plates, rows, cols, fields, acqs, true); }
/** * Creates a populated plate with images. * * @param numberOfPlates The total number of plates. * @param index The index of the 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 acquisition to add. * @param withMicrobeam Whether the experiment should contain a microbeam * @return See above. */ public Plate createPlate(int numberOfPlates, int index, int rows, int columns, int fields, int numberOfPlateAcquisition, boolean withMicrobeam) { return createPlate(1, 0, numberOfPlates, index, rows, columns, fields, numberOfPlateAcquisition, withMicrobeam); }