public class BfPixelBuffer extends Object implements PixelBuffer, Serializable
PixelBuffer
implementation which uses Bio-Formats to
read pixels data directly from original files.Modifier and Type | Field and Description |
---|---|
protected IFormatReader |
bfReader |
protected String |
filePath |
protected AtomicReference<BfPixelsWrapper> |
reader |
Constructor and Description |
---|
BfPixelBuffer(String filePath,
IFormatReader bfReader)
We may want a constructor that takes the id of an imported file
or that takes a File object?
|
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateMessageDigest()
Calculates a SHA-1 message digest for the entire pixel buffer.
|
void |
checkBounds(Integer x,
Integer y,
Integer z,
Integer c,
Integer t)
Checks to ensure that no one particular axis has an offset out of bounds.
|
void |
close()
Closes the buffer, cleaning up file state.
|
int |
getByteWidth()
Returns the byte width for the pixel buffer.
|
PixelData |
getCol(Integer x,
Integer z,
Integer c,
Integer t)
Retrieves a particular column from this pixel buffer.
|
byte[] |
getColDirect(Integer x,
Integer z,
Integer c,
Integer t,
byte[] buffer)
Retrieves a particular column from this pixel buffer.
|
Integer |
getColSize()
Retrieves the in memory size of a column of pixels in this pixel buffer.
|
PixelData |
getHypercube(List<Integer> offset,
List<Integer> size,
List<Integer> step)
Retrieves a hypercube from this pixel buffer.
|
byte[] |
getHypercubeDirect(List<Integer> offset,
List<Integer> size,
List<Integer> step,
byte[] buffer)
Retrieves a hypercube from the given pixels directly.
|
Long |
getHypercubeSize(List<Integer> offset,
List<Integer> size,
List<Integer> step)
Retrieves a the size of a hypercube from this pixel buffer.
|
long |
getId()
Retrieves the identifier of this pixel buffer
|
String |
getPath()
Retrieves the full path to this pixel buffer on disk
|
PixelData |
getPlane(Integer z,
Integer c,
Integer t)
Retrieves a particular 2D image plane from this pixel buffer.
|
byte[] |
getPlaneDirect(Integer z,
Integer c,
Integer t,
byte[] buffer)
Retrieves a particular 2D image plane from this pixel buffer.
|
Long |
getPlaneOffset(Integer z,
Integer c,
Integer t)
Retrieves the offset for a particular 2D image plane in this pixel
buffer.
|
PixelData |
getPlaneRegion(Integer x,
Integer y,
Integer width,
Integer height,
Integer z,
Integer c,
Integer t,
Integer stride)
Retrieves a particular region of a 2D image plane from this pixel buffer.
|
byte[] |
getPlaneRegionDirect(Integer z,
Integer c,
Integer t,
Integer count,
Integer offset,
byte[] buffer)
Retrieves a region from a given plane directly.
|
Long |
getPlaneSize()
Retrieves the in memory size of a 2D image plane in this pixel buffer.
|
PixelData |
getRegion(Integer size,
Long offset)
Retrieves a region from this pixel buffer.
|
byte[] |
getRegionDirect(Integer size,
Long offset,
byte[] buffer)
Retrieves a region from this pixel buffer directly.
|
List<List<Integer>> |
getResolutionDescriptions()
Return a list of lists each of which has sizeX, sizeY for the resolution
level matching the index of the outer index.
|
int |
getResolutionLevel()
Retrieves the active resolution level.
|
int |
getResolutionLevels()
Retrieves the number of resolution levels that the backing
pixels pyramid contains.
|
PixelData |
getRow(Integer y,
Integer z,
Integer c,
Integer t)
Retrieves a particular row or scanline from this pixel buffer.
|
byte[] |
getRowDirect(Integer y,
Integer z,
Integer c,
Integer t,
byte[] buffer)
Retrieves a particular row or scanline from this pixel buffer.
|
Long |
getRowOffset(Integer y,
Integer z,
Integer c,
Integer t)
Retrieves the offset for a particular row or scanline in this pixel
buffer.
|
Integer |
getRowSize()
Retrieves the in memory size of a row or scanline of pixels in this
pixel buffer.
|
int |
getSeries()
Retrieves the current series of the underlying Bio-Formats reader.
|
int |
getSizeC()
Retrieves the size in C of this pixel buffer
|
int |
getSizeT()
Retrieves the size in T of this pixel buffer
|
int |
getSizeX()
Retrieves the size in X of this pixel buffer
|
int |
getSizeY()
Retrieves the size in Y of this pixel buffer
|
int |
getSizeZ()
Retrieves the size in Z of this pixel buffer
|
PixelData |
getStack(Integer c,
Integer t)
Retrieves the the entire number of optical sections for a single
wavelength or channel at a particular timepoint in this pixel buffer.
|
byte[] |
getStackDirect(Integer c,
Integer t,
byte[] buffer)
Retrieves the the entire number of optical sections for a single
wavelength or channel at a particular timepoint in this pixel buffer.
|
Long |
getStackOffset(Integer c,
Integer t)
Retrieves the offset for the entire number of optical sections
for a single wavelength or channel at a particular timepoint in
this pixel buffer.
|
Long |
getStackSize()
Retrieves the in memory size of the entire number of optical sections
for a single wavelength or channel at a particular timepoint in
this pixel buffer.
|
PixelData |
getTile(Integer z,
Integer c,
Integer t,
Integer x,
Integer y,
Integer w,
Integer h)
Retrieves a tile from this pixel buffer.
|
byte[] |
getTileDirect(Integer z,
Integer c,
Integer t,
Integer x,
Integer y,
Integer w,
Integer h,
byte[] buffer)
Retrieves a tile from this pixel buffer.
|
Dimension |
getTileSize()
Retrieves the tile size for the pixel store.
|
PixelData |
getTimepoint(Integer t)
Retrieves the entire number of optical sections for all
wavelengths or channels at a particular timepoint in this pixel buffer.
|
byte[] |
getTimepointDirect(Integer t,
byte[] buffer)
Retrieves the entire number of optical sections for all
wavelengths or channels at a particular timepoint in this pixel buffer.
|
Long |
getTimepointOffset(Integer t)
Retrieves the in memory size of the entire number of optical sections for
all wavelengths or channels at a particular timepoint in this
pixel buffer.
|
Long |
getTimepointSize()
Retrieves the in memory size of the entire number of optical sections for
all wavelengths or channels at a particular timepoint in this
pixel buffer.
|
Long |
getTotalSize()
Retrieves the in memory size of the entire pixel buffer.
|
boolean |
isFloat()
Returns whether or not the pixel buffer has floating point pixels.
|
boolean |
isLittleEndian()
Delegates to
IFormatReader.isLittleEndian() . |
boolean |
isSigned()
Returns whether or not the pixel buffer has signed pixels.
|
protected BfPixelsWrapper |
reader() |
void |
setPlane(byte[] buffer,
Integer z,
Integer c,
Integer t)
Sets a particular 2D image plane in this pixel buffer.
|
void |
setPlane(ByteBuffer buffer,
Integer z,
Integer c,
Integer t)
Sets a particular 2D image plane in this pixel buffer.
|
void |
setRegion(Integer size,
Long offset,
byte[] buffer)
Sets a region in this pixel buffer.
|
void |
setRegion(Integer size,
Long offset,
ByteBuffer buffer)
Sets a region in this pixel buffer.
|
void |
setResolutionLevel(int resolutionLevel)
Sets the active resolution level.
|
void |
setRow(ByteBuffer buffer,
Integer y,
Integer z,
Integer c,
Integer t)
Sets a particular row or scanline in this pixel buffer.
|
void |
setSeries(int series)
Sets the current series in the underlying Bio-Formats reader.
|
void |
setStack(byte[] buffer,
Integer z,
Integer c,
Integer t)
Sets the entire number of optical sections for a single
wavelength or channel at a particular timepoint in this pixel buffer.
|
void |
setStack(ByteBuffer buffer,
Integer z,
Integer c,
Integer t)
Sets the entire number of optical sections for a single
wavelength or channel at a particular timepoint in this pixel buffer.
|
void |
setTile(byte[] buffer,
Integer z,
Integer c,
Integer t,
Integer x,
Integer y,
Integer w,
Integer h)
Sets a tile in this pixel buffer.
|
void |
setTimepoint(byte[] buffer,
Integer t)
Sets the entire number of optical sections for all
wavelengths or channels at a particular timepoint in this pixel buffer.
|
void |
setTimepoint(ByteBuffer buffer,
Integer t)
Sets the entire number of optical sections for all
wavelengths or channels at a particular timepoint in this pixel buffer.
|
protected final String filePath
protected final IFormatReader bfReader
protected final AtomicReference<BfPixelsWrapper> reader
public BfPixelBuffer(String filePath, IFormatReader bfReader) throws IOException, FormatException
IOException
FormatException
protected BfPixelsWrapper reader()
public boolean isLittleEndian()
IFormatReader.isLittleEndian()
.public void setSeries(int series)
series
- The series to set.public int getSeries()
public byte[] calculateMessageDigest() throws IOException
PixelBuffer
calculateMessageDigest
in interface PixelBuffer
IOException
- if there is a problem reading from the pixel buffer.public void checkBounds(Integer x, Integer y, Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException
PixelBuffer
null
may be passed as the argument to any one of the offsets
to ignore it for the purposes of bounds checking.checkBounds
in interface PixelBuffer
x
- offset across the X-axis of the pixel buffer to check.y
- offset across the Y-axis of the pixel buffer to check.z
- offset across the Z-axis of the pixel buffer to check.c
- offset across the C-axis of the pixel buffer to check.t
- offset across the T-axis of the pixel buffer to check.DimensionsOutOfBoundsException
- if y
,
z
, c
or t
is out of bounds.public void close() throws IOException
PixelBuffer
close
in interface Closeable
close
in interface AutoCloseable
close
in interface PixelBuffer
IOException
- if an I/O error occurs.public int getByteWidth()
PixelBuffer
getByteWidth
in interface PixelBuffer
public PixelData getCol(Integer x, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getCol
in interface PixelBuffer
x
- offset across the X-axis of the pixel buffer.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.order
set
correctly but not that the backing buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.PixelBuffer.getColDirect(Integer, Integer, Integer, Integer, byte[])
public byte[] getColDirect(Integer x, Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getColDirect
in interface PixelBuffer
x
- offset across the X-axis of the pixel buffer.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.buffer
- pre-allocated buffer of the row's size.buffer
containing the data which comprises this
column. It is guaranteed that this buffer will have been byte swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.PixelBuffer.getCol(Integer, Integer, Integer, Integer)
public Integer getColSize()
PixelBuffer
getColSize
in interface PixelBuffer
public long getId()
PixelBuffer
getId
in interface PixelBuffer
public String getPath()
PixelBuffer
getPath
in interface PixelBuffer
public PixelData getPlane(Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getPlane
in interface PixelBuffer
z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.order
set
correctly but not that the backing buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public byte[] getPlaneDirect(Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getPlaneDirect
in interface PixelBuffer
z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.buffer
- pre-allocated buffer of the plane's size.buffer
containing the data which comprises this 2D
image plane. It is guaranteed that this buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public Long getPlaneOffset(Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException
PixelBuffer
getPlaneOffset
in interface PixelBuffer
z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public byte[] getPlaneRegionDirect(Integer z, Integer c, Integer t, Integer count, Integer offset, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getPlaneRegionDirect
in interface PixelBuffer
z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.count
- the number of pixels to retrieve.offset
- the offset at which to retrieve count
pixels.buffer
- pre-allocated buffer, count
in size.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
PixelBuffer.getRegionDirect(Integer, Long, byte[])
public Long getPlaneSize()
PixelBuffer
getPlaneSize
in interface PixelBuffer
public PixelData getRegion(Integer size, Long offset) throws IOException
PixelBuffer
getRegion
in interface PixelBuffer
size
- byte width of the region to retrieve.offset
- offset within the pixel buffer.order
set correctly but not that the
backing buffer will have been byte swapped. The buffer is essentially
directly from disk.IOException
- if there is a problem reading from the pixel buffer.PixelBuffer.getRegionDirect(Integer, Long, byte[])
public byte[] getRegionDirect(Integer size, Long offset, byte[] buffer) throws IOException
PixelBuffer
getRegionDirect
in interface PixelBuffer
size
- byte width of the region to retrieve.offset
- offset within the pixel buffer.buffer
- pre-allocated buffer of the row's size.buffer
containing the data which comprises this
region. It is guaranteed that this buffer will have been byte
swapped. The buffer is essentially directly from disk.IOException
- if there is a problem reading from the pixel buffer.PixelBuffer.getRegion(Integer, Long)
public PixelData getRow(Integer y, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getRow
in interface PixelBuffer
y
- offset across the Y-axis of the pixel buffer.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.order
set
correctly but not that the backing buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.PixelBuffer.getRowDirect(Integer, Integer, Integer, Integer, byte[])
public byte[] getRowDirect(Integer y, Integer z, Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getRowDirect
in interface PixelBuffer
y
- offset across the Y-axis of the pixel buffer.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.buffer
- pre-allocated buffer of the row's size.buffer
containing the data which comprises this row
or scanline. It is guaranteed that this buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.PixelBuffer.getRow(Integer, Integer, Integer, Integer)
public Long getRowOffset(Integer y, Integer z, Integer c, Integer t) throws DimensionsOutOfBoundsException
PixelBuffer
getRowOffset
in interface PixelBuffer
y
- offset across the Y-axis of the pixel buffer.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public Integer getRowSize()
PixelBuffer
getRowSize
in interface PixelBuffer
public int getSizeC()
PixelBuffer
getSizeC
in interface PixelBuffer
public int getSizeT()
PixelBuffer
getSizeT
in interface PixelBuffer
public int getSizeX()
PixelBuffer
getSizeX
in interface PixelBuffer
public int getSizeY()
PixelBuffer
getSizeY
in interface PixelBuffer
public int getSizeZ()
PixelBuffer
getSizeZ
in interface PixelBuffer
public PixelData getStack(Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getStack
in interface PixelBuffer
c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.order
set
correctly but not that the backing buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public byte[] getStackDirect(Integer c, Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getStackDirect
in interface PixelBuffer
c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.buffer
- pre-allocated buffer of the stack's size.buffer
containing the data which comprises this
stack. It is guaranteed that this buffer will have been byte swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public Long getStackOffset(Integer c, Integer t) throws DimensionsOutOfBoundsException
PixelBuffer
getStackOffset
in interface PixelBuffer
c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public Long getStackSize()
PixelBuffer
getStackSize
in interface PixelBuffer
public PixelData getTimepoint(Integer t) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getTimepoint
in interface PixelBuffer
t
- offset across the T-axis of the pixel buffer.order
set
correctly but not that the backing buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public byte[] getTimepointDirect(Integer t, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getTimepointDirect
in interface PixelBuffer
t
- offset across the T-axis of the pixel buffer.buffer
- pre-allocated buffer of the timepoint's size.buffer
containing the data which comprises this
timepoint. It is guaranteed that this buffer will have been byte swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public Long getTimepointOffset(Integer t) throws DimensionsOutOfBoundsException
PixelBuffer
getTimepointOffset
in interface PixelBuffer
t
- offset across the T-axis of the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public Long getTimepointSize()
PixelBuffer
getTimepointSize
in interface PixelBuffer
public Long getTotalSize()
PixelBuffer
getTotalSize
in interface PixelBuffer
public boolean isFloat()
PixelBuffer
isFloat
in interface PixelBuffer
true
if the pixel buffer as floating point,
false
otherwisepublic boolean isSigned()
PixelBuffer
isSigned
in interface PixelBuffer
public void setPlane(ByteBuffer buffer, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setPlane
in interface PixelBuffer
buffer
- a byte array of the data comprising this 2D image plane.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem writing to the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getPlaneSize()
.public void setPlane(byte[] buffer, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setPlane
in interface PixelBuffer
buffer
- a byte buffer of the data comprising this 2D image plane.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem writing to the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getPlaneSize()
.public void setRegion(Integer size, Long offset, byte[] buffer) throws IOException, BufferOverflowException
PixelBuffer
setRegion
in interface PixelBuffer
size
- byte width of the region to set.offset
- offset within the pixel buffer.buffer
- a byte array of the data.IOException
- if there is a problem writing to the pixel buffer.BufferOverflowException
- if buffer.length > size
.public void setRegion(Integer size, Long offset, ByteBuffer buffer) throws IOException, BufferOverflowException
PixelBuffer
setRegion
in interface PixelBuffer
size
- byte width of the region to set.offset
- offset within the pixel buffer.buffer
- a byte buffer of the data.IOException
- if there is a problem writing to the pixel buffer.BufferOverflowException
- if buffer.length > size
.public void setRow(ByteBuffer buffer, Integer y, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setRow
in interface PixelBuffer
buffer
- a byte buffer of the data comprising this row or scanline.y
- offset across the Y-axis of the pixel buffer.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getRowSize()
.public void setStack(ByteBuffer buffer, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setStack
in interface PixelBuffer
buffer
- a byte buffer of the data comprising this stack.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem writing to the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getStackSize()
.public void setStack(byte[] buffer, Integer z, Integer c, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setStack
in interface PixelBuffer
buffer
- a byte array of the data comprising this stack.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem writing to the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getStackSize()()
.public void setTimepoint(ByteBuffer buffer, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setTimepoint
in interface PixelBuffer
buffer
- a byte buffer of the data comprising this timepoint.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem writing to the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getTimepointSize()
.public void setTimepoint(byte[] buffer, Integer t) throws IOException, DimensionsOutOfBoundsException, BufferOverflowException
PixelBuffer
setTimepoint
in interface PixelBuffer
buffer
- a byte array of the data comprising this timepoint.t
- offset across the T-axis of the pixel buffer.IOException
- if there is a problem writing to the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.BufferOverflowException
- if
buffer.length > PixelBuffer.getTimepointSize()
.public Long getHypercubeSize(List<Integer> offset, List<Integer> size, List<Integer> step) throws DimensionsOutOfBoundsException
PixelBuffer
getHypercubeSize
in interface PixelBuffer
offset
- The offset of each dimension of the pixel buffer.size
- The number of pixels to retrieve along each dimension .step
- The step size across each dimension .DimensionsOutOfBoundsException
public PixelData getHypercube(List<Integer> offset, List<Integer> size, List<Integer> step) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getHypercube
in interface PixelBuffer
offset
- The offset of each dimension of the pixel buffer.size
- The number of pixels to retrieve along each dimension .step
- The step size across each dimension .IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
public byte[] getHypercubeDirect(List<Integer> offset, List<Integer> size, List<Integer> step, byte[] buffer) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getHypercubeDirect
in interface PixelBuffer
offset
- The offset of each dimension of the pixel buffer.size
- The number of pixels to retrieve along each dimension .step
- The step size across each dimension .buffer
- pre-allocated buffer, count
in size.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
public PixelData getPlaneRegion(Integer x, Integer y, Integer width, Integer height, Integer z, Integer c, Integer t, Integer stride) throws IOException, DimensionsOutOfBoundsException
PixelBuffer
getPlaneRegion
in interface PixelBuffer
x
- offset across the X-axis of the pixel buffer.y
- offset across the Y-axis of the pixel buffer.width
- The number of pixels to retrieve along the X-axis.height
- The number of pixels to retrieve along the Y-axis.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.stride
- The step size.order
set
correctly but not that the backing buffer will have been byte
swapped.IOException
- if there is a problem reading from the pixel buffer.DimensionsOutOfBoundsException
- if offsets are out of bounds
after checking with PixelBuffer.checkBounds(Integer, Integer, Integer, Integer, Integer)
.public PixelData getTile(Integer z, Integer c, Integer t, Integer x, Integer y, Integer w, Integer h) throws IOException
PixelBuffer
getTile
in interface PixelBuffer
z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.x
- Top left corner of the tile, X offset.y
- Top left corner of the tile, Y offset.w
- Width of the tile.h
- Height of the tile.IOException
- if there is a problem reading from the pixel buffer.PixelBuffer.getTileDirect(Integer, Integer, Integer, Integer, Integer, Integer, Integer, byte[])
public byte[] getTileDirect(Integer z, Integer c, Integer t, Integer x, Integer y, Integer w, Integer h, byte[] buffer) throws IOException
PixelBuffer
getTileDirect
in interface PixelBuffer
z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.x
- Top left corner of the tile, X offset.y
- Top left corner of the tile, Y offset.w
- Width of the tile.h
- Height of the tile.buffer
- Pre-allocated buffer of the tile's size.buffer
containing the data which comprises this
region. It is guaranteed that this buffer will have been byte
swapped. The buffer is essentially directly from disk.IOException
- if there is a problem reading from the pixel buffer.PixelBuffer.getTile(Integer, Integer, Integer, Integer, Integer, Integer, Integer)
public void setTile(byte[] buffer, Integer z, Integer c, Integer t, Integer x, Integer y, Integer w, Integer h) throws IOException, BufferOverflowException
PixelBuffer
setTile
in interface PixelBuffer
buffer
- A byte array of the data.z
- offset across the Z-axis of the pixel buffer.c
- offset across the C-axis of the pixel buffer.t
- offset across the T-axis of the pixel buffer.x
- Top left corner of the tile, X offset.y
- Top left corner of the tile, Y offset.w
- Width of the tile.h
- Height of the tile.IOException
- if there is a problem writing to the pixel buffer.BufferOverflowException
- if an attempt is made to write off the
end of the file.public int getResolutionLevel()
PixelBuffer
getResolutionLevel
in interface PixelBuffer
public int getResolutionLevels()
PixelBuffer
getResolutionLevels
in interface PixelBuffer
public Dimension getTileSize()
PixelBuffer
getTileSize
in interface PixelBuffer
null
if the pixel
buffer is not tiled.public List<List<Integer>> getResolutionDescriptions()
PixelBuffer
getResolutionDescriptions
in interface PixelBuffer
public void setResolutionLevel(int resolutionLevel)
PixelBuffer
setResolutionLevel
in interface PixelBuffer
resolutionLevel
- The resolution level to be used by
the pixel buffer.
Version: 5.2.8-ice35-b57
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.