Skip to content

Commit

Permalink
Merge pull request #18 from neheller/reduce-scope
Browse files Browse the repository at this point in the history
Reduce scope
  • Loading branch information
neheller authored Jun 18, 2021
2 parents a46f04a + f215cac commit 8c670ee
Show file tree
Hide file tree
Showing 3,140 changed files with 16,618,491 additions and 19 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "/home/helle246/envs/ktk/bin/python"
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The official repository of the 2021 Kidney and Kidney Tumor Segmentation Challenge

**Current dataset version: `1.0.3`** (see [changelog](changelog.md))
**Current dataset version: `2.0.0`** (see [changelog](changelog.md))

<img src="https://kits21.kits-challenge.org/public/site_media/figures/rendering.png" width="400" />

Expand All @@ -18,6 +18,7 @@ The official repository of the 2021 Kidney and Kidney Tumor Segmentation Challen

## News

- **June 17, 2021**: We've changed the set of classes for the challenge. See [this forum post](https://discourse.kits-challenge.org/t/kits21-challenge-update/354) for details
- **Apr 7, 2021**: We've started using tags and a changelog to keep track of the dataset version
- **Mar 23, 2021**: A draft of the postprocessing code and some preliminary data has been merged into the master branch.
- **Mar 9, 2021**: A preliminary challenge homepage has been published at [kits-challenge.org](https://kits21.kits-challenge.org). You can keep tabs on the data annotation process there.
Expand Down
605 changes: 604 additions & 1 deletion annotation/cache.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions annotation/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,9 @@ def aggregate_case(case_id):
segs = Path(__file__).resolve().parent.parent / "data" / case_id / "segmentations"

ord_id = [
("ureter", 2),
("vein", 4),
("artery", 3),
("kidney", 1),
("cyst", 5),
("tumor", 6)
("cyst", 3),
("tumor", 2)
]

affine = None
Expand Down Expand Up @@ -270,6 +267,9 @@ def main(args):
region_dirs = get_all_region_dirs(case_dir)

for region_dir in region_dirs:
# Skip regions no longer being used
if region_dir.name in ["artery", "vein", "ureter"]:
continue
if cli and args.instance is not None:
instance_dirs = [get_instance_dir(region_dir, args.instance - 1)]
else:
Expand Down
26 changes: 15 additions & 11 deletions annotation/postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def interpolate_step(bef_i, aft_i, drw_c, step):
return drw_c


def interpolate_drawings(drw_c, step, arb_bdry):
def interpolate_drawings(drw_c, step, arb_bdry=False):
# Get inclusive start and end frames
start = 0
while start < drw_c.shape[0]:
Expand Down Expand Up @@ -501,9 +501,7 @@ def get_blur_kernel_d(affine):


def get_threshold(region_type):
# TODO tune this
if region_type == "ureter":
return -50
# This seems to work -- no need to adjust based on region now that ureter is gone
return -30


Expand Down Expand Up @@ -607,18 +605,24 @@ def add_renal_hilum(thresholded_c, blr_c, threshold, lzn, side, cbox):
bound = "inf"
if bound is None:
continue
frame = ann["frame"]
frame = int(ann["frame"])
if bound == "sup":
if first_hilum_slice is None or frame < first_hilum_slice:
first_hilum_slice = frame - cbox["zmin"]
elif bound == "inf":
if last_hilum_slice is None or frame > last_hilum_slice:
last_hilum_slice = frame - cbox["zmin"]

for ind in range(first_hilum_slice, last_hilum_slice+1):
# TODO send dln here and use custom hilum if possible
hlm = find_hilum_in_slice(thresholded_c[ind].copy(), side)
apply_hilum_to_slice(thresholded_c, blr_c, threshold, ind, hlm)
if first_hilum_slice is not None and last_hilum_slice is not None:
for ind in range(max(first_hilum_slice, 0), min(last_hilum_slice+1, thresholded_c.shape[0]-1)):
# TODO send dln here and use custom hilum if possible
hlm = find_hilum_in_slice(thresholded_c[ind].copy(), side)
apply_hilum_to_slice(thresholded_c, blr_c, threshold, ind, hlm)
else:
if first_hilum_slice is None:
print("First hilum slice could not be determined")
if last_hilum_slice is None:
print("Last hilum slice could not be determined")

return thresholded_c

Expand All @@ -631,7 +635,7 @@ def get_side(cbox):

def generate_segmentation(region_type, cropped_img, cropped_drw, step=1, affine=None, lzn=None, cbox=None):
# Interpolate drawings
cropped_drw = interpolate_drawings(cropped_drw, step, region_type in ["artery","vein","ureter"])
cropped_drw = interpolate_drawings(cropped_drw, step)

# Send tensors to GPU
img_d = torch.from_numpy(cropped_img).to("cuda:0")
Expand Down Expand Up @@ -699,4 +703,4 @@ def delineation_to_seg(region_type, image_path, delineation_path, localization_p
seg = inflate_seg_to_image_size(cbox, cropped_seg)

# Return the seg in nifti format
return nib.Nifti1Image(seg, img_nib.affine)
return nib.Nifti1Image(seg.astype(np.uint8), img_nib.affine)
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@

This file is meant to keep track of which annotations were changed in each dataset version. Broadly, the *major* version will be incremented with any change to the postprocessing code that causes every region to be regenerated (starting at `v1.x.x`). The *minor* version will be incremented with the addition of new **imaging**, and the *patch* version will be incremented with new **annotations** for the existing imaging.

## [2.0.0] - June 17, 2021

- Changed import and aggregation code to ignore ureter, artery, and vein regions
- Deleted existing ureter, artery, and vein instances that were segmented
- New annotations for cases 50 - 92

## [1.0.3] - May 21, 2021

- Full annotations for
- Full annotations for
- `case_00036`
- `case_00037`
- `case_00038`
Expand Down
Binary file modified data/case_00000/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00000/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00000/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00001/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00001/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00001/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00002/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00002/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00002/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00003/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00003/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00003/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00004/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00004/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00004/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00005/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00005/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00005/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00006/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00006/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00006/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00007/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00007/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00007/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00008/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00008/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00008/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00009/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00009/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00009/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00010/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00010/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00010/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00011/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00011/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00011/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00012/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00012/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00012/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00013/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00013/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00013/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00014/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00014/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00014/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00015/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00015/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00015/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00016/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00016/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00016/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00017/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00017/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00017/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00018/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00018/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00018/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified data/case_00019/aggregated_AND_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00019/aggregated_MAJ_seg.nii.gz
Binary file not shown.
Binary file modified data/case_00019/aggregated_OR_seg.nii.gz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 8c670ee

Please sign in to comment.