<jupyter_start><jupyter_text>ntakt coordinate transformsImgLib2 exposes a powerful API to transform the coordinates of an image (or other data structures with coordinates). ntakt adds extensions to facilitate easy access to this API.<jupyter_code>// set up dependencies
// use local maven repository; not yet deployed to remote maven repositories.
@file:Repository("*mavenLocal")
@file:Repository("https://maven.scijava.org/content/groups/public")

// uncomment to search in your local maven repo
// requires installation into local maven repository (./gradlew build publishToMavenLocal)
// @file:DependsOn("org.ntakt:ntakt:0.1.0-SNAPSHOT")

// uncomment to search in jitpack
@file:DependsOn("org.ntakt:ntakt:main-SNAPSHOT")

@file:DependsOn("sc.fiji:bigdataviewer-vistools:1.0.0-beta-21")
%use lets-plot
import bdv.util.BdvFunctions
import bdv.util.BdvOptions
import kotlin.random.Random
import net.imglib2.realtransform.AffineTransform2D
import org.ntakt.*
val rng = Random(100L)
val img = ntakt.doubles(200, 300) { idx -> idx.toDouble() + 100 * rng.nextDouble() }
val rotation = AffineTransform2D().also {
    it.translate(-100.0, -150.0)
    it.rotate(-3 * PI / 4.0)
    it.translate(100.0, 150.0)
}
val transformedBoundingBox = img.transformBoundingBox(rotation).smallestsContaining
val rotated = img.extendZero().interpolatedNLinear.transform(rotation)
val bdv = img.show("img", BdvOptions.options().is2D())
rotated.show("rotated", bdv=bdv, interval=transformedBoundingBox)
null<jupyter_output>[0.0, 0.0] [64.64466094067261, 326.7766952966369]
[199.0, 0.0] [-76.06958851545035, 186.06244584051393]
[0.0, 299.0] [276.06958851545033, 115.3517677218592]
[199.0, 299.0] [135.35533905932738, -25.36248173426378]
{'fraction_non_alphanumeric': 0.1314252336448598, 'fraction_numerical': 0.11623831775700935, 'mean_word_length': 5.588461538461538, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '30396', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 732, 'n_tokens_neox': 606, 'n_words': 133, 'path': 'notebooks/examples/02_coordinate-transformations.ipynb', 'repo_name': 'cmhulbert/imklib2', 'size': '1712'}