Skip to content

Commit

Permalink
Removed functionality that is no longer useful.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzwanenburg committed Apr 4, 2024
1 parent 4b9cac3 commit 4ea7405
Showing 1 changed file with 12 additions and 53 deletions.
65 changes: 12 additions & 53 deletions test/ibsi_2_feature_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# Find path to the test directory. This is because we need to read datafiles stored in subdirectories.
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))

PERTURB_IMAGES = False
WRITE_TEMP_FILES = True


def within_tolerance(ref, tol, x):
# Read from pandas Series
Expand Down Expand Up @@ -57,19 +54,9 @@ def _get_default_settings(
resegmentation_intensity_range=[-1000.0, 400.0]
)

if PERTURB_IMAGES:
perturbation_settings = ImagePerturbationSettingsClass(
crop_around_roi=False,
perturbation_rotation_angles=[-15.0, -10.0, 5.0, 0.0, 5.0, 10.0, 15.0],
perturbation_translation_fraction=[0.00, 0.25, 0.50, 0.75],
perturbation_roi_adapt_size=[-2.0, 0.0, 2.0],
perturbation_roi_adapt_type="distance"
)

else:
perturbation_settings = ImagePerturbationSettingsClass(
crop_around_roi=False
)
perturbation_settings = ImagePerturbationSettingsClass(
crop_around_roi=False
)

feature_computation_parameters = FeatureExtractionSettingsClass(
by_slice=by_slice,
Expand All @@ -84,8 +71,8 @@ def _process_experiment(
configuration_id: str,
by_slice: bool,
image_transformation_settings: ImageTransformationSettingsClass,
tmp_path: str | os.PathLike,
base_feature_families: str = "none"):
base_feature_families: str = "none"
):

# Get default settings.
general_settings, image_interpolation_settings, feature_computation_parameters, resegmentation_settings, \
Expand Down Expand Up @@ -116,20 +103,10 @@ def _process_experiment(

data = data[0]

if WRITE_TEMP_FILES:
file_name = "_".join([configuration_id, "perturb", "features.csv"] if PERTURB_IMAGES else [configuration_id, "features.csv"])

data.to_csv(
tmp_path / file_name,
sep=";",
decimal=".",
index=False
)

return data


def test_ibsi_2_config_none(tmp_path):
def test_ibsi_2_config_none():
"""
Compare computed feature values with reference values for configurations 1A and 1B of IBSI 2 phase 2.
"""
Expand All @@ -147,7 +124,6 @@ def test_ibsi_2_config_none(tmp_path):
configuration_id="1.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
base_feature_families="statistics"
)

Expand Down Expand Up @@ -183,7 +159,6 @@ def test_ibsi_2_config_none(tmp_path):
configuration_id="1.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
base_feature_families="statistics"
)

Expand All @@ -207,7 +182,7 @@ def test_ibsi_2_config_none(tmp_path):
assert (within_tolerance(52600, 2800, data["stat_var"]))


def test_ibsi_2_config_mean_filter(tmp_path):
def test_ibsi_2_config_mean_filter():
"""
Compare computed feature values with reference values for configurations 2A and 2B of IBSI 2 phase 2.
"""
Expand All @@ -226,7 +201,6 @@ def test_ibsi_2_config_mean_filter(tmp_path):
configuration_id="2.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path
)

data.columns = [column_name.replace("mean_d_5_", "") for column_name in data.columns]
Expand Down Expand Up @@ -264,7 +238,6 @@ def test_ibsi_2_config_mean_filter(tmp_path):
configuration_id="2.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("mean_d_5_", "") for column_name in data.columns]
Expand All @@ -289,7 +262,7 @@ def test_ibsi_2_config_mean_filter(tmp_path):
assert (within_tolerance(44400, 2300, data["stat_var"]))


def test_ibsi_2_config_laplacian_of_gaussian_filter(tmp_path):
def test_ibsi_2_config_laplacian_of_gaussian_filter():
"""
Compare computed feature values with reference values for configurations 3A and 3B of IBSI 2 phase 2.
"""
Expand All @@ -309,7 +282,6 @@ def test_ibsi_2_config_laplacian_of_gaussian_filter(tmp_path):
configuration_id="3.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("log_s_1.5_", "") for column_name in data.columns]
Expand Down Expand Up @@ -348,7 +320,6 @@ def test_ibsi_2_config_laplacian_of_gaussian_filter(tmp_path):
configuration_id="3.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("log_s_1.5_", "") for column_name in data.columns]
Expand All @@ -373,7 +344,7 @@ def test_ibsi_2_config_laplacian_of_gaussian_filter(tmp_path):
assert (within_tolerance(720, 33, data["stat_var"]))


def test_ibsi_2_config_laws_filter(tmp_path):
def test_ibsi_2_config_laws_filter():
"""
Compare computed feature values with reference values for configurations 4A and 4B of IBSI 2 phase 2.
"""
Expand All @@ -396,7 +367,6 @@ def test_ibsi_2_config_laws_filter(tmp_path):
configuration_id="4.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("laws_l5e5_energy_delta_7_invar_", "") for column_name in data.columns]
Expand Down Expand Up @@ -438,7 +408,6 @@ def test_ibsi_2_config_laws_filter(tmp_path):
configuration_id="4.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("laws_l5e5e5_energy_delta_7_invar_", "") for column_name in data.columns]
Expand All @@ -463,7 +432,7 @@ def test_ibsi_2_config_laws_filter(tmp_path):
assert (within_tolerance(11100, 300, data["stat_var"]))


def test_ibsi_2_config_gabor_filter(tmp_path):
def test_ibsi_2_config_gabor_filter():
"""
Compare computed feature values with reference values for configurations 5A and 5B of IBSI 2 phase 2.
"""
Expand All @@ -489,7 +458,6 @@ def test_ibsi_2_config_gabor_filter(tmp_path):
configuration_id="5.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("gabor_s_5.0_g_1.5_l_2.0_2D_", "") for column_name in data.columns]
Expand Down Expand Up @@ -534,7 +502,6 @@ def test_ibsi_2_config_gabor_filter(tmp_path):
configuration_id="5.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("gabor_s_5.0_g_1.5_l_2.0_3D_invar_", "") for column_name in data.columns]
Expand All @@ -559,7 +526,7 @@ def test_ibsi_2_config_gabor_filter(tmp_path):
assert (within_tolerance(231, 2, data["stat_var"]))


def test_ibsi_2_config_daubechies_filter(tmp_path):
def test_ibsi_2_config_daubechies_filter():
"""
Compare computed feature values with reference values for configurations 6A, 6B, 7A and 7B of IBSI 2 phase 2.
"""
Expand All @@ -582,7 +549,6 @@ def test_ibsi_2_config_daubechies_filter(tmp_path):
configuration_id="6.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_db3_lh_level_1_invar_", "") for column_name in data.columns]
Expand Down Expand Up @@ -624,7 +590,6 @@ def test_ibsi_2_config_daubechies_filter(tmp_path):
configuration_id="6.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_db3_llh_level_1_invar_", "") for column_name in data.columns]
Expand Down Expand Up @@ -666,7 +631,6 @@ def test_ibsi_2_config_daubechies_filter(tmp_path):
configuration_id="7.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_db3_hh_level_2_invar_", "") for column_name in data.columns]
Expand Down Expand Up @@ -708,7 +672,6 @@ def test_ibsi_2_config_daubechies_filter(tmp_path):
configuration_id="7.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_db3_hhh_level_2_invar_", "") for column_name in data.columns]
Expand All @@ -733,7 +696,7 @@ def test_ibsi_2_config_daubechies_filter(tmp_path):
assert (within_tolerance(422, 11, data["stat_var"]))


def test_ibsi_2_config_simoncelli_filter(tmp_path):
def test_ibsi_2_config_simoncelli_filter():
"""
Compare computed feature values with reference values for configurations 8A, 8B, 9A and 9B of IBSI 2 phase 2.
"""
Expand All @@ -753,7 +716,6 @@ def test_ibsi_2_config_simoncelli_filter(tmp_path):
configuration_id="8.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_simoncelli_level_1_", "") for column_name in data.columns]
Expand Down Expand Up @@ -792,7 +754,6 @@ def test_ibsi_2_config_simoncelli_filter(tmp_path):
configuration_id="8.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_simoncelli_level_1_", "") for column_name in data.columns]
Expand Down Expand Up @@ -830,7 +791,6 @@ def test_ibsi_2_config_simoncelli_filter(tmp_path):
configuration_id="9.A",
by_slice=True,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_simoncelli_level_2_", "") for column_name in data.columns]
Expand Down Expand Up @@ -869,7 +829,6 @@ def test_ibsi_2_config_simoncelli_filter(tmp_path):
configuration_id="9.B",
by_slice=False,
image_transformation_settings=image_transformation_settings,
tmp_path=tmp_path,
)

data.columns = [column_name.replace("wavelet_simoncelli_level_2_", "") for column_name in data.columns]
Expand Down

0 comments on commit 4ea7405

Please sign in to comment.