Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace imp with importlib #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions HD_BET/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import SimpleITK as sitk
from HD_BET.data_loading import load_and_preprocess, save_segmentation_nifti
from HD_BET.predict_case import predict_case_3D_net
import imp
import importlib.util
from HD_BET.utils import postprocess_prediction, SetNetworkToVal, get_params_fname, maybe_download_parameters
import os
import HD_BET
Expand Down Expand Up @@ -53,7 +53,9 @@ def run_hd_bet(mri_fnames, output_fnames, mode="accurate", config_file=os.path.j

assert all([os.path.isfile(i) for i in list_of_param_files]), "Could not find parameter files"

cf = imp.load_source('cf', config_file)
spec = importlib.util.spec_from_file_location("cf", config_file)
cf = importlib.util.module_from_spec(spec)
spec.loader.exec_module(cf)
cf = cf.config()

net, _ = cf.get_network(cf.val_use_train_mode, None)
Expand Down