mucog

package module
v0.0.0-...-3f9e26c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDX_IMAGE int = iota // TopLevel IFD/Dataset
	IDX_LEVEL            // Full + Overviews ie 0: Full, 1:N: Overviews/Reduced image
	IDX_TILE             // Block/Chunk
	IDX_PLANE            // Bands
	KEY_IMAGE = "I"
	KEY_LEVEL = "L"
	KEY_TILE  = "T"
	KEY_PLANE = "P"
)
View Source
const (
	MIN_X int = iota
	MAX_X
	MIN_Y
	MAX_Y
)
View Source
const (
	SubfileTypeImage        = 0
	SubfileTypeReducedImage = 1
	SubfileTypePage         = 2
	SubfileTypeMask         = 4
)
View Source
const (
	PlanarConfigurationContig   = 1
	PlanarConfigurationSeparate = 2
)
View Source
const (
	PredictorNone          = 1
	PredictorHorizontal    = 2
	PredictorFloatingPoint = 3
)
View Source
const (
	SampleFormatUInt          = 1
	SampleFormatInt           = 2
	SampleFormatIEEEFP        = 3
	SampleFormatVoid          = 4
	SampleFormatComplexInt    = 5
	SampleFormatComplexIEEEFP = 6
)
View Source
const (
	ExtraSamplesUnspecified = 0
	ExtraSamplesAssocAlpha  = 1
	ExtraSamplesUnassAlpha  = 2
)
View Source
const (
	PhotometricInterpretationMinIsWhite = 0
	PhotometricInterpretationMinIsBlack = 1
	PhotometricInterpretationRGB        = 2
	PhotometricInterpretationPalette    = 3
	PhotometricInterpretationMask       = 4
	PhotometricInterpretationSeparated  = 5
	PhotometricInterpretationYCbCr      = 6
	PhotometricInterpretationCIELab     = 8
	PhotometricInterpretationICCLab     = 9
	PhotometricInterpretationITULab     = 10
	PhotometricInterpretationLOGL       = 32844
	PhotometricInterpretationLOGLUV     = 32845
)
View Source
const (
	MUCOGPattern         = "L=0>T>I>P;L=1:>I>T>P" // Full resolution is temporally interlaced, overviews are geographically interlaced
	MUCOGTemporalPattern = "L>T>I>P"              // All levels are temporally interlaced
)
View Source
const (
	TByte      = 1
	TAscii     = 2
	TShort     = 3
	TLong      = 4
	TRational  = 5
	TSByte     = 6
	TUndefined = 7
	TSShort    = 8
	TSLong     = 9
	TSRational = 10
	TFloat     = 11
	TDouble    = 12
	TLong8     = 16
	TSLong8    = 17
	TIFD8      = 18
)

Variables

View Source
var Names = []string{"Image", "Level", "Tile", "Plane"}

Functions

func DecodePair

func DecodePair(p int) (int32, int32)

DecodePair retrieves x, y from an encoded pair

func EncodePair

func EncodePair(x, y int32) int

EncodePair creates an int from x, y coordinates

Types

type ExtraSamples

type ExtraSamples uint16

type IFD

type IFD struct {
	//Any field added here should also be accounted for in WriteIFD and ifd.Fieldcount
	SubfileType               uint32   `tiff:"field,tag=254"`
	ImageWidth                uint64   `tiff:"field,tag=256"`
	ImageLength               uint64   `tiff:"field,tag=257"`
	BitsPerSample             []uint16 `tiff:"field,tag=258"`
	Compression               uint16   `tiff:"field,tag=259"`
	PhotometricInterpretation uint16   `tiff:"field,tag=262"`
	DocumentName              string   `tiff:"field,tag=269"`
	SamplesPerPixel           uint16   `tiff:"field,tag=277"`
	PlanarConfiguration       uint16   `tiff:"field,tag=284"`
	DateTime                  string   `tiff:"field,tag=306"`
	Predictor                 uint16   `tiff:"field,tag=317"`
	Colormap                  []uint16 `tiff:"field,tag=320"`
	TileWidth                 uint16   `tiff:"field,tag=322"`
	TileLength                uint16   `tiff:"field,tag=323"`
	OriginalTileOffsets       []uint64 `tiff:"field,tag=324"`
	NewTileOffsets64          []uint64
	NewTileOffsets32          []uint32
	TempTileByteCounts        []uint64 `tiff:"field,tag=325"`
	TileByteCounts            []uint32
	SubIFDOffsets             []uint64 `tiff:"field,tag=330"`
	ExtraSamples              []uint16 `tiff:"field,tag=338"`
	SampleFormat              []uint16 `tiff:"field,tag=339"`
	JPEGTables                []byte   `tiff:"field,tag=347"`

	ModelPixelScaleTag     []float64 `tiff:"field,tag=33550"`
	ModelTiePointTag       []float64 `tiff:"field,tag=33922"`
	ModelTransformationTag []float64 `tiff:"field,tag=34264"`
	GeoKeyDirectoryTag     []uint16  `tiff:"field,tag=34735"`
	GeoDoubleParamsTag     []float64 `tiff:"field,tag=34736"`
	GeoAsciiParamsTag      string    `tiff:"field,tag=34737"`
	GDALMetaData           string    `tiff:"field,tag=42112"`
	LERCParams             []uint32  `tiff:"field,tag=50674"`
	RPCs                   []float64 `tiff:"field,tag=50844"`

	NoData string `tiff:"field,tag=42113"`

	SubIFDs []*IFD

	ZoomLevel int
	// contains filtered or unexported fields
}

func LoadTIFF

func LoadTIFF(tif tiff.TIFF) ([]*IFD, error)

func (*IFD) AddOverview

func (ifd *IFD) AddOverview(ovr *IFD)

type Iterator

type Iterator interface {
	// ID returns the identifier of the iterator
	ID() int
	// Init resets the iterator and initializes indices[ID()] with the pointer on the current value (updated when Next() is called, invalid if Next()==False)
	Init(indices []*int)
	// Next updates the current value and returns True, or False if the iteration is finished.
	Next() bool
}

Iterator on integers with an Identifier Usage: var it Iterator var indices = []*int

for it.Init(indices); it.Next(); {
  fmt.Printf("It[%d] = %d", it.ID(), *pval)
}

func NewRangeIterator

func NewRangeIterator(id, start, end int) Iterator

NewRangeIterator creates an Iterator on a range of values from start to end (included)

func NewTileIterator

func NewTileIterator(id int, levelMinMaxBlock [][4]int32) Iterator

NewTileIterator creates an Iterator on the blocks of an overview level.

func NewValuesIterator

func NewValuesIterator(id int, values []int) Iterator

NewValuesIterator creates an Iterator on a slice of values

type Iterators

type Iterators [4]Iterator

func InitIterators

func InitIterators(pattern string, nbImages, nbPlanes int, levelMinMaxBlock [][4]int32) ([]*Iterators, error)

func NewIteratorsFromString

func NewIteratorsFromString(s string, nbImages, nbPlanes int, levelMinMaxBlock [][4]int32) (*Iterators, error)

func (Iterators) Check

func (its Iterators) Check() error

type MultiCOG

type MultiCOG struct {
	// contains filtered or unexported fields
}

func New

func New() *MultiCOG

func (*MultiCOG) AppendIFD

func (cog *MultiCOG) AppendIFD(ifd *IFD)

func (*MultiCOG) Write

func (cog *MultiCOG) Write(out io.Writer, bigtiff bool, pattern string) error

* Write multiCOG to a mucog

  • Parameters "pattern" defines how to interlace the [I]mages (TopLevel IFD/dataset) the [P]lanes (bands), the [L]evel (zooms/overview/reduced image) and the [T]iles (geotiff blocks). *
  • Common patterns:
  • MUCOGPattern = "L=0>T>I>P;L=1:>I>T>P" // Full resolution tiles are temporally interlaced, overview tiles are geographically interlaced
  • MUCOGTemporalPattern = "L>T>I>P" // For each level, tiles are temporally interlaced *
  • Advanced patterns:
  • The four levels of interlacing must be prioritized in the following way L1>L2>L3>L4 where each L is in [I, P, L, T]. This order should be understood as:
  • for each L1:
  • for each L2:
  • for each L3:
  • for each L4:
  • addBlock(L1, L2, L3, L4)
  • In other words, all L4 for a given (L1, L2, L3) will be contiguous in memory.
  • For example:
  • - To optimize the access to timeseries of all the planes (such as in MUCOG): L>T>I>P => For a given zoom level and tile, all the images will be contiguous.
  • - To optimize the access to geographical information of all the planes (such as in COG) : I>L>T>P => For a given image, zoom level and tile, all the planes will be contiguous.
  • - To optimize the access to geographical information of one plane at a time : P>I>L>T => For a given plane, image and zoom level, all the tiles will be contiguous. *
  • Interlacing pattern can be specialized to only select a list or a range for each level (except Tile level).
  • - By values: L=0,2,3 will only select the value 0, 2 and 3 of the level L. For example P=0,2,3 to select the corresponding planes.
  • - By range: L=0:3 will only select the values from 0 to 3 (not included) of the level L. For example P=0:3 to select the first three planes.
  • First and last values of the range can be omitted to define 0 or last element of the level. e.g P=2: means all the planes from the second.
  • L=0 is the full resolution, L=1 is the first overview (usually: zoom factor=2), L=2 is the second overiew (usually: zoom factor=4), and so on. *
  • To chain interlacing patterns, use ";" separator. *
  • For example:
  • - Optimize access to timeseries for full resolution (L=0), but geographic for overviews (L=1:). L=0>T>I>P;L=1:>I>T>P
  • - Same example, but the planes are separated: P>L=0>T>I;P>L=1:>I>T
  • - To optimize access to geographic information of the three first planes together, but timeseries of the others: L>T>I>P=0:3;P=3:>L>I>T *
  • There is no validation that the pattern includes all the tiles (the others will be lost, e.g. L=0>T>I>P removes all the overviews), neither that the pattern has duplicated tiles (unpredictable behavior: e.g. L>T>I>P=0;L>T>I>P=0:2 : P=0 is duplicated).

type PhotometricInterpretation

type PhotometricInterpretation uint16

type PlanarConfiguration

type PlanarConfiguration uint16

type Predictor

type Predictor uint16

type RangeIterator

type RangeIterator struct {
	Start, End int
	// contains filtered or unexported fields
}

RangeIterator implements Iterator on a range of values from start to end (included)

func (*RangeIterator) ID

func (it *RangeIterator) ID() int

func (*RangeIterator) Init

func (it *RangeIterator) Init(indices []*int)

func (*RangeIterator) Next

func (it *RangeIterator) Next() bool

type SampleFormat

type SampleFormat uint16

type SubfileType

type SubfileType uint32

type TagData

type TagData struct {
	bytes.Buffer
	Offset uint64
}

func (*TagData) NextOffset

func (t *TagData) NextOffset() uint64

type TileIterator

type TileIterator struct {
	// contains filtered or unexported fields
}

TileIterator creates an Iterator on the tiles of an overview level.

func (*TileIterator) ID

func (it *TileIterator) ID() int

func (*TileIterator) Init

func (it *TileIterator) Init(indices []*int)

Init returns a pointer on an encoded value of the block indices (see DecodePair to get x, y)

func (*TileIterator) Next

func (it *TileIterator) Next() bool

type ValuesIterator

type ValuesIterator struct {
	Values []int
	// contains filtered or unexported fields
}

ValuesIterator implements Iterator on a slice of values

func (*ValuesIterator) ID

func (it *ValuesIterator) ID() int

func (*ValuesIterator) Init

func (it *ValuesIterator) Init(indices []*int)

func (*ValuesIterator) Next

func (it *ValuesIterator) Next() bool

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL