{ "cells": [ { "cell_type": "markdown", "id": "91860fae-a8ce-4c4d-9687-15f41bd9023b", "metadata": {}, "source": [ "# Atlas Free Slice Alignment Example" ] }, { "cell_type": "markdown", "id": "8204ee94-b057-4e08-8386-468edbc17e04", "metadata": {}, "source": [ "The below cells show an example use case of the atlas-free slice alignment package." ] }, { "cell_type": "code", "execution_count": null, "id": "d87cc448-5903-437f-bc1b-f6c5dc80d103", "metadata": {}, "outputs": [], "source": [ "import os\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": null, "id": "dcfcc4c2-674e-4aaf-a8d4-d8b003c17b26", "metadata": { "scrolled": true }, "outputs": [], "source": [ "# Location of the script on your local device\n", "script_path = '/home/abenneck/Desktop/atlas_free_slice_alignment/slice_alignment.py'\n", "cmd_str = f'python3 {script_path}'\n", "\n", "# Directory where all outputs should be stored\n", "outdir = '/home/abenneck/Desktop/atlas_free_slice_alignment_outputs'\n", "cmd_str += f' {outdir}'\n", "\n", "# Directory containing all files to be registered + the relevant fnames\n", "indir = '/home/abenneck/Desktop/atlas_free_slice_alignment/images'\n", "filesmoon=['frame_1_delay-0.2s[1].png','frame_0_delay-0.2s[1].png','frame_0_delay-0.2s[1].png','frame_1_delay-0.2s[1].png','frame_2_delay-0.2s[1].png','frame_3_delay-0.2s[1].png','frame_4_delay-0.2s[1].png','frame_5_delay-0.2s[1].png','frame_6_delay-0.2s[1].png','frame_7_delay-0.2s[1].png','frame_7_delay-0.2s[1].png','frame_6_delay-0.2s[1].png']\n", "cmd_str += ' -fnames'\n", "for fname in filesmoon:\n", " fname = os.path.join(indir, fname)\n", " cmd_str += f' {fname}'\n", "\n", "# NOTE: All of the scalar and torch-specific arguments are not included in this example\n", "\n", "# Include boolean flag for removing artifacts in input images\n", "cmd_str += ' --remove_artifacts'\n", "\n", "# Include boolean flag for saving all figures\n", "cmd_str += ' --saveAllFigs'\n", "\n", "print(cmd_str)\n", "os.system(cmd_str)\n", "plt.close('all')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }