Showing 113 of 113 total issues
Avoid deeply nested control flow statements. Open
Open
if "T1" in file:
arr = nib.load(
os.path.join(path_to_data, folder, sub_folder, file)
).get_data()
img = nib.Nifti1Image(arr, affine=np.eye(4))
Avoid deeply nested control flow statements. Open
Open
if case in file:
os.chdir(os.path.join(path_to_train, folder))
source = file
destination = os.path.join(path_to_test, folder)
shutil.move(source, destination)
Function gif_warp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def gif_warp(
img_paths, ddf_path, slice_inds=None, num_interval=100, interval=50, save_path=""
):
"""
Apply ddf to image slice/s to generate gif.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function get_data_loader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_data_loader(data_config: dict, split: str) -> Optional[DataLoader]:
"""
Return the corresponding data loader.
Can't be placed in the same file of loader interfaces as it causes import cycle.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
Open
if np.sum((values - values_fi) ** 2) > 1:
it_voxel_fi += 1
break
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function predict_on_dataset
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def predict_on_dataset(
Function calculate_metrics
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def calculate_metrics(
Function get_dataset_and_preprocess
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_dataset_and_preprocess(
Avoid deeply nested control flow statements. Open
Open
if np.max(im_data) > 255.0:
im_data = ((im_data + 285) / (3770 + 285)) * 255.0 # rescale image
img = nib.Nifti1Image(im_data, affine=None)
nib.save(img, os.path.join(data_dir, folder, subfolder, file))
if np.max(img.dataobj) > 255.0:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function build_up_sampling_block
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_up_sampling_block(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Avoid deeply nested control flow statements. Open
Open
if np.max(im_data) > 255.0:
im_data = ((im_data + 285) / (3770 + 285)) * 255.0 # rescale image
img = nib.Nifti1Image(im_data, affine=None)
nib.save(img, os.path.join(data_dir, folder, subfolder, file))
if np.max(img.dataobj) > 255.0:
Function gif_warp
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def gif_warp(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function build_up_sampling_block
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_up_sampling_block(