public class CodestreamManipulator extends Object
Modifier and Type | Field and Description |
---|---|
private File |
file
The name of the outfile
|
private byte[] |
mainHeader
The main header
|
private static int |
MAX_TPSOT
The maximum number of a tile part index (TPsot)
|
private int |
maxtp
The maximum number of tile parts in any tile
|
private int |
nt
The number of tiles in the image
|
private byte[][][] |
packetData
Buffers containing the packet data
|
private byte[][][] |
packetHeaders
Buffers contaning the packet headers
|
private Integer[] |
positions
The positions of the SOT, SOP and EPH markers
|
private boolean |
ppmUsed
Flag indicating whether packed packet headers in main header is used
|
private int[] |
ppt
The number of packets per tile
|
private int |
pptp
The number of packets per tile-part
|
private boolean |
pptUsed
Flag indicating whether packed packet headers in tile headers is used
|
private byte[][][] |
sopMarkSeg
Buffers containing the SOP marker segments
|
private boolean |
tempEph
Flag indicating whether EPH marker was only intended for parsing in
This class and should be removed
|
private boolean |
tempSop
Flag indicating whether SOP marker was only intended for parsing in
This class and should be removed
|
private byte[][] |
tileHeaders
Buffers containing the original tile headers
|
private byte[][][] |
tileParts
Buffers containing the tile parts
|
private static int |
TP_HEAD_LEN
The length of a SOT plus a SOD marker
|
Constructor and Description |
---|
CodestreamManipulator(File file,
int nt,
int pptp,
boolean ppm,
boolean ppt,
boolean tempSop,
boolean tempEph)
Instantiates a codestream manipulator..
|
Modifier and Type | Method and Description |
---|---|
private void |
createTileParts()
This method creates the tileparts from the buffered tile headers,
packet headers and packet data
|
int |
doCodestreamManipulation()
This method performs the actual manipulation of the codestream which is
the reparsing for tile parts and packed packet headers
|
private void |
parseAndFind(BufferedRandomAccessFile fi)
This method parses the codestream for SOT, SOP and EPH markers and
removes header header bits signalling SOP and EPH markers if packed
packet headers are used
|
private void |
readAndBuffer(BufferedRandomAccessFile fi)
This method reads and buffers the tile headers, packet headers and
packet data.
|
private void |
writeNewCodestream(BufferedRandomAccessFile fi)
This method writes the new codestream to the file.
|
private boolean ppmUsed
private boolean pptUsed
private boolean tempSop
private boolean tempEph
private int nt
private int pptp
private File file
private static int TP_HEAD_LEN
private static int MAX_TPSOT
private int maxtp
private int[] ppt
private Integer[] positions
private byte[] mainHeader
private byte[][][] tileParts
private byte[][] tileHeaders
private byte[][][] packetHeaders
private byte[][][] packetData
private byte[][][] sopMarkSeg
public CodestreamManipulator(File file, int nt, int pptp, boolean ppm, boolean ppt, boolean tempSop, boolean tempEph)
file
- The name of the original outfilent
- The number of tiles in the imagepptp
- Packets per tile-part. If zero, no division into tileparts
is performedppm
- Flag indicating that PPM marker is usedppt
- Flag indicating that PPT marker is usedtempSop
- Flag indicating whether SOP merker should be removedtempEph
- Flag indicating whether EPH merker should be removedpublic int doCodestreamManipulation() throws IOException
IOException
- If an I/O error ocurred.private void parseAndFind(BufferedRandomAccessFile fi) throws IOException
fi
- The file to parse the markers fromIOException
- If an I/O error ocurred.private void readAndBuffer(BufferedRandomAccessFile fi) throws IOException
fi
- The file to read the headers and data fromIOException
- If an I/O error ocurred.private void createTileParts() throws IOException
IOException
- If an I/O error ocurred.private void writeNewCodestream(BufferedRandomAccessFile fi) throws IOException
fi
- The file to write the new codestream toIOException
- If an I/O error ocurred.Copyright © 2017 Open Microscopy Environment