holgerbrandl / kip

Image processing DSL written in Kotlin
9 stars 0 forks source link
datascience imglib2 kotlin

kip - Common {i}mage {p}rocessing with {K}otlin

A concise DSL to perform common image processing tasks using Kotlin

Features

Examples

import de.mpicbg.scicomp.kip.*
import net.imglib2.type.numeric.real.FloatType

val image = bubbles()
val other = bubbles()

// image arithmetics
val imageDiff = image + other
val imageProp = image / other

// number arithmethics
val imageDiff = image - 3

// display as usual
image.show()

// save to file
image.save("my_image.png")

// open from file
val blobs = openImage<FloatType>("images/blobs32.tif")
//val image2 = openImage<FloatType>("/Users/brandl/projects/kotlin/kip/images/blobs32.tif")

// little helpers to ease some of the API pain
image.dim()

// misc operators to transform images

// default parameters which are also named parameters
val medianImage = image.median(listOf(10f,10f), shape = Shape.disk)

// method chaining
image.gauss().show()
image.gauss().median().apply{ save("some.png") }.show()

// segmentation & labeling
 val labelImage = bubbles()
    .gauss(10)
    .showThen()
    .threshold(0.3f)
    .invert()
    .showThen()
    .label()

labelImage.show()

Methods

Filters

Segmentation

Still missing but on our list (drop us a ticket if needed)

Meanwhile you can for sure mix ops or imglib2 api directly

Next steps

Acknowledgments

We stole most bits and pieces from CIP

Also thanks to the imglib2 gitter community.