Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 1 addition & 9 deletions monai/apps/nnunet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ def create_new_dataset_json(
"""
new_json_data: dict = {}

# modality = self.input_info.pop("modality")
modality = ensure_tuple(modality) # type: ignore

new_json_data["channel_names"] = {}
Expand All @@ -161,18 +160,11 @@ def create_new_dataset_json(
for _j in range(num_foreground_classes):
new_json_data["labels"][f"class{_j + 1}"] = _j + 1

# new_json_data["numTraining"] = len(datalist_json["training"])
new_json_data["numTraining"] = num_training_data
new_json_data["file_ending"] = ".nii.gz"

ConfigParser.export_config_file(
config=new_json_data,
# filepath=os.path.join(raw_data_foldername, "dataset.json"),
filepath=output_filepath,
fmt="json",
sort_keys=True,
indent=4,
ensure_ascii=False,
config=new_json_data, filepath=output_filepath, fmt="json", sort_keys=True, indent=4, ensure_ascii=False
)

return
2 changes: 0 additions & 2 deletions monai/apps/vista3d/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ def __call__(self, data):
pred = pred.argmax(0).unsqueeze(0).float() + 1.0
pred[is_bk] = 0.0
else:
# AsDiscrete will remove NaN
# pred = monai.transforms.AsDiscrete(threshold=0.5)(pred)
pred[pred > 0] = 1.0
if "label_prompt" in data and data["label_prompt"] is not None:
pred += 0.5 # inplace mapping to avoid cloning pred
Expand Down
2 changes: 0 additions & 2 deletions monai/data/ultrasound_confidence_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@ def confidence_laplacian(self, padded_index: NDArray, padded_image: NDArray, bet

if iter_idx == 1:
vertical_end = s.shape[0] # Vertical edges length
elif iter_idx == 5:
s.shape[0] # Diagonal edges length

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this actually be vertical_end = s.shape[1]? I suspect this is really meant to do something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have removed this change. I think this is a bug rather than dead code, will investigate this on a later date then. Thank you very much for pointing this out.


# Normalize weights
s = self.normalize(s)
Expand Down
3 changes: 0 additions & 3 deletions monai/inferers/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ def __init__(

self.chunks = chunks

# Handle compressor/codecs based on zarr version
is_zarr_v3 = version_geq(get_package_version("zarr"), "3.0.0")

# Initialize codecs/compressor attributes with proper types
self.codecs: list | None = None
self.value_codecs: list | None = None
Expand Down
1 change: 0 additions & 1 deletion monai/losses/image_dissimilarity.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ def __init__(
sigma = torch.mean(bin_centers[1:] - bin_centers[:-1]) * sigma_ratio
self.kernel_type = look_up_option(kernel_type, ["gaussian", "b-spline"])
self.num_bins = num_bins
self.kernel_type = kernel_type
# declared as buffers so they move with the module (e.g. ``.to(device)``); only populated for the
# gaussian kernel, hence the ``Tensor`` annotation reflects the type at the use sites in that path.
self.preterm: torch.Tensor | None
Expand Down
2 changes: 1 addition & 1 deletion monai/losses/nacl_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def forward(self, inputs: torch.Tensor, targets: torch.Tensor) -> torch.Tensor:
if self.distance_type == "l1":
loss_conf = utargets.sub(inputs).abs_().mean()
elif self.distance_type == "l2":
loss_conf = utargets.sub(inputs).pow_(2).abs_().mean()
loss_conf = utargets.sub(inputs).pow_(2).mean()

loss: torch.Tensor = loss_ce + self.alpha * loss_conf

Expand Down
1 change: 0 additions & 1 deletion monai/metrics/generalized_dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ def compute_generalized_dice(
else:
numer = 2.0 * (intersection * w)
denom = denominator * w
y_pred_o = y_pred_o

# Compute the score
generalized_dice_score = numer / denom
Expand Down
1 change: 0 additions & 1 deletion monai/networks/blocks/text_embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def forward(self):
# text embedding as random initialized 'rand_embedding'
text_embedding = self.text_embedding.weight
else:
print(self.text_embedding)
text_embedding = nn.functional.relu(self.text_to_vision(self.text_embedding))

if self.spatial_dims == 3:
Expand Down
3 changes: 0 additions & 3 deletions monai/networks/layers/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ def forward(ctx, input, features, sigmas=None):
@staticmethod
def backward(ctx, grad_output):
raise NotImplementedError("PHLFilter does not currently support Backpropagation")
# scaled_features, = ctx.saved_variables
# grad_input = _C.phl_filter(grad_output, scaled_features)
# return grad_input


class TrainableBilateralFilterFunction(torch.autograd.Function):
Expand Down
1 change: 0 additions & 1 deletion monai/networks/layers/simplelayers.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ def __init__(self, spatial_dims: int, size: int) -> None:
size: edge length of the filter
"""
filter = torch.ones([size] * spatial_dims)
filter = filter
super().__init__(filter=filter)


Expand Down
1 change: 0 additions & 1 deletion monai/networks/nets/basic_unet.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ def __init__(
"""
super().__init__()
fea = ensure_tuple_rep(features, 6)
print(f"BasicUNet features: {fea}.")

self.conv_0 = TwoConv(spatial_dims, in_channels, features[0], act, norm, bias, dropout)
self.down_1 = Down(spatial_dims, fea[0], fea[1], act, norm, bias, dropout)
Expand Down
1 change: 0 additions & 1 deletion monai/networks/nets/basic_unetplusplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def __init__(
self.deep_supervision = deep_supervision

fea = ensure_tuple_rep(features, 6)
print(f"BasicUNetPlusPlus features: {fea}.")

self.conv_0_0 = TwoConv(spatial_dims, in_channels, fea[0], act, norm, bias, dropout)
self.conv_1_0 = Down(spatial_dims, fea[0], fea[1], act, norm, bias, dropout)
Expand Down
1 change: 0 additions & 1 deletion monai/transforms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,6 @@ def extreme_points_to_image(
rescale_max: maximum value of output data.
"""
# points to image
# points_image = torch.zeros(label.shape[1:], dtype=torch.float)
points_image = torch.zeros_like(torch.as_tensor(label[0]), dtype=torch.float)
for p in points:
points_image[p] = 1.0
Expand Down
2 changes: 0 additions & 2 deletions monai/utils/profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
else:
Events = optional_import("ignite.engine", name="Events")

pd, has_pandas = optional_import("pandas")

__all__ = [
"torch_profiler_full",
"torch_profiler_time_cpu_gpu",
Expand Down
Loading