image

package
v0.0.0-...-040724e Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: BSD-3-Clause, GPL-2.0, BSD-3-Clause, + 1 more Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// White is a color.RGBA representation of the colour white
	White = color.RGBA{R: uint8(242), G: uint8(243), B: uint8(242), A: uint8(255)}
	// Black is a color.RGBA representation of the colour black
	Black = color.RGBA{R: uint8(0), G: uint8(0), B: uint8(0), A: uint8(255)}
	// Transparent is a color.RGBA representation of a nil colour.
	Transparent = color.RGBA{R: uint8(0), G: uint8(0), B: uint8(0), A: uint8(0)}
)
View Source
var AllResampleFilters = map[string]imaging.ResampleFilter{
	"Cosine":            imaging.Cosine,
	"Welch":             imaging.Welch,
	"Blackman":          imaging.Blackman,
	"Hamming":           imaging.Hamming,
	"Hann":              imaging.Hann,
	"Lanczos":           imaging.Lanczos,
	"Bartlett":          imaging.Bartlett,
	"Guassian":          imaging.Gaussian,
	"BSpline":           imaging.BSpline,
	"CatmullRom":        imaging.CatmullRom,
	"MitchellNetravali": imaging.MitchellNetravali,
	"Hermite":           imaging.Hermite,
	"Linear":            imaging.Linear,
	"Box":               imaging.Box,
	"NearestNeighbour":  imaging.NearestNeighbor,
}

AllResampleFilters are the resample filters from disintegration package

Functions

func AvailableComponentMaps

func AvailableComponentMaps() map[string]map[color.Color]string

AvailableComponentMaps returns available palettes in a map.

func AvailablePalettes

func AvailablePalettes() map[string]color.Palette

AvailablePalettes returns all the (hardcoded) palettes in the library. The keys are the pallette names.

func CheckAllResizeAlgorithms

func CheckAllResizeAlgorithms(img goimage.Image, plate *wtype.Plate, rotate bool, algorithms map[string]imaging.ResampleFilter) []*goimage.NRGBA

CheckAllResizeAlgorithms resizes an image using a variety of different algorithms.

func ColourComponentMap

func ColourComponentMap() map[color.Color]string

ColourComponentMap is a map of RGB colour to description for use as key in crossreferencing colour to component in other maps.

func ColourToCMYK

func ColourToCMYK(colour color.Color) (cmyk color.CMYK)

ColourToCMYK converts a color to color.CYMK

func ColourToGrayscale

func ColourToGrayscale(colour color.Color) (gray color.Gray)

ColourToGrayscale converts a color to color.Gray

func Export

func Export(img image.Image, fileName string) (file wtype.File, err error)

Export exports an image to file. The image format is derived from the filename extension.

func MakeGreyScalePalette

func MakeGreyScalePalette() []color.Color

MakeGreyScalePalette returns a palette of grey shades

func MakePaletteFromImage

func MakePaletteFromImage(img goimage.Image, plate *wtype.Plate, rotate bool) color.Palette

MakePaletteFromImage will make a color Palette from an image resized to fit a given plate type.

func MakeSmallPaletteFromImage

func MakeSmallPaletteFromImage(img goimage.Image, plate *wtype.Plate, rotate bool) color.Palette

MakeSmallPaletteFromImage will make a color Palette from an image resized to fit a given plate type using Plan9 Palette

func MakeSubMapFromMap

func MakeSubMapFromMap(colourMap map[color.Color]string, colourNames []string) map[color.Color]string

MakeSubMapFromMap extracts colors from a color library Given colour names. Bad name.

func MakeSubPalette

func MakeSubPalette(paletteName string, colourNames []string) color.Palette

MakeSubPalette extracts colors from a palette given a slice of colour names.

func OpenFile

func OpenFile(file wtype.File) (*image.NRGBA, error)

OpenFile takes a wtype.File and returns its contents as image.NRGBA

func OpenGIF

func OpenGIF(file wtype.File) (*gif.GIF, error)

OpenGIF takes a wtype.File and returns its contents as a gif.GIF

func ParseGIF

func ParseGIF(source *gif.GIF, frameNum []int) (imgs []*image.NRGBA, err error)

ParseGIF extracts frames from a GIF object as an array of images

func Posterize

func Posterize(img image.Image, levels int) (*image.NRGBA, error)

Posterize posterizes an image. This refers to changing an image to use only a small number of different tones.

func PrintFPImagePreview

func PrintFPImagePreview(img goimage.Image, plate *wtype.Plate, rotate bool, visiblemap, uvmap map[color.Color]string)

PrintFPImagePreview takes an image, plate type, and colors from visiblemap/uvmap and (use to) save the resulting processed image.

func RemoveDuplicatesKeysFromMap

func RemoveDuplicatesKeysFromMap(elements map[string]color.Color) map[string]color.Color

RemoveDuplicatesKeysFromMap will loop over a map of colors to find and delete duplicates. Entries with duplicate keys are deleted.

func RemoveDuplicatesValuesFromMap

func RemoveDuplicatesValuesFromMap(elements map[string]color.Color) map[string]color.Color

RemoveDuplicatesValuesFromMap will loop over a map of colors to find and delete duplicates. Entries with duplicate values are deleted.

func ResizeImageToPlate

func ResizeImageToPlate(img goimage.Image, plate *wtype.Plate, algorithm imaging.ResampleFilter, rotate bool) *goimage.NRGBA

ResizeImageToPlate resizes an image to fit the number of wells on a plate. We treat wells as pixels. Bad name.

func ResizeImageToPlateAutoRotate

func ResizeImageToPlateAutoRotate(img goimage.Image, plate *wtype.Plate, algorithm imaging.ResampleFilter) *goimage.NRGBA

ResizeImageToPlateAutoRotate resizes an image to fit the number of wells on a plate and if the image is in portrait the image will be rotated by 270 degrees to optimise resolution on the plate.

func ResizeImageToPlateMin

func ResizeImageToPlateMin(img goimage.Image, plate *wtype.Plate) *goimage.NRGBA

ResizeImageToPlateMin is a minimalist resize function. Uses Lanczos resampling, which is the best but slowest method.

func SelectColor

func SelectColor(colID string) color.Color

SelectColor returns the desired color from a string ID

func SelectLibrary

func SelectLibrary(libID string) (palette color.Palette)

SelectLibrary will select a hardcoded set of colors and return them as a palette object

func ToPlateLayout

func ToPlateLayout(img goimage.Image, plate *wtype.Plate, palette *color.Palette, rotate bool, autoRotate bool) (map[string]color.Color, *goimage.NRGBA)

ToPlateLayout takes an image, plate type, and palette and returns a map of well position to colors. Creates a map of pixel to plate position from processing a given image with a chosen colour palette. It's recommended to use at least 384 well plate. If autorotate == true, rotate is overridden

func VisibleEquivalentMaps

func VisibleEquivalentMaps() map[string]map[color.Color]string

VisibleEquivalentMaps returns just the proteinPaintboxUV color map

Types

type AnthaColor

type AnthaColor struct {
	Color     color.NRGBA
	Component *wtype.Liquid
}

An AnthaColor represents a color linked to an LHComponent

type AnthaImg

type AnthaImg struct {
	Plate   *wtype.Plate
	Pix     []AnthaPix
	Palette AnthaPalette
}

An AnthaImg represents an image where pixels are linked

func MakeAnthaImg

func MakeAnthaImg(goImg goimage.Image, anthaPalette *AnthaPalette, anthaImgPlate *wtype.Plate) (outputImg *AnthaImg, resizedImg *goimage.NRGBA)

MakeAnthaImg will create an AnthaImage object from a digital image.

type AnthaPalette

type AnthaPalette struct {
	AnthaColors []AnthaColor
	Palette     color.Palette
}

An AnthaPalette is an array of anthaColors

func MakeAnthaPalette

func MakeAnthaPalette(palette color.Palette, components []*wtype.Liquid) *AnthaPalette

MakeAnthaPalette will make a palette of Colors linked to LHcomponents. They are merged according to their order in the slice

func (AnthaPalette) CheckPresence

func (p AnthaPalette) CheckPresence(c AnthaColor) bool

CheckPresence returns a bool indicating if the AnthaColor is already in the AnthaPalette

func (AnthaPalette) Convert

func (p AnthaPalette) Convert(c color.Color) AnthaColor

Convert returns the AnthaPalette AnthaColor closest to c in Euclidean R,G,B space.

func (AnthaPalette) Index

func (p AnthaPalette) Index(c color.Color) int

Index finds the closest color in an anthapalette and returns the index for the anthacolor

type AnthaPix

type AnthaPix struct {
	Color    AnthaColor
	Location wtype.WellCoords
}

An AnthaPix is a pixel linked to an anthaColor, and thereby an LHComponent

type LivingColor

type LivingColor struct {
	ID        string
	Color     color.NRGBA
	Seq       wtype.DNASequence
	Component *wtype.Liquid
}

A LivingColor links a color to physical information such as DNASequence and LHcomponent

func MakeLivingColor

func MakeLivingColor(ctx context.Context, ID string, color *color.NRGBA, seq string) (livingColor *LivingColor)

MakeLivingColor is an object constructor for a LivingColor with default settings

func SelectLivingColor

func SelectLivingColor(ctx context.Context, colID string) LivingColor

SelectLivingColor will return a LivingColor given its ID

type LivingGIF

type LivingGIF struct {
	Frames []LivingImg
}

A LivingGIF is a representation of a GIF linked to biological data

func MakeLivingGIF

func MakeLivingGIF(imgs []LivingImg) *LivingGIF

MakeLivingGIF makes a LivingGIF object given a slice of LivingImg

func (LivingGIF) GetStates

func (g1 LivingGIF) GetStates() [][]string

GetStates returns an array of unique state changes in a LivingGIF

type LivingImg

type LivingImg struct {
	Plate   wtype.Plate
	Pix     []LivingPix
	Palette LivingPalette
}

A LivingImg is a representation of an image linked to biological data

func MakeLivingImg

func MakeLivingImg(goImg goimage.Image, livingPalette *LivingPalette, livingImgPlate *wtype.Plate) (outputImg *LivingImg, resizedImg goimage.Image)

MakeLivingImg will create a LivingImage object from a digital image.

type LivingPalette

type LivingPalette struct {
	LivingColors []LivingColor
}

A LivingPalette holds an array of LivingColors

func MakeLivingPalette

func MakeLivingPalette(palette LivingPalette, components []*wtype.Liquid) *LivingPalette

MakeLivingPalette will make a palette of LivingColors linked to LHcomponents. They are merged according to their order in the slice

func SelectLivingColorLibrary

func SelectLivingColorLibrary(ctx context.Context, libID string) (palette LivingPalette)

SelectLivingColorLibrary will return a the desired set of livingcolors given an ID

func (LivingPalette) CheckPresence

func (p LivingPalette) CheckPresence(c LivingColor) bool

CheckPresence returns a bool indicating if the LivingColor is already in the LivingPalette

func (LivingPalette) Convert

func (p LivingPalette) Convert(c color.Color) LivingColor

Convert returns the LivingPalette LivingColor closest to c in Euclidean R,G,B space.

func (LivingPalette) Index

func (p LivingPalette) Index(c color.Color) int

Index finds the closest color in a LivingPalette and returns the index for the LivingPalette

type LivingPix

type LivingPix struct {
	Color    LivingColor
	Location wtype.WellCoords
}

A LivingPix represents a pixel along with well coordinate

func (LivingPix) Compare

func (p1 LivingPix) Compare(p2 LivingPix) (same bool)

Compare returns a bool indicating if the LivingPixel is the same as the given one

Jump to

Keyboard shortcuts

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