| 1 | /* |
|---|
| 2 | * ome.api.RawPixelsStore |
|---|
| 3 | * |
|---|
| 4 | * Copyright 2006 University of Dundee. All rights reserved. |
|---|
| 5 | * Use is subject to license terms supplied in LICENSE.txt |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | package ome.api; |
|---|
| 9 | |
|---|
| 10 | import java.util.Set; |
|---|
| 11 | |
|---|
| 12 | import ome.annotations.Validate; |
|---|
| 13 | |
|---|
| 14 | /** |
|---|
| 15 | * Binary data provider. Initialized with the id of a |
|---|
| 16 | * {@link ome.model.core.Pixels} instance, this interface can provide various |
|---|
| 17 | * slices, stacks, regions of the 5-dimensional (X-Y planes with multiple |
|---|
| 18 | * Z-sections and Channels over Time). The byte array returned by the getter |
|---|
| 19 | * methods and passed to the setter methods can and will be interpreted |
|---|
| 20 | * according to results of {@link #getByteWidth()}, {@link #isFloat()}, and |
|---|
| 21 | * {@link #isSigned()}. |
|---|
| 22 | */ |
|---|
| 23 | public interface RawPixelsStore extends StatefulServiceInterface { |
|---|
| 24 | |
|---|
| 25 | // State management. |
|---|
| 26 | /** |
|---|
| 27 | * Initializes the stateful service for a given Pixels set. |
|---|
| 28 | * @param pixelsId Pixels set identifier. |
|---|
| 29 | * @param bypassOriginalFile Whether or not to bypass checking for an |
|---|
| 30 | * original file to back the pixel buffer used by this service. If requests |
|---|
| 31 | * are predominantly <code>write-only</code> or involve the population of |
|---|
| 32 | * a brand new pixel buffer using <code>true</code> here is a safe |
|---|
| 33 | * optimization otherwise <code>false</code> is expected. |
|---|
| 34 | */ |
|---|
| 35 | public void setPixelsId(long pixelsId, boolean bypassOriginalFile); |
|---|
| 36 | |
|---|
| 37 | /** |
|---|
| 38 | * Returns the current Pixels set identifier. |
|---|
| 39 | * @return See above. |
|---|
| 40 | */ |
|---|
| 41 | public long getPixelsId(); |
|---|
| 42 | |
|---|
| 43 | /** |
|---|
| 44 | * Prepares the stateful service with a cache of loaded Pixels objects. |
|---|
| 45 | * This method is designed to combat query overhead, where many sets of |
|---|
| 46 | * Pixels are to be read from or written to, by loading all the Pixels |
|---|
| 47 | * sets at once. Multiple calls will result in the existing cache being |
|---|
| 48 | * overwritten. |
|---|
| 49 | * @param pixelsIds Pixels IDs to cache. |
|---|
| 50 | */ |
|---|
| 51 | public void prepare(@Validate(Long.class) Set<Long> pixelsIds); |
|---|
| 52 | |
|---|
| 53 | /** |
|---|
| 54 | * delegates to {@link ome.io.nio.PixelBuffer} |
|---|
| 55 | * |
|---|
| 56 | * @param pixelsId |
|---|
| 57 | * @return |
|---|
| 58 | * @see ome.io.nio.PixelBuffer#getPlaneSize() |
|---|
| 59 | */ |
|---|
| 60 | public int getPlaneSize(); |
|---|
| 61 | |
|---|
| 62 | public int getRowSize(); |
|---|
| 63 | |
|---|
| 64 | public int getStackSize(); |
|---|
| 65 | |
|---|
| 66 | public int getTimepointSize(); |
|---|
| 67 | |
|---|
| 68 | public int getTotalSize(); |
|---|
| 69 | |
|---|
| 70 | public long getRowOffset(int y, int z, int c, int t); |
|---|
| 71 | |
|---|
| 72 | public long getPlaneOffset(int z, int c, int t); |
|---|
| 73 | |
|---|
| 74 | public long getStackOffset(int c, int t); |
|---|
| 75 | |
|---|
| 76 | public long getTimepointOffset(int t); |
|---|
| 77 | |
|---|
| 78 | public byte[] getRegion(int size, long offset); |
|---|
| 79 | |
|---|
| 80 | public byte[] getRow(int y, int z, int c, int t); |
|---|
| 81 | |
|---|
| 82 | public byte[] getCol(int x, int z, int c, int t); |
|---|
| 83 | |
|---|
| 84 | public byte[] getPlaneRegion(int z, int c, int t, int count, int offset); |
|---|
| 85 | |
|---|
| 86 | public byte[] getPlane(int z, int c, int t); |
|---|
| 87 | |
|---|
| 88 | public byte[] getStack(int c, int t); |
|---|
| 89 | |
|---|
| 90 | public byte[] getTimepoint(int t); |
|---|
| 91 | |
|---|
| 92 | public void setRegion(int size, long offset, byte[] buffer); |
|---|
| 93 | |
|---|
| 94 | public void setRow(byte[] buffer, int y, int z, int c, int t); |
|---|
| 95 | |
|---|
| 96 | public void setPlane(byte[] buffer, int z, int c, int t); |
|---|
| 97 | |
|---|
| 98 | public void setStack(byte[] buffer, int z, int c, int t); |
|---|
| 99 | |
|---|
| 100 | public void setTimepoint(byte[] buffer, int t); |
|---|
| 101 | |
|---|
| 102 | public int getByteWidth(); |
|---|
| 103 | |
|---|
| 104 | public boolean isSigned(); |
|---|
| 105 | |
|---|
| 106 | public boolean isFloat(); |
|---|
| 107 | |
|---|
| 108 | public byte[] calculateMessageDigest(); |
|---|
| 109 | |
|---|
| 110 | } |
|---|