Package loci.formats.in
Class PictReader
java.lang.Object
loci.formats.FormatHandler
loci.formats.FormatReader
loci.formats.in.PictReader
- All Implemented Interfaces:
Closeable,AutoCloseable,ICompressedTileReader,IFormatHandler,IFormatReader,IMetadataConfigurable,IPyramidHandler
PictReader is the file format reader for Apple PICT files.
Most of this code was adapted from the PICT readers in JIMI
(http://java.sun.com/products/jimi/index.html), ImageMagick
(http://www.imagemagick.org), and Java QuickDraw.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final byte[]Table used in expanding pixels that use less than 8 bits.protected byte[][]Color lookup table for palette color images.private static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprotected intNumber of bytes in a row of pixel data (variable).protected VectorVector of byte arrays representing individual rows.protected booleanWhether or not the file is PICT v1.Fields inherited from class loci.formats.FormatReader
core, coreIndex, datasetDescription, domains, fillColor, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSIONFields inherited from class loci.formats.FormatHandler
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixesFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean fileOnly) Closes the currently open file.private booleandrivePictDecoder(int opcode) Handles the opcodes in the PICT file.private voidexpandPixels(int bitSize, byte[] ib, byte[] ob, int outLen) Expand an array of bytes.byte[][]Gets the 8-bit color lookup table associated with the most recently opened image.private voidhandleBitmap(int opcode) Extract the image data in a PICT bitmap structure.private voidhandlePixmap(int opcode) Extracts the image data in a PICT pixmap structure.private voidhandlePixmap(int pixelSize, int compCount) Handles the unpacking of the image data.protected voidInitializes the given file (parsing header information, etc.).byte[]openBytes(int no, byte[] buf, int x, int y, int w, int h) Obtains a sub-image of the specified image plane into a pre-allocated byte array.private voidreadImageHeader(int opcode) private voidunpackBits(byte[] ib, int[] ob) PackBits variant that outputs an int array.Methods inherited from class loci.formats.FormatReader
addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMetaList, addMeta, addMetaList, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMetaList, close, coreIndexToSeries, fileGroupOption, flattenHashtables, get16BitLookupTable, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getAvailableOptions, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, getCurrentCore, getCurrentFile, getDatasetStructureDescription, getDetectorType, getDimensionOrder, getDimensionOrder, getDomains, getEffectiveSizeC, getExperimentType, getFilamentType, getFillColor, getFillRule, getFilterType, getFontFamily, getFontStyle, getGlobalMeta, getGlobalMetadata, getIlluminationType, getImageCount, getImmersion, getIndex, getIndex, getLaserMedium, getLaserType, getMarker, getMedium, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getMicrobeamManipulationType, getMicroscopeType, getModuloC, getModuloT, getModuloZ, getNamingConvention, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPixelType, getPossibleDomains, getPulse, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getRotationTransform, getSeries, getSeriesCount, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getThumbSizeX, getThumbSizeY, getTileColumns, getTileRows, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, readPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataListsMethods inherited from class loci.formats.FormatHandler
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptionsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface loci.formats.ICompressedTileReader
getTileCodec, getTileCodecOptions, openCompressedBytes, openCompressedBytesMethods inherited from interface loci.formats.IFormatHandler
getFormat, getNativeDataType, getSuffixesMethods inherited from interface loci.formats.IMetadataConfigurable
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
-
Field Details
-
PICT_CLIP_RGN
private static final int PICT_CLIP_RGN- See Also:
-
PICT_BITSRECT
private static final int PICT_BITSRECT- See Also:
-
PICT_BITSRGN
private static final int PICT_BITSRGN- See Also:
-
PICT_PACKBITSRECT
private static final int PICT_PACKBITSRECT- See Also:
-
PICT_PACKBITSRGN
private static final int PICT_PACKBITSRGN- See Also:
-
PICT_9A
private static final int PICT_9A- See Also:
-
PICT_END
private static final int PICT_END- See Also:
-
PICT_LONGCOMMENT
private static final int PICT_LONGCOMMENT- See Also:
-
PICT_JPEG
private static final int PICT_JPEG- See Also:
-
PICT_TYPE_1
private static final int PICT_TYPE_1- See Also:
-
PICT_TYPE_2
private static final int PICT_TYPE_2- See Also:
-
EXPANSION_TABLE
private static final byte[] EXPANSION_TABLETable used in expanding pixels that use less than 8 bits. -
rowBytes
protected int rowBytesNumber of bytes in a row of pixel data (variable). -
strips
Vector of byte arrays representing individual rows. -
versionOne
protected boolean versionOneWhether or not the file is PICT v1. -
lookup
protected byte[][] lookupColor lookup table for palette color images. -
jpegOffsets
-
-
Constructor Details
-
PictReader
public PictReader()Constructs a new PICT reader.
-
-
Method Details
-
get8BitLookupTable
Description copied from interface:IFormatReaderGets the 8-bit color lookup table associated with the most recently opened image. If no image planes have been opened, or ifIFormatReader.isIndexed()returns false, then this may return null. Also, ifIFormatReader.getPixelType()returns anything other thanFormatTools.INT8orFormatTools.UINT8, this method will return null.- Specified by:
get8BitLookupTablein interfaceIFormatReader- Overrides:
get8BitLookupTablein classFormatReader- Throws:
FormatExceptionIOException
-
openBytes
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, IOException Description copied from interface:IFormatReaderObtains a sub-image of the specified image plane into a pre-allocated byte array.- Specified by:
openBytesin interfaceIFormatReader- Specified by:
openBytesin classFormatReader- Parameters:
no- the plane index within the current series.buf- a pre-allocated buffer.x- X coordinate of the upper-left corner of the sub-imagey- Y coordinate of the upper-left corner of the sub-imagew- width of the sub-imageh- height of the sub-image- Returns:
- the pre-allocated buffer
buffor convenience. - Throws:
FormatException- if there was a problem parsing the metadata of the file.IOException- if there was a problem reading the file.- See Also:
-
close
Description copied from interface:IFormatReaderCloses the currently open file. If the flag is set, this is all that happens; if unset, it is equivalent to callingCloseable.close().- Specified by:
closein interfaceIFormatReader- Overrides:
closein classFormatReader- Throws:
IOException
-
initFile
Description copied from class:FormatReaderInitializes the given file (parsing header information, etc.). Most subclasses should override this method to perform initialization operations such as parsing metadata.- Overrides:
initFilein classFormatReader- Throws:
FormatException- if a parsing error occurs processing the file.IOException- if an I/O error occurs processing the file
-
drivePictDecoder
Handles the opcodes in the PICT file.- Throws:
FormatExceptionIOException
-
readImageHeader
- Throws:
IOException
-
handleBitmap
Extract the image data in a PICT bitmap structure.- Throws:
FormatExceptionIOException
-
handlePixmap
Extracts the image data in a PICT pixmap structure.- Throws:
FormatExceptionIOException
-
handlePixmap
Handles the unpacking of the image data.- Throws:
FormatExceptionIOException
-
expandPixels
Expand an array of bytes.- Throws:
FormatException
-
unpackBits
private void unpackBits(byte[] ib, int[] ob) PackBits variant that outputs an int array.
-