Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixing Test Cases] Allow 0 in label image test cases #134

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions test_cases/map_pixel_count_of_labels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,42 @@
" [0,0,0,1,0],\n",
" ])\n",
"\n",
" assert np.array_equal(reference, result)"
" ref_zeros_are_labels = np.asarray([\n",
" [16,16,16,16,16],\n",
" [3,4,4,16,16],\n",
" [3,4,4,16,16],\n",
" [3,16,16,1,16],\n",
" [16,16,16,1,16],\n",
" ])\n",
"\n",
" assert (np.array_equal(reference, result) or np.array_equal(ref_zeros_are_labels, result))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "e4789ed1-dc01-46a6-80b2-dd98d8d7b875",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/ian/miniconda3/envs/heb/lib/python3.10/site-packages/pytools/persistent_dict.py:59: UserWarning: Unable to import recommended hash 'siphash24.siphash13', falling back to 'hashlib.sha256'. Run 'python3 -m pip install siphash24' to install the recommended hash.\n",
" warn(\"Unable to import recommended hash 'siphash24.siphash13', \"\n"
]
}
],
"source": [
"check(map_pixel_count_of_labels)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "69f50302-d69f-4659-9512-4bb86db33cbc",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python [conda env:heb]",
"language": "python",
"name": "python3"
"name": "conda-env-heb-py"
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions test_cases/measure_pixel_count_of_labels.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
" [0,3,3,0,0],\n",
" [0,0,0,4,0],\n",
" ])) \n",
" assert np.array_equal([1,3,2,1], result)"
" assert (np.array_equal([1,3,2,1], result) or np.array_equal([18, 1,3,2,1], result))"
]
},
{
Expand Down Expand Up @@ -71,7 +71,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down