{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "2c76ba66", "metadata": {}, "outputs": [], "source": [ "using SPECTrecon: imrotate1, imrotate1_adj\n", "using SPECTrecon: imrotate2, imrotate2_adj\n", "using MIRTjim: jim\n", "using ImageTransformations: imrotate, Linear\n", "using Plots: savefig" ] }, { "cell_type": "code", "execution_count": null, "id": "65ee8fb4", "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "`imrotate1` visualization\n", "\"\"\"\n", "T = Float32\n", "N = 100\n", "img = zeros(T, N, N)\n", "img[30:50, 20:60] .= 1\n", "\n", "θ = 3*π/16\n", "my = imrotate1(img, θ)\n", "julia = imrotate(img, -θ, axes(img), method = Linear(), fill = 0)\n", "diff1 = my - julia\n", "\n", "my_adj = imrotate1_adj(img, θ)\n", "julia_adj = imrotate(img, θ, axes(img), method = Linear(), fill = 0)\n", "diff1_adj = my_adj - julia_adj\n", "\n", "jim(jim(my, \"my\"), jim(julia, \"julia\"), jim(diff1, \"diff1\"),\n", " jim(my_adj, \"my_adj\"), jim(julia_adj, \"julia_adj\"), jim(diff1_adj, \"diff1_adj\"))\n", "# savefig()" ] }, { "cell_type": "code", "execution_count": null, "id": "0f49f81e", "metadata": {}, "outputs": [], "source": [ "\"\"\"\n", "`imrotate2` visualization\n", "\"\"\"\n", "T = Float32\n", "N = 100\n", "img = zeros(T, N, N)\n", "img[30:50, 20:60] .= 1\n", "\n", "θ = 3*π/16\n", "my = imrotate2(img, θ)\n", "julia = imrotate(img, -θ, axes(img), method = Linear(), fill = 0)\n", "diff2 = my - julia\n", "\n", "my_adj = imrotate2_adj(img, θ)\n", "julia_adj = imrotate(img, θ, axes(img), method = Linear(), fill = 0)\n", "diff2_adj = my_adj - julia_adj\n", "\n", "jim(jim(my, \"my\"), jim(julia, \"julia\"), jim(diff2, \"diff1\"),\n", " jim(my_adj, \"my_adj\"), jim(julia_adj, \"julia_adj\"), jim(diff2_adj, \"diff1_adj\"))\n", "# savefig()" ] }, { "cell_type": "code", "execution_count": null, "id": "04ce238e", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.6.3", "language": "julia", "name": "julia-1.6" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.6.3" } }, "nbformat": 4, "nbformat_minor": 5 }