Package gov.nih.mipav.model.file
Class MetadataExtractor.TiffReader
- java.lang.Object
-
- gov.nih.mipav.model.file.MetadataExtractor.TiffReader
-
- Enclosing class:
- MetadataExtractor
public class MetadataExtractor.TiffReader extends java.lang.ObjectProcesses TIFF-formatted data, calling into client code via thatMetadataExtractor.TiffHandlerinterface.- Author:
- Drew Noakes https://drewnoakes.com
-
-
Constructor Summary
Constructors Constructor Description TiffReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private intcalculateTagOffset(int ifdStartOffset, int entryNumber)Determine the offset of a given tag within the specified IFD.voidprocessIfd(MetadataExtractor.TiffHandler handler, MetadataExtractor.RandomAccessReader reader, java.util.Set<java.lang.Integer> processedIfdOffsets, int ifdOffset, int tiffHeaderOffset)Processes a TIFF IFD.private voidprocessTag(MetadataExtractor.TiffHandler handler, int tagId, int tagValueOffset, int componentCount, int formatCode, MetadataExtractor.RandomAccessReader reader)voidprocessTiff(MetadataExtractor.RandomAccessReader reader, MetadataExtractor.TiffHandler handler, int tiffHeaderOffset)Processes a TIFF data sequence.
-
-
-
Method Detail
-
processTiff
public void processTiff(MetadataExtractor.RandomAccessReader reader, MetadataExtractor.TiffHandler handler, int tiffHeaderOffset) throws MetadataExtractor.TiffProcessingException, java.io.IOException
Processes a TIFF data sequence.- Parameters:
reader- theMetadataExtractor.RandomAccessReaderfrom which the data should be readhandler- theMetadataExtractor.TiffHandlerthat will coordinate processing and accept read valuestiffHeaderOffset- the offset withinreaderat which the TIFF header starts- Throws:
MetadataExtractor.TiffProcessingException- if an error occurred during the processing of TIFF data that could not be ignored or recovered fromjava.io.IOException- an error occurred while accessing the required data
-
processIfd
public void processIfd(MetadataExtractor.TiffHandler handler, MetadataExtractor.RandomAccessReader reader, java.util.Set<java.lang.Integer> processedIfdOffsets, int ifdOffset, int tiffHeaderOffset) throws java.io.IOException
Processes a TIFF IFD. IFD Header:- 2 bytes number of tags
- 2 bytes tag type
- 2 bytes format code (values 1 to 12, inclusive)
- 4 bytes component count
- 4 bytes inline value, or offset pointer if too large to fit in four bytes
- Parameters:
handler- thecom.drew.imaging.tiff.TiffHandlerthat will coordinate processing and accept read valuesreader- thecom.drew.lang.RandomAccessReaderfrom which the data should be readprocessedIfdOffsets- the set of visited IFD offsets, to avoid revisiting the same IFD in an endless loopifdOffset- the offset withinreaderat which the IFD data startstiffHeaderOffset- the offset withinreaderat which the TIFF header starts- Throws:
java.io.IOException- an error occurred while accessing the required data
-
processTag
private void processTag(MetadataExtractor.TiffHandler handler, int tagId, int tagValueOffset, int componentCount, int formatCode, MetadataExtractor.RandomAccessReader reader) throws java.io.IOException
- Throws:
java.io.IOException
-
calculateTagOffset
private int calculateTagOffset(int ifdStartOffset, int entryNumber)Determine the offset of a given tag within the specified IFD.- Parameters:
ifdStartOffset- the offset at which the IFD startsentryNumber- the zero-based entry number
-
-