/** Retrieve the total number of planes in given series. */ protected int getPlaneCount(int series) { MetadataRetrieve r = getMetadataRetrieve(); int z = r.getPixelsSizeZ(series).getValue().intValue(); int t = r.getPixelsSizeT(series).getValue().intValue(); int c = r.getPixelsSizeC(series).getValue().intValue(); c /= r.getChannelSamplesPerPixel(series, 0).getValue().intValue(); return z * c * t; }
/** Retrieve the total number of planes in given series. */ protected int getPlaneCount(int series) { MetadataRetrieve r = getMetadataRetrieve(); int z = r.getPixelsSizeZ(series).getValue().intValue(); int t = r.getPixelsSizeT(series).getValue().intValue(); int c = r.getPixelsSizeC(series).getValue().intValue(); c /= r.getChannelSamplesPerPixel(series, 0).getValue().intValue(); return z * c * t; }
/** Retrieve the number of samples per pixel for given series. */ protected int getSamplesPerPixel(int series) { MetadataRetrieve r = getMetadataRetrieve(); PositiveInteger samples = r.getChannelSamplesPerPixel(series, 0); if (samples == null) { LOGGER.warn("SamplesPerPixel #0 is null. It is assumed to be 1."); } return samples == null ? 1 : samples.getValue(); }
/** Retrieve the number of samples per pixel for given series. */ protected int getSamplesPerPixel(int series) { MetadataRetrieve r = getMetadataRetrieve(); PositiveInteger samples = r.getChannelSamplesPerPixel(series, 0); if (samples == null) { LOGGER.warn("SamplesPerPixel #0 is null. It is assumed to be 1."); } return samples == null ? 1 : samples.getValue(); }
private int planeCount() { MetadataRetrieve r = getMetadataRetrieve(); int z = r.getPixelsSizeZ(series).getValue().intValue(); int t = r.getPixelsSizeT(series).getValue().intValue(); int c = r.getChannelCount(series); String pixelType = r.getPixelsType(series).getValue(); int bytes = FormatTools.getBytesPerPixel(pixelType); if (bytes > 1 && c == 1) { c = r.getChannelSamplesPerPixel(series, 0).getValue(); } return z * c * t; }
private int planeCount() { MetadataRetrieve r = getMetadataRetrieve(); int z = r.getPixelsSizeZ(series).getValue().intValue(); int t = r.getPixelsSizeT(series).getValue().intValue(); int c = r.getChannelCount(series); String pixelType = r.getPixelsType(series).getValue(); int bytes = FormatTools.getBytesPerPixel(pixelType); if (bytes > 1 && c == 1) { c = r.getChannelSamplesPerPixel(series, 0).getValue(); } return z * c * t; }
private int planeCount(final int imageIndex) { final MetadataRetrieve r = getMetadata().getOmeMeta().getRoot(); final int z = Math.max(1, // r.getPixelsSizeZ(imageIndex).getValue().intValue()); final int t = Math.max(1, // r.getPixelsSizeT(imageIndex).getValue().intValue()); int c = r.getChannelCount(imageIndex); final String pixelType = r.getPixelsType(imageIndex).getValue(); final int bytes = FormatTools.getBytesPerPixel(pixelType); if (bytes > 1 && c == 1) { c = r.getChannelSamplesPerPixel(imageIndex, 0).getValue(); } c = Math.max(1, c); return z * c * t; }
@Override protected void translateFormatMetadata(final OMEMetadata source, final EPSFormat.Metadata dest) { final OMEXMLMetadata meta = source.getRoot(); final int sizeX = meta.getPixelsSizeX(0).getValue().intValue(); final int sizeY = meta.getPixelsSizeY(0).getValue().intValue(); final int sizeC = // meta.getChannelSamplesPerPixel(0, 0).getValue().intValue(); dest.get(0).setAxisLength(Axes.X, sizeX); dest.get(0).setAxisLength(Axes.Y, sizeY); dest.get(0).setAxisLength(Axes.CHANNEL, sizeC); } }
private void setupResolutions(IMetadata meta) { if (!(meta instanceof OMEPyramidStore)) { return; } for (int series=0; series<meta.getImageCount(); series++) { int width = meta.getPixelsSizeX(series).getValue(); int height = meta.getPixelsSizeY(series).getValue(); for (int i=1; i<pyramidResolutions; i++) { int scale = (int) Math.pow(pyramidScale, i); ((OMEPyramidStore) meta).setResolutionSizeX( new PositiveInteger(width / scale), series, i); ((OMEPyramidStore) meta).setResolutionSizeY( new PositiveInteger(height / scale), series, i); } } }
@Test(dependsOnMethods={"testValidImageMetadata"}) public void testValidPixelsMetadata() { assertEquals(SIZE_X, metadata.getPixelsSizeX(0).getValue()); assertEquals(SIZE_Y, metadata.getPixelsSizeY(0).getValue()); assertEquals(SIZE_Z, metadata.getPixelsSizeZ(0).getValue()); assertEquals(SIZE_C, metadata.getPixelsSizeC(0).getValue()); assertEquals(SIZE_T, metadata.getPixelsSizeT(0).getValue()); assertEquals(DIMENSION_ORDER, metadata.getPixelsDimensionOrder(0)); assertEquals(PIXEL_TYPE, metadata.getPixelsType(0)); }
protected int getSizeX() throws FormatException { MetadataRetrieve r = getMetadataRetrieve(); if (r == null) { throw new FormatException("MetadataRetrieve cannot be null"); } PositiveInteger x = null; if (getResolution() == 0) { x = r.getPixelsSizeX(getSeries()); } else if (hasResolutions()) { x = resolutionData.get(getSeries()).get(getResolution() - 1).sizeX; } else { x = ((IPyramidStore) r).getResolutionSizeX(getSeries(), getResolution()); } if (x == null) { throw new FormatException("Size X must not be null"); } return x.getValue().intValue(); }
protected int getSizeY() throws FormatException { MetadataRetrieve r = getMetadataRetrieve(); if (r == null) { throw new FormatException("MetadataRetrieve cannot be null"); } PositiveInteger y = null; if (getResolution() == 0) { y = r.getPixelsSizeY(getSeries()); } else if (hasResolutions()) { y = resolutionData.get(getSeries()).get(getResolution() - 1).sizeY; } else { y = ((IPyramidStore) r).getResolutionSizeY(getSeries(), getResolution()); } if (y == null) { throw new FormatException("Size Y must not be null"); } return y.getValue().intValue(); }
protected int getSizeY() throws FormatException { MetadataRetrieve r = getMetadataRetrieve(); if (r == null) { throw new FormatException("MetadataRetrieve cannot be null"); } PositiveInteger y = null; if (getResolution() == 0) { y = r.getPixelsSizeY(getSeries()); } else if (hasResolutions()) { y = resolutionData.get(getSeries()).get(getResolution() - 1).sizeY; } else { y = ((IPyramidStore) r).getResolutionSizeY(getSeries(), getResolution()); } if (y == null) { throw new FormatException("Size Y must not be null"); } return y.getValue().intValue(); }
protected int getSizeX() throws FormatException { MetadataRetrieve r = getMetadataRetrieve(); if (r == null) { throw new FormatException("MetadataRetrieve cannot be null"); } PositiveInteger x = null; if (getResolution() == 0) { x = r.getPixelsSizeX(getSeries()); } else if (hasResolutions()) { x = resolutionData.get(getSeries()).get(getResolution() - 1).sizeX; } else { x = ((IPyramidStore) r).getResolutionSizeX(getSeries(), getResolution()); } if (x == null) { throw new FormatException("Size X must not be null"); } return x.getValue().intValue(); }
@Test(dependsOnMethods={"testValidImageNode"}) public void testValidPixelsNode() { Pixels pixels = ome.getImage(0).getPixels(); assertEquals(SIZE_X, pixels.getSizeX().getValue()); assertEquals(SIZE_Y, pixels.getSizeY().getValue()); assertEquals(SIZE_Z, pixels.getSizeZ().getValue()); assertEquals(SIZE_C, pixels.getSizeC().getValue()); assertEquals(SIZE_T, pixels.getSizeT().getValue()); assertEquals(DIMENSION_ORDER, pixels.getDimensionOrder()); assertEquals(PIXEL_TYPE, pixels.getType()); assertEquals(1, pixels.sizeOfTiffDataList()); }
public SPWModelMock(boolean makeLightSources) { ome = new OME(); annotations = new StructuredAnnotations(); ome.addInstrument(makeInstrument(makeLightSources)); for (int i = 0; i < WELL_ROWS.getValue() * WELL_COLS.getValue(); i++) { ome.addImage(makeImage(i)); } ome.addPlate(makePlate()); ome.setStructuredAnnotations(annotations); }
@Test(dependsOnMethods={"testValidOMENode"}) public void testValidPlateNode() { Plate plate = ome.getPlate(0); assertNotNull(plate); assertEquals(PLATE_ID, plate.getID()); assertEquals(plate.getRows(), WELL_ROWS); assertEquals(plate.getColumns(), WELL_COLS); assertEquals(plate.getRowNamingConvention(), WELL_ROW); assertEquals(plate.getColumnNamingConvention(), WELL_COL); assertEquals(plate.sizeOfWellList(), WELL_ROWS.getValue() * WELL_COLS.getValue()); for (Integer row=0; row<WELL_ROWS.getValue(); row++) { for (Integer col=0; col<WELL_COLS.getValue(); col++) { Well well = plate.getWell(row * WELL_COLS.getValue() + col); assertNotNull(well); assertEquals(String.format("Well:%d_%d", row, col), well.getID()); assertEquals(well.getRow(), row); assertEquals(well.getColumn(), col); } } }
@Test(dependsOnMethods={"testValidPlateNode"}) public void testValidWellSamples() { Plate plate = ome.getPlate(0); Integer wellSampleIndex = 0; for (int row=0; row<plate.getRows().getValue(); row++) { for (int col=0; col<plate.getColumns().getValue(); col++) { Well well = plate.getWell(row * plate.getColumns().getValue() + col); assertEquals(1, well.sizeOfWellSampleList()); WellSample sample = well.getWellSample(0); assertNotNull(sample); assertEquals(String.format("WellSample:%d_%d", row, col), sample.getID()); assertEquals(wellSampleIndex, sample.getIndex().getValue()); Image image = sample.getLinkedImage(); assertNotNull(image); assertEquals(IMAGE_ID, image.getID()); wellSampleIndex++; } } }