Documentation
¶
Overview ¶
Package opentile provides utilities to read tiles from whole-slide imaging (WSI) TIFF files. See the repository README for a high-level overview.
Index ¶
- Constants
- Variables
- func CompressionToTIFFTag(c Compression) uint16
- func SetOpenAnyHook(...)
- func SpliceJPEGTile(prefix, body []byte) ([]byte, error)
- type AssociatedImage
- type Backing
- type Compression
- type Config
- type CorruptTilePolicy
- type DecodeOption
- type Format
- type Image
- type Level
- type Metadata
- type Option
- type Point
- type Region
- type Size
- type SizeMm
- type Slide
- func (s *Slide) Associated() []AssociatedImage
- func (s *Slide) BestLevelForDownsample(downsample float64) int
- func (s *Slide) Close() error
- func (s *Slide) DecodedTile(level, tx, ty int, opts ...DecodeOption) (*decoder.Image, error)
- func (s *Slide) DecodedTileInto(level, tx, ty int, dst *decoder.Image, opts ...DecodeOption) error
- func (s *Slide) Format() Format
- func (s *Slide) ICCProfile() []byte
- func (s *Slide) ImageBestLevelForDownsample(image int, downsample float64) int
- func (s *Slide) ImageDecodedTile(image, level, tx, ty int, opts ...DecodeOption) (*decoder.Image, error)
- func (s *Slide) ImageDecodedTileInto(image, level, tx, ty int, dst *decoder.Image, opts ...DecodeOption) error
- func (s *Slide) ImageRangeTiles(ctx context.Context, image, level int) iter.Seq2[TilePos, TileResult]
- func (s *Slide) ImageRawTile(image, level, tx, ty int) ([]byte, error)
- func (s *Slide) ImageRawTileInto(image, level, tx, ty int, dst []byte) (int, error)
- func (s *Slide) ImageReadRegion(image, level, x, y, w, h int, opts ...DecodeOption) (*decoder.Image, error)
- func (s *Slide) ImageReadRegionInto(image, level, x, y int, dst *decoder.Image, opts ...DecodeOption) error
- func (s *Slide) ImageReadRegionScaled(image int, l0x, l0y, l0w, l0h, outW, outH int, opts ...DecodeOption) (*decoder.Image, error)
- func (s *Slide) ImageReadRegionScaledInto(image int, l0x, l0y, l0w, l0h int, dst *decoder.Image, opts ...DecodeOption) error
- func (s *Slide) ImageTileBodyInto(image, level, tx, ty int, dst []byte) (int, error)
- func (s *Slide) ImageTileBodyMaxSize(image, level int) int
- func (s *Slide) ImageTileMaxSize(image, level int) int
- func (s *Slide) ImageTilePrefix(image, level int) []byte
- func (s *Slide) ImageTileReader(image, level, tx, ty int) (io.ReadCloser, error)
- func (s *Slide) ImageWarmLevel(image, level int) error
- func (s *Slide) Images() []Image
- func (s *Slide) Level(i int) (Level, error)
- func (s *Slide) Levels() []Level
- func (s *Slide) Metadata() Metadata
- func (s *Slide) RangeTiles(ctx context.Context, level int) iter.Seq2[TilePos, TileResult]
- func (s *Slide) RawTile(level, tx, ty int) ([]byte, error)
- func (s *Slide) RawTileInto(level, tx, ty int, dst []byte) (int, error)
- func (s *Slide) ReadRegion(level, x, y, w, h int, opts ...DecodeOption) (*decoder.Image, error)
- func (s *Slide) ReadRegionInto(level, x, y int, dst *decoder.Image, opts ...DecodeOption) error
- func (s *Slide) ReadRegionScaled(l0x, l0y, l0w, l0h, outW, outH int, opts ...DecodeOption) (*decoder.Image, error)
- func (s *Slide) ReadRegionScaledInto(l0x, l0y, l0w, l0h int, dst *decoder.Image, opts ...DecodeOption) error
- func (s *Slide) ScaledStrips(l0Rect image.Rectangle, outSize image.Point, stripHeight int, ...) *StripIterator
- func (s *Slide) TileBodyInto(level, tx, ty int, dst []byte) (int, error)
- func (s *Slide) TileBodyMaxSize(level int) int
- func (s *Slide) TileMaxSize(level int) int
- func (s *Slide) TilePrefix(level int) []byte
- func (s *Slide) TileReader(level, tx, ty int) (io.ReadCloser, error)
- func (s *Slide) UnwrapReader() any
- func (s *Slide) WarmLevel(i int) error
- type StripIterator
- type StripOption
- type TileCoord
- type TileError
- type TilePos
- type TileResult
Constants ¶
const ( // PropertyCaseNumber is the clinical / specimen case identifier. PropertyCaseNumber = "case-number" // PropertyUserName is the scan operator / user name. PropertyUserName = "user-name" // PropertyScannedAreaMM2 is the physical scanned area in mm² // (string-formatted float; parse via strconv.ParseFloat). PropertyScannedAreaMM2 = "scanned-area-mm2" // PropertyScanDurationSec is the wall-clock scan duration in // seconds (string-formatted float; parse via strconv.ParseFloat). PropertyScanDurationSec = "scan-duration-seconds" // PropertyComments is free-text user comments (distinct from // ImageDescription, which is the structured per-format description). PropertyComments = "comments" )
PropertyXxx are the canonical opentile-go cross-format keys for Metadata.Properties. Format readers use these constants to populate well-known cross-format fields that don't have typed struct positions.
Added in v0.17.
Variables ¶
var ( ErrUnsupportedFormat = errors.New("opentile: unsupported format") ErrUnsupportedCompression = errors.New("opentile: unsupported compression") ErrTileOutOfBounds = errors.New("opentile: tile position out of bounds") ErrCorruptTile = errors.New("opentile: corrupt tile") ErrLevelOutOfRange = errors.New("opentile: level index out of range") ErrImageIndexOutOfRange = errors.New("opentile: image index out of range") ErrInvalidTIFF = errors.New("opentile: invalid TIFF structure") // ErrTooManyIFDs is returned when a TIFF IFD chain exceeds the safety cap // (1024 IFDs) before terminating. Either the file is corrupt, presents a // cycle, or is malicious. Re-exports internal/tiff.ErrTooManyIFDs so // callers can errors.Is(err, opentile.ErrTooManyIFDs). ErrTooManyIFDs = tiff.ErrTooManyIFDs // Returned (wrapped in TileError) when internal/jpeg cannot parse a JPEG // bitstream or assemble a valid one from TIFF fragments. ErrBadJPEGBitstream = errors.New("opentile: invalid JPEG bitstream") // Returned when an operation requires an MCU-aligned region and the // computed or requested region is not. Primarily an internal invariant // guard; consumers encounter it only on malformed slides. ErrMCUAlignment = errors.New("opentile: operation requires MCU alignment") // Returned from NDPI one-frame levels and NDPI label on builds compiled // without cgo (CGO_ENABLED=0 or -tags nocgo). ErrCGORequired = errors.New("opentile: operation requires cgo build with libjpeg-turbo") // Reserved for future use; currently unfired because v0.2 defaults the // NDPI tile size to 512 rather than erroring. Predefined so exporting // it later is not a breaking change. ErrTileSizeRequired = errors.New("opentile: tile size not representable for this format") // caller asks for a non-zero Z, C, or T axis on a TileCoord but the // underlying Image's SizeZ/SizeC/SizeT is 1 (the format / slide // doesn't carry that dimension at all). Distinct from // ErrTileOutOfBounds: that error means "this axis exists but the // requested index is past its size"; this means "the axis itself // doesn't exist on this slide / format / milestone." // // Added in v0.7 alongside Level.TileAt and the multi-dim Image // dimension accessors. ErrDimensionUnavailable = errors.New("opentile: dimension not supported on this format/image") // ErrSparseTile is returned (wrapped in TileError) when a tile // position falls within the level's grid but the underlying file // has no compressed bytes at that cell — the format encodes // "absent / blank tile" as a sentinel offset rather than empty // content. Iris IFE uses NULL_TILE (0xFFFFFFFFFF in the 40-bit // offset field); other formats may add later. Consumers typically // translate this into an HTTP 404 or a fixed blank image. Distinct // from ErrTileOutOfBounds (the position itself is past the grid). // // Added in v0.8 alongside the Iris IFE format package. ErrSparseTile = errors.New("opentile: sparse tile (no compressed bytes at this position)") // [WithBacking](BackingMmap) (the default since v0.9) but the // underlying memory-map operation fails — typically because the // file is on a filesystem that doesn't support mmap (some FUSE // or network mounts) or the platform lacks `golang.org/x/exp/mmap` // support. Wraps the underlying error from `mmap.Open`. // // Callers that want automatic fallback to the os.File / pread // path can retry with `opts...` extended by // `WithBacking(BackingPread)` on this error. // // Added in v0.9 alongside the mmap-default OpenFile change. ErrMmapUnavailable = errors.New("opentile: memory-map unavailable for this file") // ErrCodecNotRegistered is returned by *Slide.DecodedTile and friends // when no decoder is registered for the level's Compression. The // wrapping error message names the compression and the suggested // blank-import that fixes it. // // Added in v0.24 alongside the DecodedTile family. ErrCodecNotRegistered = errors.New("opentile: codec not registered for this slide's tile compression") // ErrRegionEmpty is returned by *Slide.ReadRegion / ReadRegionScaled // when the requested rectangle has no in-bounds pixels. // // Added in v0.25 alongside the ReadRegion family. ErrRegionEmpty = errors.New("opentile: region has no in-bounds pixels") )
var ErrBadJPEGSplice = errors.New("opentile: bad JPEG splice input")
ErrBadJPEGSplice is returned by SpliceJPEGTile when the body bytes don't conform to the expected SOS-bearing JPEG layout.
Functions ¶
func CompressionToTIFFTag ¶ added in v0.24.0
func CompressionToTIFFTag(c Compression) uint16
CompressionToTIFFTag returns the TIFF Compression tag value that corresponds to c, or 0 if no standard mapping exists. Used internally by *Slide.DecodedTile to dispatch through the decoder package's GetByCompressionTag registry.
CompressionIRIS and CompressionPNG return 0 because neither has a TIFF-registered decoder; DecodedTile surfaces ErrCodecNotRegistered for these.
func SetOpenAnyHook ¶ added in v0.23.0
func SetOpenAnyHook(fn func( r io.ReaderAt, size int64, tileSize Size, hasTileSize bool, corruptTilePolicy CorruptTilePolicy, ndpiSynthLabel bool, backing Backing, ) (any, error))
SetOpenAnyHook registers the format dispatch function. Called once from internal/format's init() via a bridge file. Must be called before any Open/OpenFile call. Not safe for concurrent use during setup.
func SpliceJPEGTile ¶
SpliceJPEGTile reconstitutes a complete JPEG from a level's TilePrefix bytes and one tile's TileBodyInto output. Inserts the prefix at the on-disk tile's SOS boundary (the same operation opentile-go does internally during Tile/TileInto).
Returns body verbatim (defensively copied) if prefix is empty / nil — degenerate case for levels without splice (e.g., non-JPEG compressions, NDPI stripped levels, IFE).
Returns ErrBadJPEGSplice if body is empty or doesn't contain an SOS marker (0xFF 0xDA per JPEG spec).
Algorithm (documented for non-Go consumers reimplementing client-side):
- If prefix is empty: return body verbatim.
- Find offset of the first 0xFF 0xDA byte sequence in body ("Start of Scan" marker).
- Output = body[0:sosIdx] + prefix + body[sosIdx:]
Added in v0.13 alongside Level.TilePrefix and Level.TileBodyInto.
Types ¶
type AssociatedImage ¶
type AssociatedImage interface {
Type() string
Size() Size
Compression() Compression
Bytes() ([]byte, error)
}
AssociatedImage is a non-pyramidal slide-level image (label, overview, thumbnail).
Standard Type() values used across opentile-go's format readers. The choice of names follows DICOM PS3.3 / Supplement 145 (Whole Slide Microscopic Image IOD), where the Image Type attribute (0008,0008) value 3 enumerates: VOLUME / LABEL / OVERVIEW / THUMBNAIL. opentile-go uses the lowercase form, extended with format-specific kinds where the underlying file surfaces them:
"label" — slide label / barcode
"overview" — wide-field image of the slide. The DICOM-canonical
term, also used by upstream Python opentile and by
six of opentile-go's eight format readers. The
seventh (Iris IFE) intentionally distinguishes
"overview" from "macro" per the IFE spec.
"thumbnail" — full-slide downsample (typically square, JPEG)
"map" — NDPI / IFE: low-magnification map / overview-of-
pyramid; semantically distinct from a wide-field
slide image
"probability" — Ventana BIF / IFE: confidence / classification map
"macro" — Iris IFE only. The IFE spec defines LABEL_MACRO
as a kind distinct from LABEL_OVERVIEW. Other
formats' wide-field slide images surface as
"overview", not "macro".
"associated" — generic-TIFF heuristic-fallback (v0.10+) when the
classifier can't confidently match a kind above
Format readers use the string literals directly; the values above are stable and part of the public API contract from v0.15 onward.
type Backing ¶
type Backing uint8
Backing identifies the I/O backend used to read tile bytes from a slide file. Selectable via WithBacking; defaults to BackingMmap since v0.9.
BackingMmap memory-maps the file read-only and reads tiles via userspace memcpy from the mapped region. No syscall per Tile() call once the kernel has paged in the relevant region. Recommended for high-RPS serving and warm-cache desktop use. Caveat: SIGBUS on file truncation; not suitable for storage that gets rewritten underneath open Tilers.
BackingPread keeps the v0.8 (and earlier) os.File-based path: pread(2) syscall per [Level.Tile] call. Use this on filesystems that don't support mmap (some FUSE / network mounts), or when you specifically need the os.File semantics around truncation.
type Compression ¶
type Compression uint8
Compression identifies the bitstream format of a tile as stored in a TIFF.
opentile-go returns tile bytes in the compression format of the source TIFF without decoding them. Consumers that need decoded pixels should pass the bytes to a codec appropriate for the reported compression.
The zero value is CompressionUnknown: a forgotten-to-initialize field surfaces loudly rather than masquerading as a known compression.
const ( CompressionUnknown Compression = iota // zero value; unset or unrecognized CompressionNone CompressionJPEG CompressionJP2K CompressionLZW // TIFF tag 259 value 5 (Aperio SVS label is commonly LZW) CompressionAVIF // tile bytes are an AVIF image; consumer decodes via libavif // CompressionIRIS is the Iris-proprietary tile codec used by IFE files // when written through Iris-Codec. opentile-go reports it but does not // decode the bytes; consumers either embed an Iris codec or 501 the // request. JPEG and AVIF tiles in IFE remain decodable by external // codecs. CompressionIRIS // CompressionDeflate identifies the Deflate (zlib) bitstream // commonly used by scientific imaging TIFFs and the // generic-TIFF catch-all reader (v0.10). TIFF tag 259 values // 8 (Deflate) and 32946 (Adobe Deflate) both map here; the // payload is identical zlib-wrapped DEFLATE either way. CompressionDeflate // CompressionWebP identifies a WebP-encoded tile (RIFF + WEBP + // VP8/VP8L/VP8X chunks). TIFF tag 259 value 50001 in libtiff // convention; same value is what the user's wsi-tools transcoder // emits. Tile bytes are a complete self-contained WebP file. // Consumer decodes via libwebp or golang.org/x/image/webp. // // Added in v0.14. CompressionWebP // CompressionJPEGXL identifies a JPEG XL codestream tile. TIFF // tag 259 value 50002 (wsi-tools convention; not formally // registered). Tile bytes are a bare JXL codestream beginning // with the 0xFF 0x0A marker. Consumer decodes via libjxl (cgo) // or stdlib image/jxl when available. // // Added in v0.14. CompressionJPEGXL // CompressionHTJ2K identifies an HTJ2K (High-Throughput JPEG // 2000, ISO/IEC 15444-15) codestream tile. TIFF tag 259 value // 60003 (wsi-tools convention). Distinct from CompressionJP2K // because HTJ2K uses a different entropy coder (FBCOT instead // of EBCOT) and a standard JP2K decoder will fail on HTJ2K // bytes. Consumer decodes via OpenJPEG 2.5+, OpenHTJ2K, or // Kakadu. // // Added in v0.14. CompressionHTJ2K // CompressionPNG identifies a PNG-encoded tile (`\x89PNG` magic). // DZI's Format attribute admits both jpeg and png. Tile bytes // are a complete self-contained PNG file. Consumer decodes via // `image/png` (stdlib). // // Added in v0.16. CompressionPNG )
func (Compression) String ¶
func (c Compression) String() string
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is an opaque, read-only view of the configuration passed to a FormatFactory. Format packages import opentile.Config rather than the unexported config struct.
func NewTestConfig
deprecated
func NewTestConfig(tileSize Size, policy CorruptTilePolicy) *Config
NewTestConfig constructs a Config for use in tests.
Deprecated: use opentile/opentiletest.NewConfig. This wrapper remains for one release to keep external callers compiling; it will be removed in v0.4.
func (*Config) Backing ¶
Backing reports the I/O backing the caller selected via WithBacking. Defaults to BackingMmap since v0.9 if no option was passed. Format packages typically don't need this — Open is path-agnostic — but it's exposed for diagnostic accessors.
func (*Config) CorruptTilePolicy ¶
func (c *Config) CorruptTilePolicy() CorruptTilePolicy
CorruptTilePolicy returns the configured policy.
func (*Config) NDPISynthesizedLabel ¶
NDPISynthesizedLabel reports whether NDPI Tiler.Associated() should include a synthesized label cropped from the overview. Default true.
func (*Config) TileSize ¶
TileSize returns the requested output tile size and whether the caller set one.
- (Size{}, false): caller did not pass WithTileSize. Format packages should use their format default (e.g. SVS reads the native tile size from the TIFF; NDPI uses 512).
- (Size{}, true): caller explicitly passed WithTileSize(0, 0). Format packages MUST reject this as malformed input. The zero Size is distinct from "unset" because the API contract is that an explicit option overrides the default.
- (non-zero, true): caller's requested tile size; format honors it (NDPI may snap to a stripe-multiple, SVS rejects when it doesn't match the native tile dimensions).
type CorruptTilePolicy ¶
type CorruptTilePolicy uint8
CorruptTilePolicy controls how corrupt-edge tiles (currently: Aperio SVS) are reported. v0.1 supports only CorruptTileError.
const ( CorruptTileError CorruptTilePolicy = iota // return ErrCorruptTile (default, v0.1) CorruptTileBlank // v0.3: return a typed blank tile CorruptTileFix // v1.0: reconstruct from parent level )
type DecodeOption ¶ added in v0.24.0
type DecodeOption func(*decodeConfig)
DecodeOption configures a *Slide.DecodedTile / DecodedTileInto / ReadRegion / ReadRegionScaled call. See WithFormat, WithScale, WithResampleKernel.
func WithFormat ¶ added in v0.24.0
func WithFormat(f decoder.PixelFormat) DecodeOption
WithFormat sets the requested output pixel format. Defaults to PixelFormatRGB (3 bytes per pixel; alpha-free). PixelFormatRGBA is also universally supported.
func WithResampleKernel ¶ added in v0.25.0
func WithResampleKernel(k resample.Kernel) DecodeOption
WithResampleKernel chooses the resample kernel for ReadRegionScaled. Has no effect on ReadRegion (no resampling step).
resample.Lanczos — best perceptual quality (default) resample.Box — fast integer-ratio downsampling, sharp resample.Bilinear — fast, decent quality resample.Nearest — fastest, ugly under downsampling
func WithScale ¶ added in v0.24.0
func WithScale(s int) DecodeOption
WithScale sets the IDCT-time scale factor (JPEG decoders only). Valid values: 1, 2, 4, 8. Non-JPEG sources return ErrUnsupportedScale from the underlying decoder if Scale != 1.
type Format ¶
type Format string
Format identifies the source file format.
const ( FormatSVS Format = "svs" FormatNDPI Format = "ndpi" // FormatPhilipsTIFF is the Philips IntelliSite Pathology Solution TIFF // reader. Renamed in v0.12 from FormatPhilips to FormatPhilipsTIFF to // align with v0.10's FormatGenericTIFF and v0.11's FormatLeicaSCN naming // convention; Philips has multiple WSI file formats (TIFF; iSyntax), so // the bare "philips" identifier was ambiguous. Reports as "philips-tiff". FormatPhilipsTIFF Format = "philips-tiff" // FormatOMETIFF is the OME-TIFF reader. Renamed in v0.12 to align // with v0.10/v0.11's FormatGenericTIFF / FormatLeicaSCN convention; // OME has multiple file formats (OME-TIFF, OME-Zarr, OME-NGFF), so // the bare "ome" identifier ambiguously claimed the family. FormatOMETIFF Format = "ome-tiff" FormatBIF Format = "bif" FormatIFE Format = "ife" // FormatGenericTIFF is the catch-all reader for tiled pyramidal TIFF // without vendor metadata (added in v0.10). Activates when no // vendor format factory claims the file. Reports as "generic-tiff" // to differentiate from possible future generic-non-TIFF readers. FormatGenericTIFF Format = "generic-tiff" // FormatLeicaSCN is the Leica SCN reader (added in v0.11). SCN is a // BigTIFF dialect produced by Leica SCN400 / SCN400F scanners; // scanner production stopped ~2015. Reports as "leica-scn" to // differentiate from other Leica-related formats (LIF, LMS) that // aren't SCN. FormatLeicaSCN Format = "leica-scn" // FormatSZI identifies a Smart Zoom Image file (ZIP-wrapped // Microsoft Deep Zoom pyramid + scan-properties.xml + // associated_images/, per the smartinmedia/SZI-Format spec). // // Added in v0.16. FormatSZI Format = "szi" // FormatCOGWSI identifies a Cloud Optimized GeoTIFF for WSI file — // a strict extension of GDAL Cloud Optimized GeoTIFF carrying // WSI-specific private tags + ghost-area marker. Spec at // docs/specs/2026-05-20-cog-wsi-format.md. Added in v0.19. FormatCOGWSI Format = "cog-wsi" )
type Image ¶
type Image struct {
// Name identifies this image. For OME-TIFF, the <Image Name="...">
// attribute. Empty for single-image formats.
Name string
// Index is the 0-based document-order index of this Image within
// the parent Slide. Pass to *Slide.ImageRawTile(image, level, tx, ty).
Index int
// Levels is the pyramid for this image, finest-to-coarsest. Level 0
// is the full-resolution base; subsequent indices are progressively
// downsampled.
Levels []Level
}
Image identifies one pyramid group within a slide. Single-image formats carry a single Image. OME-TIFF can carry multiple.
type Level ¶
type Level struct {
// Index is the 0-based index of this level within the parent
// Image's Levels slice. Pass to *Slide.RawTile(level, tx, ty).
Index int
// PyramidIndex is the pyramid-group index for multi-image formats.
// Single-image formats always have PyramidIndex = 0. OME-TIFF
// multi-image files preserve the per-image series identifier here.
PyramidIndex int
// Size is the pixel dimensions of this level (Width × Height).
Size Size
// TileSize is the tile dimensions used by this level.
TileSize Size
// Grid is the tile grid dimensions: ceil(Size / TileSize) per axis.
// Pre-computed for convenience.
Grid Size
// TileOverlap is the per-tile overlap (BIF / NDPI in overlapping
// modes). Zero for non-overlapping tile formats.
TileOverlap image.Point
// Compression identifies the codec for tile bytes at this level.
// Used by *Slide.DecodedTile to dispatch to the right decoder.
Compression Compression
// MPP is microns-per-pixel at this level (W and H; usually equal).
// Zero value if the slide doesn't carry MPP metadata.
MPP SizeMm
// FocalPlane is the z-position in microns for multi-focal-plane
// sources. Zero value for 2D slides.
FocalPlane float64
// Downsample is the resolution factor from L0. 1.0 at level 0,
// 2.0 at half-resolution, 4.0 at quarter, etc. Computed at Open
// time from the level's Size relative to the image's L0 Size.
//
// Used by *Slide.BestLevelForDownsample and *Slide.ReadRegionScaled
// to translate L0 coords into level coords.
//
// Added in v0.25 alongside the ReadRegion family.
Downsample float64
}
Level is value-type pyramid-level metadata. All fields are inspection-only (read at *Slide.Open time). Tile reads use *Slide.RawTile / *Slide.DecodedTile (takes level index).
type Metadata ¶
type Metadata struct {
Magnification float64 // 0 if unknown
ScannerManufacturer string
ScannerModel string
ScannerSoftware []string
ScannerSerial string
// AcquisitionDateTime is the time the slide was scanned. Partial Date
// or Time values that fail time.Parse yield the zero value
// (time.Time{}); time.Time{}.IsZero() == true is the "unknown"
// sentinel. Callers should always check IsZero rather than comparing
// against a specific time — different scanner vendors emit dates in
// different formats and our parsers are lenient but not exhaustive.
AcquisitionDateTime time.Time
// MicronsPerPixel is populated when MicronsPerPixelX and
// MicronsPerPixelY are both set and equal (strict ==). When the
// format reports asymmetric pixel size, MicronsPerPixel is zero
// and consumers should consult the per-axis fields. Zero indicates
// "unknown OR asymmetric"; check MicronsPerPixelX/Y to disambiguate.
//
// Added in v0.17.
MicronsPerPixel float64
// MicronsPerPixelX / MicronsPerPixelY are the per-axis pixel size
// in microns. Zero indicates the format didn't report it.
//
// Added in v0.17.
MicronsPerPixelX float64
MicronsPerPixelY float64
// ImageDescription is the structured per-format description (e.g.,
// SVS ImageDescription TIFF tag, OME-XML <Image Description>
// attribute). Empty when the format has no equivalent. For free-
// text user comments, see Properties[PropertyComments].
//
// Added in v0.17.
ImageDescription string
// Properties is a flat key-value map for additional metadata
// that doesn't fit the typed fields. Two key conventions:
//
// - opentile-go-canonical keys (lowercase-with-hyphens):
// PropertyCaseNumber, PropertyUserName, PropertyScannedAreaMM2,
// PropertyScanDurationSec, PropertyComments. Populated by
// format readers when their format exposes the equivalent.
//
// - vendor-namespaced keys (vendor.<key>): vendor-specific
// fields surfaced as-is. Format-prefixed: e.g., "szi.vendor.
// SerialNumber", "aperio.AppMag".
//
// Missing keys mean the format didn't expose that field. Numeric
// values are string-formatted floats (parseable via
// strconv.ParseFloat).
//
// Added in v0.17.
Properties map[string]string
// Writer identifies the software that wrote this file — the
// file producer, distinct from ScannerManufacturer (scanner OEM)
// and ScannerSoftware []string (broader software stack).
//
// Format-specific population:
// SVS Aperio canonical "Aperio Image Library v11.2.1"
// SVS Grundium / other "Grundium Ocus" (comma-suffix writer
// from v0.18 detection)
// OME-TIFF "OME Bio-Formats 6.0.0-rc1" (Creator
// attribute; promoted from Properties)
// SZI "<SoftwareName> <SoftwareVersion>"
// (e.g., "OcusScan 3.1.4")
// COG-WSI "wsitools/<WSIToolsVersion>" (file
// producer; source scanner stays in
// ScannerManufacturer per spec)
// Generic-TIFF (wsi-tools "wsitools/<version>" from the
// fixtures avif/jxl/ wsi-tools ImageDescription parser
// htj2k/webp)
// NDPI / Philips / BIF / format-specific Software field (often
// IFE / Leica SCN equals ScannerSoftware[0])
//
// Empty when the format provides no writer indication. Consumers
// checking presence compare against "" explicitly.
//
// Added in v0.20.
Writer string
}
Metadata is the common subset of slide metadata surfaced across all formats. Format packages embed this struct to add format-specific fields exposed via type assertion on Tiler.Metadata().
func (*Metadata) SetMPPSymmetric ¶
func (m *Metadata) SetMPPSymmetric()
SetMPPSymmetric populates MicronsPerPixel from MicronsPerPixelX and MicronsPerPixelY when they are equal (strict ==). When asymmetric, MicronsPerPixel is zeroed.
Format readers call this after setting the per-axis fields.
Added in v0.17.
func (*Metadata) SetProperty ¶
SetProperty is a nil-safe setter for Properties. Lazily initializes the map on first use.
Added in v0.17.
type Option ¶
type Option func(*config)
Option mutates the opentile configuration before Open returns a Tiler.
func WithBacking ¶
WithBacking selects the I/O backend used by OpenFile. The default since v0.9 is BackingMmap; pass WithBacking(BackingPread) on the rare filesystem that doesn't support mmap or when you need os.File truncation semantics.
Has no effect on Open (which already takes a caller-provided io.ReaderAt); only the path-resolving OpenFile honors this.
When set to BackingMmap and the underlying mmap call fails (FUSE mount that doesn't support mapping, etc.), OpenFile returns ErrMmapUnavailable wrapping the underlying error rather than silently falling back. Callers that want auto-fallback should retry with WithBacking(BackingPread).
func WithCorruptTilePolicy ¶
func WithCorruptTilePolicy(p CorruptTilePolicy) Option
WithCorruptTilePolicy sets the behavior for corrupt-edge tiles. v0.1 supports only CorruptTileError.
func WithNDPISynthesizedLabel ¶
WithNDPISynthesizedLabel controls whether NDPI Tiler.Associated() includes a synthesized "label" image, which Go produces by cropping the left 30% of the overview page. Python opentile 0.20.0 does not expose NDPI labels; this is a Go-side extension. Default: true (matches v0.2 behavior).
func WithTileSize ¶
WithTileSize requests output tile dimensions in pixels. If unset, the format default is used (SVS: native tile size from the TIFF). Required for formats that have no native rectangular tiles (NDPI, v0.2+).
type Point ¶
type Point struct {
X, Y int
}
Point is a 2D integer position measured in pixels or tile units.
type Size ¶
type Size struct {
W, H int
}
Size is a 2D integer extent measured in pixels or tile units.
type SizeMm ¶
type SizeMm struct {
W, H float64
}
SizeMm is a 2D extent measured in millimeters. Used for pixel spacing and microns-per-pixel conversion (SizeMm scaled by 1000 equals micrometers).
type Slide ¶ added in v0.23.0
type Slide struct {
// contains filtered or unexported fields
}
Slide is the canonical handle for an open whole-slide image. Constructed via OpenFile (path) or Open (io.ReaderAt). Replaces the pre-v0.23 Tiler interface as the public return type of Open and OpenFile.
Concurrency contract: all accessor methods (Format, Images, Levels, Level, Associated, Metadata, ICCProfile) are safe to call concurrently. Tile reads via RawTile / RawTileInto are safe concurrently. Close must not race with in-flight tile reads.
func Open ¶
Open parses r as a WSI file and returns a *Slide for the matching format. size is the total file size in bytes.
Dispatch probes each registered format in registration order; the first whose match function returns nil wins. Returns an error if no format claims the input (requires a format package to be imported, e.g. _ "github.com/wsilabs/opentile-go/formats/all").
func OpenFile ¶
OpenFile opens path for reading and delegates to Open. The returned *Slide owns the underlying file handle (or memory map); Close releases it.
Default backing since v0.9 is BackingMmap: the file is memory-mapped read-only and tile reads become userspace memcpys from the mapped region — no pread(2) syscall per [Level.Tile] call. The kernel page cache handles paging in tile-data regions on first access; warm-cache reads hit RAM at memory-bandwidth speed.
Pass WithBacking(BackingPread) to opt out and use the v0.8 (and earlier) os.File + pread path. Required for filesystems that don't support mmap (some FUSE / network mounts) or when the caller specifically needs os.File truncation semantics.
Failure modes:
- mmap unavailable for this file (filesystem doesn't support it, or some platform-specific failure): returns ErrMmapUnavailable wrapping the underlying error. Callers wanting automatic fallback should retry with WithBacking(BackingPread).
- file truncated underneath an open mmap-backed *Slide: subsequent Tile() calls into the truncated region raise SIGBUS in the calling thread. WSI files don't get truncated under normal use; if your storage allows it, use BackingPread.
func (*Slide) Associated ¶ added in v0.23.0
func (s *Slide) Associated() []AssociatedImage
Associated returns the auxiliary images (label, macro, thumbnail, overview, ...) embedded in this slide.
func (*Slide) BestLevelForDownsample ¶ added in v0.25.0
BestLevelForDownsample returns the index of the largest pyramid level whose Downsample factor is ≤ the requested value. Matches openslide.best_level_for_downsample semantics.
Returns 0 (L0) if every level's downsample exceeds the requested value (the caller wants higher resolution than the slide carries).
Shortcut for ImageBestLevelForDownsample(0, downsample).
Added in v0.25 alongside the ReadRegion family.
func (*Slide) DecodedTile ¶ added in v0.24.0
DecodedTile returns the decoded pixel data for the tile at (level, tx, ty) within image 0. The output pixel format defaults to PixelFormatRGB; override via WithFormat. JPEG sources support IDCT-time scaling via WithScale.
Requires that a decoder for the level's Compression is registered. Blank-import github.com/wsilabs/opentile-go/decoder/all or the specific codec subpackage (e.g., decoder/jpeg) to enable. Returns ErrCodecNotRegistered (wrapped with the compression name) if not.
As of v0.27, format readers implementing the unexported decodedTiler interface (currently NDPI striped levels) take a fast pixel-cache path that avoids per-tile JPEG re-encoding + decoder-handle churn. Other formats and non-striped NDPI levels keep the original RawTile + fresh- decoder path, which is preserved unchanged.
func (*Slide) DecodedTileInto ¶ added in v0.24.0
DecodedTileInto decodes a tile into a caller-provided destination Image. dst.Width / dst.Height must match the tile's decoded dimensions; mismatched sizes return decoder.ErrDestinationSize from the underlying decoder. dst.Format may be RGB or RGBA (decoders convert as needed).
func (*Slide) ICCProfile ¶ added in v0.23.0
ICCProfile returns the embedded color profile bytes, or nil if the slide has none.
func (*Slide) ImageBestLevelForDownsample ¶ added in v0.25.0
ImageBestLevelForDownsample is the multi-image variant of BestLevelForDownsample.
func (*Slide) ImageDecodedTile ¶ added in v0.24.0
func (s *Slide) ImageDecodedTile(image, level, tx, ty int, opts ...DecodeOption) (*decoder.Image, error)
ImageDecodedTile is the multi-image variant of DecodedTile.
v0.27 fast-path dispatch: when s.r implements decodedTiler and the fast path succeeds, returns its output directly. ErrUnsupported from the reader signals "no fast path for this level" and falls through to the v0.26 RawTile + fresh-decoder path. Any other error propagates.
func (*Slide) ImageDecodedTileInto ¶ added in v0.24.0
func (s *Slide) ImageDecodedTileInto(image, level, tx, ty int, dst *decoder.Image, opts ...DecodeOption) error
ImageDecodedTileInto is the multi-image variant of DecodedTileInto.
v0.27 fast-path dispatch: when s.r implements decodedTiler and the fast path succeeds, copies its output into dst. Otherwise routes through the v0.26 path which decodes directly into dst.
func (*Slide) ImageRangeTiles ¶ added in v0.24.0
func (s *Slide) ImageRangeTiles(ctx context.Context, image, level int) iter.Seq2[TilePos, TileResult]
ImageRangeTiles is the multi-image variant of RangeTiles.
func (*Slide) ImageRawTile ¶ added in v0.24.0
ImageRawTile returns the compressed tile bytes at the given image, level, and tile coordinates. Required for multi-image formats (OME-TIFF); single-image formats accept only image=0.
func (*Slide) ImageRawTileInto ¶ added in v0.24.0
ImageRawTileInto fills dst with the compressed tile bytes at the given image, level, and tile coordinates. Returns the byte count written.
func (*Slide) ImageReadRegion ¶ added in v0.25.0
func (s *Slide) ImageReadRegion(image, level, x, y, w, h int, opts ...DecodeOption) (*decoder.Image, error)
ImageReadRegion is the multi-image variant of ReadRegion.
func (*Slide) ImageReadRegionInto ¶ added in v0.25.0
func (s *Slide) ImageReadRegionInto(image, level, x, y int, dst *decoder.Image, opts ...DecodeOption) error
ImageReadRegionInto is the multi-image variant of ReadRegionInto.
func (*Slide) ImageReadRegionScaled ¶ added in v0.25.0
func (s *Slide) ImageReadRegionScaled(image int, l0x, l0y, l0w, l0h, outW, outH int, opts ...DecodeOption) (*decoder.Image, error)
ImageReadRegionScaled is the multi-image variant of ReadRegionScaled.
func (*Slide) ImageReadRegionScaledInto ¶ added in v0.25.0
func (s *Slide) ImageReadRegionScaledInto(image int, l0x, l0y, l0w, l0h int, dst *decoder.Image, opts ...DecodeOption) error
ImageReadRegionScaledInto is the multi-image variant.
func (*Slide) ImageTileBodyInto ¶ added in v0.24.0
ImageTileBodyInto is the multi-image variant of TileBodyInto.
func (*Slide) ImageTileBodyMaxSize ¶ added in v0.24.0
ImageTileBodyMaxSize is the multi-image variant of TileBodyMaxSize.
func (*Slide) ImageTileMaxSize ¶ added in v0.24.0
ImageTileMaxSize is the multi-image variant of TileMaxSize.
func (*Slide) ImageTilePrefix ¶ added in v0.24.0
ImageTilePrefix is the multi-image variant of TilePrefix.
func (*Slide) ImageTileReader ¶ added in v0.24.0
func (s *Slide) ImageTileReader(image, level, tx, ty int) (io.ReadCloser, error)
ImageTileReader is the multi-image variant of TileReader.
func (*Slide) ImageWarmLevel ¶ added in v0.24.0
ImageWarmLevel pre-warms the page cache for the given image + level.
func (*Slide) Images ¶ added in v0.23.0
Images returns the main pyramids carried by this file. Always returns at least one Image; multi-image OME-TIFF exposes multiple. Index 0 is the legacy Levels() / Level(i) shortcut target.
func (*Slide) RangeTiles ¶ added in v0.24.0
RangeTiles returns a range-over-function iterator over all tiles in the given level within image 0.
func (*Slide) RawTile ¶ added in v0.24.0
RawTile returns the compressed tile bytes at the given level and tile coordinates within image 0.
func (*Slide) RawTileInto ¶ added in v0.24.0
RawTileInto fills dst with the compressed tile bytes at the given level and tile coordinates within image 0. Returns the byte count written.
func (*Slide) ReadRegion ¶ added in v0.25.0
ReadRegion returns the decoded pixel data for the rectangle (x, y)-(x+w, y+h) at the given level. ALL FOUR coords/dims are at the level's own resolution. Use ReadRegionScaled if you have L0 coords or want arbitrary output dimensions.
The rectangle may extend beyond the level's bounds; out-of-bounds pixels are white-filled (0xFF, 0xFF, 0xFF). Returns ErrRegionEmpty if the entire rectangle is outside the level.
Requires a registered decoder for the level's Compression — same constraint as DecodedTile.
Internally spans the relevant tiles and decodes each once. Adjacent ReadRegion calls do NOT share a decoded-tile cache; for high-throughput patterns use the v0.26 ScaledStrips iterator when it ships.
Shortcut for ImageReadRegion(0, level, x, y, w, h, opts...).
Added in v0.25.
func (*Slide) ReadRegionInto ¶ added in v0.25.0
ReadRegionInto decodes a region into a caller-provided destination Image. (x, y) at the level's resolution; the region size is taken from dst.Width × dst.Height. dst.Format may be RGB or RGBA.
Shortcut for ImageReadRegionInto(0, level, x, y, dst, opts...).
func (*Slide) ReadRegionScaled ¶ added in v0.25.0
func (s *Slide) ReadRegionScaled(l0x, l0y, l0w, l0h, outW, outH int, opts ...DecodeOption) (*decoder.Image, error)
ReadRegionScaled reads an L0-coord rectangle and resamples it to (outW, outH). The library picks the best source pyramid level via BestLevelForDownsample, reads at that level, then resamples to the target.
All input coords (l0x, l0y, l0w, l0h) are at L0 (full-resolution) coordinates. Output dimensions (outW, outH) are the desired final pixel size — any value, regardless of level resolutions.
Use WithResampleKernel to choose the resample quality. Default: resample.Lanczos. Use WithFormat / WithScale as with DecodedTile.
Out-of-bounds: the L0 rectangle is auto-clipped against the slide dimensions before level selection. Out-of-bounds output pixels are white-filled.
Returns ErrRegionEmpty if the L0 rectangle has no in-bounds pixels.
Shortcut for ImageReadRegionScaled(0, l0x, l0y, l0w, l0h, outW, outH, opts...).
Added in v0.25.
func (*Slide) ReadRegionScaledInto ¶ added in v0.25.0
func (s *Slide) ReadRegionScaledInto(l0x, l0y, l0w, l0h int, dst *decoder.Image, opts ...DecodeOption) error
ReadRegionScaledInto fills caller-provided dst. dst.Width / dst.Height define the output dimensions.
func (*Slide) ScaledStrips ¶ added in v0.26.0
func (s *Slide) ScaledStrips( l0Rect image.Rectangle, outSize image.Point, stripHeight int, opts ...StripOption, ) *StripIterator
ScaledStrips returns an iterator over a slide's L0 rectangle, scaled to outSize, in horizontal strips of stripHeight rows. See the *StripIterator type for the iteration API.
Out-of-bounds l0Rect: auto-clipped to slide bounds; entirely out-of-bounds yields all-white strips.
Internally manages parallel decode workers + a per-iterator tile cache + lookahead pre-fetch. Caller must call Close on the returned iterator.
Shortcut for ImageScaledStrips(0, ...) — multi-image variant is deferred to a future release.
Added in v0.26.
func (*Slide) TileBodyInto ¶ added in v0.24.0
TileBodyInto fills dst with the tile body bytes at the given level and tile coordinates within image 0.
func (*Slide) TileBodyMaxSize ¶ added in v0.24.0
TileBodyMaxSize returns the upper bound on tile-body (no prefix) bytes at the given level within image 0.
func (*Slide) TileMaxSize ¶ added in v0.24.0
TileMaxSize returns the upper bound on tile byte size at the given level within image 0. Used for sizing caller-provided destination buffers passed to RawTileInto.
func (*Slide) TilePrefix ¶ added in v0.24.0
TilePrefix returns the JPEG-tables prefix bytes shared across all tiles at the given level within image 0. nil if the codec has no prefix.
func (*Slide) TileReader ¶ added in v0.24.0
func (s *Slide) TileReader(level, tx, ty int) (io.ReadCloser, error)
TileReader returns a streaming io.ReadCloser for the compressed tile at the given level and tile coordinates within image 0.
func (*Slide) UnwrapReader ¶ added in v0.23.0
UnwrapReader returns the underlying format-specific reader. Format packages use this to chain-walk through *Slide to their own concrete reader type (e.g., bif.MetadataOf(slide) walks the chain to find the BIF *Tiler).
type StripIterator ¶ added in v0.26.0
type StripIterator struct {
// contains filtered or unexported fields
}
StripIterator yields horizontal strips of a slide scaled to a target output resolution. Not safe for concurrent use; one goroutine drives Next() / Close() per iterator.
func (*StripIterator) Close ¶ added in v0.26.0
func (it *StripIterator) Close() error
Close releases the iterator's workers + cache. Safe to call multiple times.
func (*StripIterator) Next ¶ added in v0.26.0
func (it *StripIterator) Next() (*decoder.Image, error)
Next returns the next decoded strip image. Returns io.EOF when all strips have been consumed, and io.ErrClosedPipe after Close.
func (*StripIterator) Strips ¶ added in v0.26.0
func (it *StripIterator) Strips() int
Strips returns the total number of strips this iterator will yield.
type StripOption ¶ added in v0.26.0
type StripOption func(*stripConfig)
StripOption configures a ScaledStrips iterator. See WithStripWorkers, WithStripLookahead, WithStripIDCTScale, WithStripKernel, WithStripContext.
func WithStripContext ¶ added in v0.26.0
func WithStripContext(ctx context.Context) StripOption
WithStripContext binds the iterator's worker pool to a cancellation context. Default: context.Background().
Cancelling ctx aborts in-flight Next() calls with ctx.Err(). Workers also respond to *StripIterator.Close().
func WithStripIDCTScale ¶ added in v0.26.0
func WithStripIDCTScale(scale int) StripOption
WithStripIDCTScale overrides the auto-selected IDCT-time scale factor for JPEG sources. Valid: 1, 2, 4, 8. Default 0 = auto- select based on output downsample.
Non-JPEG sources ignore this option silently.
func WithStripKernel ¶ added in v0.26.0
func WithStripKernel(k resample.Kernel) StripOption
WithStripKernel sets the resample kernel applied after the source-tile decode step (when IDCT alone doesn't reach the target output dims). Default: resample.Lanczos.
func WithStripLookahead ¶ added in v0.26.0
func WithStripLookahead(strips int) StripOption
WithStripLookahead sets how many strips ahead the iterator pre-fetches source tiles for. Default: 2. 0 disables lookahead entirely (workers idle between Next() calls). Higher values trade memory for steady-state throughput on slow consumers.
func WithStripWorkers ¶ added in v0.26.0
func WithStripWorkers(n int) StripOption
WithStripWorkers sets the number of parallel source-tile decode workers. Default: runtime.NumCPU(). Values < 1 are clamped to 1.
type TileCoord ¶
TileCoord identifies a tile by its position in the multi- dimensional WSI space. X and Y are the existing 2D grid position; Z, C, and T select among focal planes (Z), fluorescence / spectral channels (C), and time points (T) respectively.
Z, C, T default to zero — a TileCoord literal {X: x, Y: y} addresses the same tile that Level.Tile(x, y) returns. Zero is the "nominal" / "first" / "T=0" plane in every dimension.
Valid ranges per axis:
0 <= X < Level.Grid().W 0 <= Y < Level.Grid().H 0 <= Z < Image.SizeZ() 0 <= C < Image.SizeC() 0 <= T < Image.SizeT()
Out-of-range values yield *TileError wrapping ErrDimensionUnavailable (axis is unsupported on this Image — SizeZ/C/T == 1) or ErrTileOutOfBounds (axis exists but the index is past its declared size).
Added in v0.7 alongside Level.TileAt and Image.SizeZ/SizeC/SizeT.
type TileError ¶
TileError wraps a per-tile failure with the (level, x, y) that produced it. Consumers use errors.As to extract the coordinates and errors.Is against the exported sentinels to branch on the underlying cause.
type TilePos ¶
type TilePos struct{ X, Y int }
TilePos is a (column, row) pair returned by RangeTiles.
type TileResult ¶
TileResult carries the yield from RangeTiles.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
bench/ndpi
command
|
|
|
Package decoder defines the public Decoder interface and registry for opentile-go's pluggable codec layer.
|
Package decoder defines the public Decoder interface and registry for opentile-go's pluggable codec layer. |
|
all
Package all blank-imports every decoder subpackage so all codecs register at init() time.
|
Package all blank-imports every decoder subpackage so all codecs register at init() time. |
|
avif
Package avif implements the AVIF decoder via libavif.
|
Package avif implements the AVIF decoder via libavif. |
|
deflate
Package deflate implements the decoder for TIFF Compression=8 (Deflate/Zip).
|
Package deflate implements the decoder for TIFF Compression=8 (Deflate/Zip). |
|
htj2k
Package htj2k implements the HTJ2K (High-Throughput JPEG 2000) decoder via OpenJPH (https://github.com/aous72/OpenJPH).
|
Package htj2k implements the HTJ2K (High-Throughput JPEG 2000) decoder via OpenJPH (https://github.com/aous72/OpenJPH). |
|
jpeg
Package jpeg implements the JPEG decoder via libjpeg-turbo.
|
Package jpeg implements the JPEG decoder via libjpeg-turbo. |
|
jpeg2000
Package jpeg2000 implements the JPEG 2000 decoder via openjp2.
|
Package jpeg2000 implements the JPEG 2000 decoder via openjp2. |
|
jpegxl
Package jpegxl implements the JPEG-XL decoder via libjxl.
|
Package jpegxl implements the JPEG-XL decoder via libjxl. |
|
lzw
Package lzw implements the decoder for TIFF Compression=5 (LZW).
|
Package lzw implements the decoder for TIFF Compression=5 (LZW). |
|
none
Package none implements the trivial "no-compression" decoder for TIFF Compression=1 tiles, where the on-disk bytes ARE the decoded pixels.
|
Package none implements the trivial "no-compression" decoder for TIFF Compression=1 tiles, where the on-disk bytes ARE the decoded pixels. |
|
webp
Package webp implements the WebP decoder via libwebp.
|
Package webp implements the WebP decoder via libwebp. |
|
formats
|
|
|
all
Package all registers every format implemented by opentile-go.
|
Package all registers every format implemented by opentile-go. |
|
bif
Package bif implements opentile-go format support for Ventana BIF (BioImagene Image File) — a BigTIFF dialect produced by Roche's VENTANA DP scanner family (DP 200, DP 600) and predecessor iScan scanners (Coreo, HT).
|
Package bif implements opentile-go format support for Ventana BIF (BioImagene Image File) — a BigTIFF dialect produced by Roche's VENTANA DP scanner family (DP 200, DP 600) and predecessor iScan scanners (Coreo, HT). |
|
cogwsi
Package cogwsi reads Cloud Optimized GeoTIFF for WSI (COG-WSI) files — a strict COG extension produced by the wsitools transcoder (cornish/wsitools).
|
Package cogwsi reads Cloud Optimized GeoTIFF for WSI (COG-WSI) files — a strict COG extension produced by the wsitools transcoder (cornish/wsitools). |
|
generictiff
Package generictiff implements opentile-go format support for generic tiled pyramidal TIFF — the catch-all reader for tiled WSI TIFFs without vendor metadata.
|
Package generictiff implements opentile-go format support for generic tiled pyramidal TIFF — the catch-all reader for tiled WSI TIFFs without vendor metadata. |
|
ife
Package ife implements opentile-go format support for Iris File Extension (IFE) v1.0 — the IrisDigitalPathology bleeding-edge non-TIFF WSI container.
|
Package ife implements opentile-go format support for Iris File Extension (IFE) v1.0 — the IrisDigitalPathology bleeding-edge non-TIFF WSI container. |
|
leicascn
Package leicascn implements opentile-go format support for Leica SCN — a BigTIFF dialect produced by Leica SCN400 / SCN400F scanners (production discontinued ~2015).
|
Package leicascn implements opentile-go format support for Leica SCN — a BigTIFF dialect produced by Leica SCN400 / SCN400F scanners (production discontinued ~2015). |
|
ndpi
Package ndpi implements opentile-go format support for Hamamatsu NDPI files.
|
Package ndpi implements opentile-go format support for Hamamatsu NDPI files. |
|
ometiff
Package ometiff implements opentile-go format support for OME TIFF files — a TIFF dialect carrying OME-XML metadata in the first page's ImageDescription, with reduced-resolution pyramid levels stored as TIFF SubIFDs of the base page.
|
Package ometiff implements opentile-go format support for OME TIFF files — a TIFF dialect carrying OME-XML metadata in the first page's ImageDescription, with reduced-resolution pyramid levels stored as TIFF SubIFDs of the base page. |
|
philipstiff
Package philipstiff reads tiles from Philips IntelliSite Pathology Solution TIFF whole-slide images.
|
Package philipstiff reads tiles from Philips IntelliSite Pathology Solution TIFF whole-slide images. |
|
svs
Package svs implements opentile-go format support for Aperio SVS files.
|
Package svs implements opentile-go format support for Aperio SVS files. |
|
szi
Package szi reads Smart Zoom Image (.szi) files — ZIP-wrapped Microsoft Deep Zoom pyramids with scan-properties.xml and an associated_images/ folder.
|
Package szi reads Smart Zoom Image (.szi) files — ZIP-wrapped Microsoft Deep Zoom pyramids with scan-properties.xml and an associated_images/ folder. |
|
internal
|
|
|
bifxml
Package bifxml parses the XMP metadata embedded in Ventana BIF TIFF IFDs.
|
Package bifxml parses the XMP metadata embedded in Ventana BIF TIFF IFDs. |
|
cog
Package cog parses the GDAL Cloud Optimized GeoTIFF ghost-area (the contiguous block of ASCII key-value metadata immediately following the TIFF header).
|
Package cog parses the GDAL Cloud Optimized GeoTIFF ghost-area (the contiguous block of ASCII key-value metadata immediately following the TIFF header). |
|
dzi
Package dzi parses the Microsoft Deep Zoom Image (DZI) manifest XML format and computes per-level / per-tile coordinate information.
|
Package dzi parses the Microsoft Deep Zoom Image (DZI) manifest XML format and computes per-level / per-tile coordinate information. |
|
fastpath
Package fastpath holds dispatch sentinel errors shared between the opentile root and format-specific readers.
|
Package fastpath holds dispatch sentinel errors shared between the opentile root and format-specific readers. |
|
format
Package format defines the internal Reader interface every opentile-go format implementation provides.
|
Package format defines the internal Reader interface every opentile-go format implementation provides. |
|
jpeg
Package jpeg provides marker-level JPEG bitstream manipulation sufficient to assemble valid JPEGs from TIFF-embedded scan fragments.
|
Package jpeg provides marker-level JPEG bitstream manipulation sufficient to assemble valid JPEGs from TIFF-embedded scan fragments. |
|
jpegturbo
Package jpegturbo provides a minimal cgo wrapper over libjpeg-turbo's tjTransform operation, scoped to the lossless MCU-aligned JPEG crop that opentile-go needs for one-frame NDPI pyramid levels and NDPI label cropping.
|
Package jpegturbo provides a minimal cgo wrapper over libjpeg-turbo's tjTransform operation, scoped to the lossless MCU-aligned JPEG crop that opentile-go needs for one-frame NDPI pyramid levels and NDPI label cropping. |
|
oneframe
Package oneframe provides shared infrastructure for reading "single big JPEG, virtualised into tile cells" pyramid pages — used by NDPI's non-tiled levels (formats/ndpi/oneframe.go pre-v0.6) and OME-TIFF's reduced-resolution levels (formats/ometiff/oneframe.go in v0.6).
|
Package oneframe provides shared infrastructure for reading "single big JPEG, virtualised into tile cells" pyramid pages — used by NDPI's non-tiled levels (formats/ndpi/oneframe.go pre-v0.6) and OME-TIFF's reduced-resolution levels (formats/ometiff/oneframe.go in v0.6). |
|
tiff
Package tiff parses a minimal subset of the TIFF file format sufficient to locate compressed tile byte ranges for whole-slide imaging TIFFs.
|
Package tiff parses a minimal subset of the TIFF file format sufficient to locate compressed tile byte ranges for whole-slide imaging TIFFs. |
|
tifflzw
Package tifflzw implements the Lempel-Ziv-Welch compressed data format as used by the TIFF file format, including the "off by one" code-width transition that makes TIFF LZW incompatible with stdlib compress/lzw.
|
Package tifflzw implements the Lempel-Ziv-Welch compressed data format as used by the TIFF file format, including the "off by one" code-width transition that makes TIFF LZW incompatible with stdlib compress/lzw. |
|
opentile
|
|
|
opentiletest
Package opentiletest provides test helpers for opentile consumers and the library's own internal tests.
|
Package opentiletest provides test helpers for opentile consumers and the library's own internal tests. |
|
Package resample provides pure-Go pixel resamplers operating on decoder.Image.
|
Package resample provides pure-Go pixel resamplers operating on decoder.Image. |
|
Package tests contains integration test helpers and fixture schemas shared between integration and fixture-generation tests.
|
Package tests contains integration test helpers and fixture schemas shared between integration and fixture-generation tests. |
|
download
command
download fetches openslide's public test slides into OPENTILE_TESTDIR.
|
download fetches openslide's public test slides into OPENTILE_TESTDIR. |