kip - Common {i}mage {p}rocessing with {K}otlin
A concise DSL to perform common image processing tasks using Kotlin
Features
- Fully typed method signatures
- Concise and easy to read
- Excellent tooling, interactive REPL and IDE support
- Extension methods only, no new types
- Sensible default parameters where possible
- Immutable (for now)
- Ready for jupyter
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
- Median Filter
- Gauss Filter
- Inversion
Segmentation
- Threshold
- Labeling
Still missing but on our list (drop us a ticket if needed)
- Morphologial Ops (Erode, Dilate, Open, Close)
- Projections
- Scalar Arithmetics
- Slicing
- Watershed
- TopHat Filter
Meanwhile you can for sure mix ops
or imglib2
api directly
Next steps
- Add remaining operators from CIP
- Provide kscript and jupyter example notebooks
- port some examples from here to
kip
Acknowledgments
We stole most bits and pieces from CIP
Also thanks to the imglib2 gitter community.