Search in sources :

Example 6 with Box

use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.

the class FileFormatReader method readImageHeaderBox.

/**
 * This method reads the Image Header box
 * @param length The length of the JP2Header box
 *
 * @return false if the JP2Header box was not found or invalid else true
 *
 * @exception java.io.IOException If an I/O error ocurred.
 *
 * @exception java.io.EOFException If the end of file was reached
 */
public boolean readImageHeaderBox(int length) throws IOException, EOFException {
    if (// This can not be last box
    length == 0)
        throw new Error("Zero-length of JP2Header Box");
    // Here the JP2Header data (DBox) would be read if we were to use it
    height = in.readInt();
    width = in.readInt();
    numComp = in.readShort();
    bitDepth = in.readByte();
    compressionType = in.readByte();
    unknownColor = in.readByte();
    intelProp = in.readByte();
    if (metadata != null) {
        metadata.addNode(new HeaderBox(height, width, numComp, bitDepth, compressionType, unknownColor, intelProp));
    }
    return true;
}
Also used : HeaderBox(com.sun.media.imageioimpl.plugins.jpeg2000.HeaderBox)

Example 7 with Box

use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.

the class FileFormatReader method readURLBox.

/**
 * This method reads the contents of the XML box
 */
public void readURLBox(int length) throws IOException {
    if (metadata != null) {
        byte[] data = new byte[length];
        in.readFully(data, 0, length);
        metadata.addNode(new DataEntryURLBox(data));
    }
}
Also used : DataEntryURLBox(com.sun.media.imageioimpl.plugins.jpeg2000.DataEntryURLBox)

Example 8 with Box

use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.

the class FileFormatReader method readUUIDListBox.

/**
 * This method reads the contents of the UUID List box
 */
public void readUUIDListBox(int length) throws IOException {
    if (metadata != null) {
        byte[] data = new byte[length];
        in.readFully(data, 0, length);
        metadata.addNode(new UUIDListBox(data));
    }
}
Also used : UUIDListBox(com.sun.media.imageioimpl.plugins.jpeg2000.UUIDListBox)

Example 9 with Box

use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.

the class FileFormatReader method readIntPropertyBox.

/**
 * This method reads the contents of the Intellectual property box
 */
public void readIntPropertyBox(int length) throws IOException {
    if (metadata != null) {
        byte[] data = new byte[length];
        in.readFully(data, 0, length);
        metadata.addNode(new Box(length + 8, 0x6A703269, data));
    }
}
Also used : ResolutionBox(com.sun.media.imageioimpl.plugins.jpeg2000.ResolutionBox) ColorSpecificationBox(com.sun.media.imageioimpl.plugins.jpeg2000.ColorSpecificationBox) XMLBox(com.sun.media.imageioimpl.plugins.jpeg2000.XMLBox) UUIDBox(com.sun.media.imageioimpl.plugins.jpeg2000.UUIDBox) SignatureBox(com.sun.media.imageioimpl.plugins.jpeg2000.SignatureBox) HeaderBox(com.sun.media.imageioimpl.plugins.jpeg2000.HeaderBox) ComponentMappingBox(com.sun.media.imageioimpl.plugins.jpeg2000.ComponentMappingBox) BitsPerComponentBox(com.sun.media.imageioimpl.plugins.jpeg2000.BitsPerComponentBox) PaletteBox(com.sun.media.imageioimpl.plugins.jpeg2000.PaletteBox) ChannelDefinitionBox(com.sun.media.imageioimpl.plugins.jpeg2000.ChannelDefinitionBox) Box(com.sun.media.imageioimpl.plugins.jpeg2000.Box) DataEntryURLBox(com.sun.media.imageioimpl.plugins.jpeg2000.DataEntryURLBox) UUIDListBox(com.sun.media.imageioimpl.plugins.jpeg2000.UUIDListBox) FileTypeBox(com.sun.media.imageioimpl.plugins.jpeg2000.FileTypeBox)

Example 10 with Box

use of com.sun.media.imageioimpl.plugins.jpeg2000.Box in project bioformats by openmicroscopy.

the class FileFormatWriter method writeBox.

private void writeBox(IIOMetadataNode node) throws IOException {
    int type = Box.getTypeInt((String) Box.getAttribute(node, "Type"));
    int length = new Integer((String) Box.getAttribute(node, "Length")).intValue();
    Box box = Box.createBox(type, node);
    otherLength += length;
    stream.writeInt(length);
    stream.writeInt(type);
    byte[] data = box.getContent();
    stream.write(data, 0, data.length);
}
Also used : Box(com.sun.media.imageioimpl.plugins.jpeg2000.Box)

Aggregations

Box (com.sun.media.imageioimpl.plugins.jpeg2000.Box)6 ChannelDefinitionBox (com.sun.media.imageioimpl.plugins.jpeg2000.ChannelDefinitionBox)6 DataEntryURLBox (com.sun.media.imageioimpl.plugins.jpeg2000.DataEntryURLBox)6 HeaderBox (com.sun.media.imageioimpl.plugins.jpeg2000.HeaderBox)6 PaletteBox (com.sun.media.imageioimpl.plugins.jpeg2000.PaletteBox)6 UUIDBox (com.sun.media.imageioimpl.plugins.jpeg2000.UUIDBox)6 UUIDListBox (com.sun.media.imageioimpl.plugins.jpeg2000.UUIDListBox)6 XMLBox (com.sun.media.imageioimpl.plugins.jpeg2000.XMLBox)6 BitsPerComponentBox (com.sun.media.imageioimpl.plugins.jpeg2000.BitsPerComponentBox)4 ColorSpecificationBox (com.sun.media.imageioimpl.plugins.jpeg2000.ColorSpecificationBox)4 ComponentMappingBox (com.sun.media.imageioimpl.plugins.jpeg2000.ComponentMappingBox)4 FileTypeBox (com.sun.media.imageioimpl.plugins.jpeg2000.FileTypeBox)4 ResolutionBox (com.sun.media.imageioimpl.plugins.jpeg2000.ResolutionBox)4 SignatureBox (com.sun.media.imageioimpl.plugins.jpeg2000.SignatureBox)4 RecordCoreArgumentException (com.apple.foundationdb.record.RecordCoreArgumentException)1 Box (com.geophile.z.spatialobject.d2.Box)1