Skip to content

Commit

Permalink
multiple updates
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyJens committed Feb 6, 2025
1 parent 82237dd commit e75d39a
Show file tree
Hide file tree
Showing 72 changed files with 3,157 additions and 5,581 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LungAnnFix/utils.py
100644 → 100755
Empty file.
Empty file modified LungCoordinates/HC.ipynb
100644 → 100755
Empty file.
Empty file modified LungCoordinates/LUNA16.ipynb
100644 → 100755
Empty file.
18 changes: 16 additions & 2 deletions LungCoordinatesValidation/Untitled.ipynb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
{
"cells": [],
"metadata": {},
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# TODO: implement!"
]
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
180 changes: 180 additions & 0 deletions LungDetectionTraining/filtering_luna_data.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Code used to extract only LUNA16 data from mixed dataset .json "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"from tqdm import tqdm"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### train/val"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 488/488 [00:00<00:00, 1172962.95it/s]\n",
"100%|██████████| 122/122 [00:00<00:00, 571099.43it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"384\n",
"96\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"data_list_file_path = f'/data/output/mixed_data/mixed_train_val0.json'\n",
"f = open(data_list_file_path)\n",
"data = json.load(f)\n",
"\n",
"train_luna = []\n",
"val_luna = []\n",
"for content in tqdm(data['training']):\n",
" if 'LUNA16' in content['image']:\n",
" train_luna.append({\n",
" \"box\": content['box'],\n",
" \"image\": content['image'],\n",
" \"label\": content['label']\n",
" })\n",
"\n",
"for content in tqdm(data['validation']):\n",
" if 'LUNA16' in content['image']:\n",
" val_luna.append({\n",
" \"box\": content['box'],\n",
" \"image\": content['image'],\n",
" \"label\": content['label']\n",
" })\n",
"\n",
"print(len(train_luna))\n",
"print(len(val_luna))\n",
"\n",
"value = {\n",
" \"training\": train_luna,\n",
" \"validation\": val_luna\n",
"}\n",
"\n",
"save_file = open(\n",
" '/data/output/unique_data/luna_train_val.json',\n",
" 'w'\n",
")\n",
"json.dump(value, save_file, indent=5)\n",
"save_file.close()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### test"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|██████████| 155/155 [00:00<00:00, 773948.95it/s]"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"121\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
}
],
"source": [
"data_list_file_path = f'/data/output/mixed_data/mixed_test.json'\n",
"f = open(data_list_file_path)\n",
"data = json.load(f)\n",
"\n",
"test_luna = []\n",
"val_luna = []\n",
"for content in tqdm(data['test']):\n",
" if 'LUNA16' in content['image']:\n",
" test_luna.append({\n",
" \"box\": content['box'],\n",
" \"image\": content['image'],\n",
" \"label\": content['label']\n",
" })\n",
"\n",
"print(len(test_luna))\n",
"\n",
"value = {\n",
" \"test\": test_luna\n",
"}\n",
"\n",
"save_file = open(\n",
" '/data/output/unique_data/luna_test.json',\n",
" 'w'\n",
")\n",
"json.dump(value, save_file, indent=5)\n",
"save_file.close()"
]
}
],
"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": 4
}
3 changes: 1 addition & 2 deletions LungDetectionTraining/generate_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@
)
from monai.apps.detection.transforms.dictionary import (
AffineBoxToImageCoordinated,
AffineBoxToWorldCoordinated,
BoxToMaskd,
ClipBoxToImaged,
ConvertBoxToStandardModed,
MaskToBoxd,
RandCropBoxByPosNegLabeld,
RandCropBoxByPosNegLabeld, # RandCropByPosNegLabeld
RandFlipBoxd,
RandRotateBox90d,
RandZoomBoxd,
Expand Down
Loading

0 comments on commit e75d39a

Please sign in to comment.