From 4a44bcf216400d591ac119a17ed329d4576e3f59 Mon Sep 17 00:00:00 2001 From: Ebrahim Ebrahim Date: Wed, 29 May 2024 15:28:11 -0400 Subject: [PATCH] style: standardize import order using isort --- HD_BET/config.py | 6 ++++-- HD_BET/data_loading.py | 2 +- HD_BET/hd_bet_cli.py | 3 ++- HD_BET/network_architecture.py | 1 + HD_BET/predict_case.py | 2 +- HD_BET/run.py | 13 ++++++++----- HD_BET/utils.py | 8 +++++--- 7 files changed, 22 insertions(+), 13 deletions(-) diff --git a/HD_BET/config.py b/HD_BET/config.py index 9306fcc..97d6801 100755 --- a/HD_BET/config.py +++ b/HD_BET/config.py @@ -1,8 +1,10 @@ +from abc import abstractmethod + import numpy as np import torch -from HD_BET.utils import SetNetworkToVal, softmax_helper -from abc import abstractmethod + from HD_BET.network_architecture import Network +from HD_BET.utils import SetNetworkToVal, softmax_helper class BaseConfig(object): diff --git a/HD_BET/data_loading.py b/HD_BET/data_loading.py index 0a953ba..d985efa 100755 --- a/HD_BET/data_loading.py +++ b/HD_BET/data_loading.py @@ -1,5 +1,5 @@ -import SimpleITK as sitk import numpy as np +import SimpleITK as sitk from skimage.transform import resize diff --git a/HD_BET/hd_bet_cli.py b/HD_BET/hd_bet_cli.py index 1606eca..6ec9806 100755 --- a/HD_BET/hd_bet_cli.py +++ b/HD_BET/hd_bet_cli.py @@ -1,9 +1,10 @@ #!/usr/bin/env python import os + +import HD_BET from HD_BET.run import run_hd_bet from HD_BET.utils import maybe_mkdir_p, subfiles -import HD_BET def main(): diff --git a/HD_BET/network_architecture.py b/HD_BET/network_architecture.py index 0824aa1..2648905 100755 --- a/HD_BET/network_architecture.py +++ b/HD_BET/network_architecture.py @@ -1,6 +1,7 @@ import torch import torch.nn as nn import torch.nn.functional as F + from HD_BET.utils import softmax_helper diff --git a/HD_BET/predict_case.py b/HD_BET/predict_case.py index 559c667..7a07424 100755 --- a/HD_BET/predict_case.py +++ b/HD_BET/predict_case.py @@ -1,5 +1,5 @@ -import torch import numpy as np +import torch def pad_patient_3D(patient, shape_must_be_divisible_by=16, min_size=None): diff --git a/HD_BET/run.py b/HD_BET/run.py index a2ad763..4cf55eb 100755 --- a/HD_BET/run.py +++ b/HD_BET/run.py @@ -1,12 +1,15 @@ -import torch +import imp +import os + import numpy as np import SimpleITK as sitk +import torch + +import HD_BET from HD_BET.data_loading import load_and_preprocess, save_segmentation_nifti from HD_BET.predict_case import predict_case_3D_net -import imp -from HD_BET.utils import postprocess_prediction, SetNetworkToVal, get_params_fname, maybe_download_parameters -import os -import HD_BET +from HD_BET.utils import (SetNetworkToVal, get_params_fname, + maybe_download_parameters, postprocess_prediction) def apply_bet(img, bet, out_fname): diff --git a/HD_BET/utils.py b/HD_BET/utils.py index f70f389..0202185 100755 --- a/HD_BET/utils.py +++ b/HD_BET/utils.py @@ -1,9 +1,11 @@ +import os from urllib.request import urlopen -import torch -from torch import nn + import numpy as np +import torch from skimage.morphology import label -import os +from torch import nn + from HD_BET.paths import folder_with_parameter_files