Skip to content

Commit

Permalink
Merge branch 'mc/feat/data-readers' of github.com:CAREamics/careamics…
Browse files Browse the repository at this point in the history
… into mc/feat/data-readers
  • Loading branch information
melisande-c committed Jan 23, 2025
2 parents 24893a3 + 27a4f4c commit 2c57557
Showing 1 changed file with 13 additions and 123 deletions.
136 changes: 13 additions & 123 deletions src/careamics/dataset_dev/demo_data_reader.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -21,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -43,50 +43,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[[ 0 1 2 3 4 5]\n",
" [ 6 7 8 9 10 11]\n",
" [12 13 14 15 16 17]\n",
" [18 19 20 21 22 23]\n",
" [24 25 26 27 28 29]\n",
" [30 31 32 33 34 35]]]\n",
"[[[ 0 1 2 3 4]\n",
" [ 5 6 7 8 9]\n",
" [10 11 12 13 14]\n",
" [15 16 17 18 19]\n",
" [20 21 22 23 24]]\n",
"\n",
" [[25 26 27 28 29]\n",
" [30 31 32 33 34]\n",
" [35 36 37 38 39]\n",
" [40 41 42 43 44]\n",
" [45 46 47 48 49]]]\n",
"[[[1 1 1 1 0 1]\n",
" [0 0 1 0 1 0]\n",
" [0 1 1 1 0 0]\n",
" [0 1 1 0 0 0]\n",
" [0 1 1 1 0 0]\n",
" [1 0 0 0 0 1]]]\n",
"[[[0 0 0 1 0]\n",
" [0 1 0 0 1]\n",
" [1 0 1 1 1]\n",
" [1 1 0 0 0]\n",
" [0 1 1 1 0]]\n",
"\n",
" [[1 0 0 1 1]\n",
" [1 0 1 1 1]\n",
" [1 1 1 0 1]\n",
" [1 0 0 1 0]\n",
" [0 0 0 0 0]]]\n"
]
}
],
"outputs": [],
"source": [
"print(array1)\n",
"print(array2)\n",
Expand All @@ -96,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -107,42 +66,9 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'data_idx': 0, 'sample_idx': 0, 'coords': (0, 3), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (3, 2), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (2, 4), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (0, 3), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (1, 0), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (2, 4), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (3, 3), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (3, 3), 'extent': (2, 2)},\n",
" {'data_idx': 0, 'sample_idx': 0, 'coords': (2, 0), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (3, 1), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (2, 1), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (0, 3), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (3, 2), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (1, 3), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (2, 1), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 0, 'coords': (1, 0), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (0, 2), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (3, 0), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (3, 3), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (1, 2), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (0, 3), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (2, 1), 'extent': (2, 2)},\n",
" {'data_idx': 1, 'sample_idx': 1, 'coords': (0, 3), 'extent': (2, 2)}]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# generate random patch specification\n",
"data_shapes = [\n",
Expand All @@ -155,55 +81,19 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[array([[[21, 22],\n",
" [27, 28]]]),\n",
" array([[[12, 13],\n",
" [18, 19]]]),\n",
" array([[[16, 17],\n",
" [21, 22]]]),\n",
" array([[[11, 12],\n",
" [16, 17]]])]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# extract a subset of patches\n",
"input_data_reader.extract_patches(patch_specs[7:11])"
]
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[array([[[0, 0],\n",
" [1, 0]]]),\n",
" array([[[0, 1],\n",
" [0, 1]]]),\n",
" array([[[1, 0],\n",
" [1, 1]]]),\n",
" array([[[0, 1],\n",
" [1, 0]]])]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"target_data_reader.extract_patches(patch_specs[7:11])"
]
Expand Down

0 comments on commit 2c57557

Please sign in to comment.