Skip to content

Commit

Permalink
updated: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rraadd88 committed Nov 29, 2023
1 parent ec66670 commit 271b60a
Show file tree
Hide file tree
Showing 5 changed files with 1,005 additions and 77 deletions.
220 changes: 220 additions & 0 deletions examples/filter_image_by_intensity.ipynb

Large diffs are not rendered by default.

117 changes: 114 additions & 3 deletions examples/io_read_nd2.ipynb → examples/io_read_nd2_2d.ipynb
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,138 @@
"f1 = nd2.ND2File(input_path)"
]
},
{
"cell_type": "markdown",
"id": "1f85bab5-664c-4a43-9aa9-7dbd34676234",
"metadata": {
"tags": []
},
"source": [
"## Image info"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "94298d6c-e340-46e9-87dd-3ff4a68e2430",
"id": "f4fc8d29-ad63-4140-91b3-03c47b92b114",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [],
"source": [
"print(('\\n'+'-'*50+'\\n').join([f\"{k}\\n{'-'*50}\\n{v}\" for k,v in f1.text_info.items()]))"
]
},
{
"cell_type": "markdown",
"id": "a6c1c95c-61cd-43f9-9057-051d11fe7305",
"metadata": {},
"source": [
"### Dimensions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "73e6b318-a1f7-4ddf-a547-95aa7a370c27",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"print(f1.sizes)"
]
},
{
"cell_type": "markdown",
"id": "a7d88097-2221-4a38-9b23-bbbbf37fb66e",
"metadata": {},
"source": [
"### Channel names"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12d13301-abe6-4233-86f6-8b18b48b975b",
"metadata": {
"papermill": {
"duration": 0.007727,
"end_time": "2023-11-27T21:39:31.817738",
"exception": false,
"start_time": "2023-11-27T21:39:31.810011",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"channels={d.channel.index:d.channel.name.lower() for d in f1.metadata.channels}\n",
"logging.info(channels)"
]
},
{
"cell_type": "markdown",
"id": "e9730175-0bb8-4b67-a57c-afdb51f2a7c9",
"metadata": {},
"source": [
"### Dimension names"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "badcfe78-487f-400b-b826-7f3cba638a18",
"metadata": {},
"id": "5059c536-da03-4023-9160-7f534b4fe8ee",
"metadata": {
"papermill": {
"duration": 0.006059,
"end_time": "2023-11-27T21:39:31.825263",
"exception": false,
"start_time": "2023-11-27T21:39:31.819204",
"status": "completed"
},
"tags": []
},
"outputs": [],
"source": [
"print(f1.metadata.contents)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "540ff76c-e188-462c-a199-e0895fd0cd37",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"## alt method for getting the lables\n",
"{getattr(f1.metadata.contents,s):s.replace('Count','') for s in dir(f1.metadata.contents) if not s.startswith('_')}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8b1d232c-fa84-4b36-bbba-ace46d6711ed",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"## alt method for getting the lables\n",
"{getattr(f1.attributes,k):k.replace('Count','') for k in dir(f1.attributes) if not k.startswith('_') and k.endswith('Count') and not k.startswith('component')}"
]
},
{
"cell_type": "markdown",
"id": "826b70a0-37a4-4b4e-abd8-7e6e2b70c8bf",
"metadata": {},
"source": [
"## Save the 2D arrays"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading

0 comments on commit 271b60a

Please sign in to comment.