public class CodestreamManipulator extends Object
| Modifier and Type | Field and Description | 
|---|---|
| private File | fileThe name of the outfile | 
| private byte[] | mainHeaderThe main header | 
| private static int | MAX_TPSOTThe maximum number of a tile part index (TPsot) | 
| private int | maxtpThe maximum number of tile parts in any tile | 
| private int | ntThe number of tiles in the image | 
| private byte[][][] | packetDataBuffers containing the packet data | 
| private byte[][][] | packetHeadersBuffers contaning the packet headers | 
| private Integer[] | positionsThe positions of the SOT, SOP and EPH markers | 
| private boolean | ppmUsedFlag indicating whether packed packet headers in main header is used | 
| private int[] | pptThe number of packets per tile | 
| private int | pptpThe number of packets per tile-part | 
| private boolean | pptUsedFlag indicating whether packed packet headers in tile headers is used | 
| private byte[][][] | sopMarkSegBuffers containing the SOP marker segments | 
| private boolean | tempEphFlag indicating whether EPH marker was only intended for parsing in
 This class and should be removed | 
| private boolean | tempSopFlag indicating whether SOP marker was only intended for parsing in
 This class and should be removed | 
| private byte[][] | tileHeadersBuffers containing the original tile headers | 
| private byte[][][] | tilePartsBuffers containing the tile parts | 
| private static int | TP_HEAD_LENThe 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 © 2016 Open Microscopy Environment