-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove unused imports, ensure data is float32, astype w/o copy
- Loading branch information
1 parent
45a4be1
commit 3808231
Showing
2 changed files
with
7 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,20 +14,20 @@ | |
import multiprocessing | ||
import shutil | ||
from time import sleep | ||
from typing import Union, Tuple | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
FabianIsensee
Author
Member
|
||
from typing import Tuple | ||
|
||
import nnunetv2 | ||
import numpy as np | ||
from batchgenerators.utilities.file_and_folder_operations import * | ||
from tqdm import tqdm | ||
|
||
import nnunetv2 | ||
from nnunetv2.paths import nnUNet_preprocessed, nnUNet_raw | ||
from nnunetv2.preprocessing.cropping.cropping import crop_to_nonzero | ||
from nnunetv2.preprocessing.resampling.default_resampling import compute_new_shape | ||
from nnunetv2.utilities.dataset_name_id_conversion import maybe_convert_to_dataset_name | ||
from nnunetv2.utilities.find_class_by_name import recursive_find_python_class | ||
from nnunetv2.utilities.plans_handling.plans_handler import PlansManager, ConfigurationManager | ||
from nnunetv2.utilities.utils import get_identifiers_from_splitted_dataset_folder, \ | ||
create_lists_from_splitted_dataset_folder, get_filenames_of_train_images_and_targets | ||
from tqdm import tqdm | ||
from nnunetv2.utilities.utils import get_filenames_of_train_images_and_targets | ||
|
||
|
||
class DefaultPreprocessor(object): | ||
|
@@ -41,7 +41,7 @@ def run_case_npy(self, data: np.ndarray, seg: Union[np.ndarray, None], propertie | |
plans_manager: PlansManager, configuration_manager: ConfigurationManager, | ||
dataset_json: Union[dict, str]): | ||
# let's not mess up the inputs! | ||
data = np.copy(data) | ||
data = data.astype(np.float32) # this creates a copy | ||
if seg is not None: | ||
assert data.shape[1:] == seg.shape[1:], "Shape mismatch between image and segmentation. Please fix your dataset and make use of the --verify_dataset_integrity flag to ensure everything is correct" | ||
seg = np.copy(seg) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Union
is not an unused import.Removing it raises
NameError
error on line 42 and othersPR #2117