{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "735ff639-5973-4493-bca8-db49f7b91209", "metadata": {}, "outputs": [], "source": [ "import qim3d\n", "import os\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 3, "id": "16f0056a-83a3-4741-8386-1d20fa2e190e", "metadata": {}, "outputs": [], "source": [ "# Define the base directory and file name\n", "base_dir = '/data/cinemax/wood/wood_Zoom_polaris'\n", "file_name = 'wood_32.tiff'" ] }, { "cell_type": "code", "execution_count": 4, "id": "1fe8809c-db81-421c-8e44-089ae33fb85c", "metadata": {}, "outputs": [], "source": [ "# Construct the full file path\n", "file_path = os.path.join(base_dir, file_name)" ] }, { "cell_type": "code", "execution_count": 10, "id": "af53a518-4583-4def-ad67-27b6a136e3ef", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "67b7c3ed50e649ce81bfe74f01580534", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Loading: 0%| | 0.00B/258MB [00:00 2\u001b[0m middle_slice \u001b[38;5;241m=\u001b[39m val\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m2\u001b[39m] \u001b[38;5;241m/\u001b[39m\u001b[38;5;241m/\u001b[39m \u001b[38;5;241m2\u001b[39m\n\u001b[1;32m 3\u001b[0m plt\u001b[38;5;241m.\u001b[39mfigure(figsize\u001b[38;5;241m=\u001b[39m(\u001b[38;5;241m12\u001b[39m, \u001b[38;5;241m10\u001b[39m))\n\u001b[1;32m 4\u001b[0m plt\u001b[38;5;241m.\u001b[39mimshow(val[:, :, middle_slice, \u001b[38;5;241m0\u001b[39m], cmap\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mviridis\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", "\u001b[0;31mNameError\u001b[0m: name 'val' is not defined" ] } ], "source": [ "# Display the middle slice of the eigenvalue volume\n", "middle_slice = val.shape[2] // 2\n", "plt.figure(figsize=(12, 10))\n", "plt.imshow(val[:, :, middle_slice, 0], cmap='viridis')\n", "plt.colorbar()\n", "plt.title(f'First Eigenvalue (Middle Slice: {middle_slice})')\n", "plt.show()\n", "\n", "# Display the middle slice of the original volume\n", "plt.figure(figsize=(12, 10))\n", "plt.imshow(vol[:, :, middle_slice], cmap='gray')\n", "plt.colorbar()\n", "plt.title(f'Original Volume (Middle Slice: {middle_slice})')\n", "plt.show()\n", "\n", "# Error handling\n", "try:\n", " # Your code here\n", " pass\n", "except FileNotFoundError:\n", " print(f\"Error: File not found at {file_path}\")\n", " print(\"Please check if the file exists and the path is correct.\")\n", " " ] }, { "cell_type": "code", "execution_count": null, "id": "c9af27d8-e309-4446-894b-982adef96440", "metadata": {}, "outputs": [], "source": [ " # List contents of the directory to help debugging\n", " try:\n", " print(f\"\\nContents of {base_dir}:\")\n", " for item in os.listdir(base_dir):\n", " print(item)\n", " except Exception as e:\n", " print(f\"Could not list directory contents: {e}\")\n", "\n", "except AttributeError as e:\n", " print(f\"Error: {e}\")\n", " print(\"This might be due to an incompatibility with the qim3d version you're using.\")\n", " print(\"Please check the qim3d documentation for the correct usage of structure_tensor function.\")\n", "\n", "except Exception as e:\n", " print(f\"An unexpected error occurred: {e}\")\n", "\n", "print(f\"\\nQIM3D version: {qim3d.__version__}\")" ] }, { "cell_type": "code", "execution_count": 15, "id": "b47fb9e3-3cd0-4354-aa6e-116300575f99", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "b2a68c5b002743419402fea3f69eb8f5", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Loading: 0%| | 0.00B/258MB [00:00