Skip to content
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
4 changes: 2 additions & 2 deletions DAE/BTCV_Finetune/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_loader(args):
transforms.ScaleIntensityRanged(
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
transforms.CropForegroundd(keys=["image", "label"], source_key="image"),
transforms.CropForegroundd(keys=["image", "label"], source_key="image", allow_smaller=True),
transforms.RandCropByPosNegLabeld(
keys=["image", "label"],
label_key="label",
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_loader(args):
transforms.ScaleIntensityRanged(
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
transforms.CropForegroundd(keys=["image", "label"], source_key="image"),
transforms.CropForegroundd(keys=["image", "label"], source_key="image", allow_smaller=True),
transforms.ToTensord(keys=["image", "label"]),
]
)
Expand Down
1 change: 0 additions & 1 deletion DAE/Pretrain_full_contrast/data/data_pretrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
AsChannelFirstd,
AsDiscrete,
Compose,
CropForegroundd,
LoadImaged,
NormalizeIntensityd,
Orientationd,
Expand Down
1 change: 0 additions & 1 deletion SwinMM/WORD/models/swin_unetr.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(

"""
super().__init__(
img_size,
*args,
num_heads=num_heads,
feature_size=feature_size,
Expand Down
3 changes: 1 addition & 2 deletions SwinUNETR/BRATS21/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ Mean Dice refers to average Dice of WT, ET and TC tumor semantic classes.
A Swin UNETR network with standard hyper-parameters for brain tumor semantic segmentation (BraTS dataset) is be defined as:

``` bash
model = SwinUNETR(img_size=(128,128,128),
in_channels=4,
model = SwinUNETR(in_channels=4,
out_channels=3,
feature_size=48,
use_checkpoint=True,
Expand Down
1 change: 0 additions & 1 deletion SwinUNETR/BRATS21/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def main_worker(gpu, args):
pretrained_pth = os.path.join(pretrained_dir, model_name)

model = SwinUNETR(
img_size=(args.roi_x, args.roi_y, args.roi_z),
in_channels=args.in_channels,
out_channels=args.out_channels,
feature_size=args.feature_size,
Expand Down
1 change: 0 additions & 1 deletion SwinUNETR/BRATS21/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def main():
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
pretrained_pth = os.path.join(pretrained_dir, model_name)
model = SwinUNETR(
img_size=128,
in_channels=args.in_channels,
out_channels=args.out_channels,
feature_size=args.feature_size,
Expand Down
2 changes: 1 addition & 1 deletion SwinUNETR/BRATS21/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_loader(args):
transforms.LoadImaged(keys=["image", "label"]),
transforms.ConvertToMultiChannelBasedOnBratsClassesd(keys="label"),
transforms.CropForegroundd(
keys=["image", "label"], source_key="image", k_divisible=[args.roi_x, args.roi_y, args.roi_z]
keys=["image", "label"], source_key="image", k_divisible=[args.roi_x, args.roi_y, args.roi_z], allow_smaller=True
),
transforms.RandSpatialCropd(
keys=["image", "label"], roi_size=[args.roi_x, args.roi_y, args.roi_z], random_size=False
Expand Down
3 changes: 1 addition & 2 deletions SwinUNETR/BTCV/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ Once the json file is downloaded, please place it in the same folder as the data
A Swin UNETR network with standard hyper-parameters for multi-organ semantic segmentation (BTCV dataset) is be defined as:

``` bash
model = SwinUNETR(img_size=(96,96,96),
in_channels=1,
model = SwinUNETR(in_channels=1,
out_channels=14,
feature_size=48,
use_checkpoint=True,
Expand Down
1 change: 0 additions & 1 deletion SwinUNETR/BTCV/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def main_worker(gpu, args):

pretrained_dir = args.pretrained_dir
model = SwinUNETR(
img_size=(args.roi_x, args.roi_y, args.roi_z),
in_channels=args.in_channels,
out_channels=args.out_channels,
feature_size=args.feature_size,
Expand Down
1 change: 0 additions & 1 deletion SwinUNETR/BTCV/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def main():
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
pretrained_pth = os.path.join(pretrained_dir, model_name)
model = SwinUNETR(
img_size=96,
in_channels=args.in_channels,
out_channels=args.out_channels,
feature_size=args.feature_size,
Expand Down
4 changes: 2 additions & 2 deletions SwinUNETR/BTCV/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_loader(args):
transforms.ScaleIntensityRanged(
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
transforms.CropForegroundd(keys=["image", "label"], source_key="image"),
transforms.CropForegroundd(keys=["image", "label"], source_key="image", allow_smaller=True),
transforms.RandCropByPosNegLabeld(
keys=["image", "label"],
label_key="label",
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_loader(args):
transforms.ScaleIntensityRanged(
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
transforms.CropForegroundd(keys=["image", "label"], source_key="image"),
transforms.CropForegroundd(keys=["image", "label"], source_key="image", allow_smaller=True),
transforms.ToTensord(keys=["image", "label"]),
]
)
Expand Down
4 changes: 2 additions & 2 deletions SwinUNETR/Pretrain/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def get_loader(args):
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
SpatialPadd(keys="image", spatial_size=[args.roi_x, args.roi_y, args.roi_z]),
CropForegroundd(keys=["image"], source_key="image", k_divisible=[args.roi_x, args.roi_y, args.roi_z]),
CropForegroundd(keys=["image"], source_key="image", k_divisible=[args.roi_x, args.roi_y, args.roi_z], allow_smaller=True),
RandSpatialCropSamplesd(
keys=["image"],
roi_size=[args.roi_x, args.roi_y, args.roi_z],
Expand All @@ -98,7 +98,7 @@ def get_loader(args):
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
SpatialPadd(keys="image", spatial_size=[args.roi_x, args.roi_y, args.roi_z]),
CropForegroundd(keys=["image"], source_key="image", k_divisible=[args.roi_x, args.roi_y, args.roi_z]),
CropForegroundd(keys=["image"], source_key="image", k_divisible=[args.roi_x, args.roi_y, args.roi_z], allow_smaller=True),
RandSpatialCropSamplesd(
keys=["image"],
roi_size=[args.roi_x, args.roi_y, args.roi_z],
Expand Down
4 changes: 2 additions & 2 deletions UNETR/BTCV/utils/data_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_loader(args):
transforms.ScaleIntensityRanged(
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
transforms.CropForegroundd(keys=["image", "label"], source_key="image"),
transforms.CropForegroundd(keys=["image", "label"], source_key="image", allow_smaller=True),
transforms.RandCropByPosNegLabeld(
keys=["image", "label"],
label_key="label",
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_loader(args):
transforms.ScaleIntensityRanged(
keys=["image"], a_min=args.a_min, a_max=args.a_max, b_min=args.b_min, b_max=args.b_max, clip=True
),
transforms.CropForegroundd(keys=["image", "label"], source_key="image"),
transforms.CropForegroundd(keys=["image", "label"], source_key="image", allow_smaller=True),
transforms.ToTensord(keys=["image", "label"]),
]
)
Expand Down
3 changes: 2 additions & 1 deletion auto3dseg/algorithm_templates/dints/scripts/algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def fill_template_config(self, data_stats_file, output_path, **kwargs):
"source_key": "@image_key",
"start_coord_key": None,
"end_coord_key": None,
"allow_smaller": True,
},
],
}
Expand All @@ -174,7 +175,7 @@ def fill_template_config(self, data_stats_file, output_path, **kwargs):
"b_max": 1.0,
"clip": True,
},
{"_target_": "CropForegroundd", "keys": "@image_key", "source_key": "@image_key"},
{"_target_": "CropForegroundd", "keys": "@image_key", "source_key": "@image_key", "allow_smaller": True},
],
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
network:
_target_: SwinUNETR
feature_size: 48
img_size: 96
in_channels: "@input_channels"
out_channels: "@output_classes"
spatial_dims: 3
Expand Down
3 changes: 2 additions & 1 deletion auto3dseg/algorithm_templates/swinunetr/scripts/algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def fill_template_config(self, data_stats_file, output_path, **kwargs):
"source_key": "@image_key",
"start_coord_key": None,
"end_coord_key": None,
"allow_smaller": True,
},
],
}
Expand All @@ -183,7 +184,7 @@ def fill_template_config(self, data_stats_file, output_path, **kwargs):
"b_max": 1.0,
"clip": True,
},
{"_target_": "CropForegroundd", "keys": "@image_key", "source_key": "@image_key"},
{"_target_": "CropForegroundd", "keys": "@image_key", "source_key": "@image_key", "allow_smaller": True},
],
}
mr_intensity_transform = {
Expand Down