Skip to content

Commit

Permalink
Comment 'transforms.CropForegroundd'
Browse files Browse the repository at this point in the history
Pre-training with 'transforms.CropForegroundd' was crashing to zero. Details: #12
  • Loading branch information
valosekj committed Apr 6, 2024
1 parent bb7cd2c commit cbcf7ea
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pretraining_and_finetuning/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def train_transforms(crop_size, patch_size, task="pretraining"):
transforms.LoadImaged(keys=all_keys, image_only=False),
transforms.EnsureChannelFirstd(keys=all_keys),
transforms.Orientationd(keys=all_keys, axcodes="RPI"),
transforms.CropForegroundd(keys=all_keys, source_key="label_sc"), # crop everything outside the SC mask
# transforms.CropForegroundd(keys=all_keys, source_key="label_sc"), # crop everything outside the SC mask
# NOTE: spine interpolation with order=2 is spline, order=1 is linear
transforms.Spacingd(keys=all_keys, pixdim=(0.8, 0.8, 0.8), mode=(2, 1)),
transforms.ResizeWithPadOrCropd(keys=all_keys, spatial_size=crop_size),
Expand Down Expand Up @@ -60,7 +60,7 @@ def train_transforms(crop_size, patch_size, task="pretraining"):
transforms.LoadImaged(keys=all_keys),
transforms.EnsureChannelFirstd(keys=all_keys),
transforms.Orientationd(keys=all_keys, axcodes="RPI"),
transforms.CropForegroundd(keys=all_keys, source_key="label_sc"), # crop everything outside the SC mask
# transforms.CropForegroundd(keys=all_keys, source_key="label_sc"), # crop everything outside the SC mask
# NOTE: spine interpolation with order=2 is spline, order=1 is linear
transforms.Spacingd(keys=all_keys, pixdim=(0.8, 0.8, 0.8), mode=(2, 1, 1)),
transforms.ResizeWithPadOrCropd(keys=all_keys, spatial_size=crop_size),
Expand Down Expand Up @@ -106,7 +106,7 @@ def val_transforms(crop_size, task="pretraining"):
transforms.LoadImaged(keys=all_keys, image_only=False),
transforms.EnsureChannelFirstd(keys=all_keys),
transforms.Orientationd(keys=all_keys, axcodes="RPI"),
transforms.CropForegroundd(keys=all_keys, source_key="label_sc"),
# transforms.CropForegroundd(keys=all_keys, source_key="label_sc"),
transforms.Spacingd(keys=all_keys, pixdim=(0.8, 0.8, 0.8), mode=(2, 1)),
transforms.ResizeWithPadOrCropd(keys=all_keys, spatial_size=crop_size),
transforms.DivisiblePadd(keys=all_keys, k=2**5), # pad inputs to ensure divisibility by no. of layers nnUNet has (5)
Expand All @@ -120,7 +120,7 @@ def val_transforms(crop_size, task="pretraining"):
transforms.LoadImaged(keys=all_keys, image_only=False),
transforms.EnsureChannelFirstd(keys=all_keys),
transforms.Orientationd(keys=all_keys, axcodes="RPI"),
transforms.CropForegroundd(keys=all_keys, source_key="label_sc"),
# transforms.CropForegroundd(keys=all_keys, source_key="label_sc"),
transforms.Spacingd(keys=all_keys, pixdim=(0.8, 0.8, 0.8), mode=(2, 1, 1)),
transforms.ResizeWithPadOrCropd(keys=all_keys, spatial_size=crop_size),
transforms.DivisiblePadd(keys=all_keys, k=2**5), # pad inputs to ensure divisibility by no. of layers nnUNet has (5)
Expand Down

0 comments on commit cbcf7ea

Please sign in to comment.