diff --git a/pyproject.toml b/pyproject.toml index ba0facf..597890e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,29 +38,29 @@ classifiers = [ "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [ - "torch<=2.3.1", - "numpy<=2.0.0", - "natsort<=8.4.0", - "pandas<=2.2.2", - "dataclasses_json<=0.6.7", - "mrcfile<=1.5.0", - "scipy<=1.13.1", - "cvxpy<=1.5.2", - "POT<=0.9.3", - "aspire<=0.12.2", - "jupyter<=1.0.0", - "osfclient<=0.0.5", - "seaborn<=0.13.2", - "ipyfilechooser<=0.6.0", + "torch", + "numpy", + "natsort", + "pandas", + "dataclasses_json", + "mrcfile", + "scipy", + "cvxpy", + "POT", + "aspire", + "jupyter", + "osfclient", + "seaborn", + "ipyfilechooser", + "omegaconf" ] [project.optional-dependencies] dev = [ - "pytest<=8.2.2", + "pytest", "mypy", "pre-commit", "ruff", - "omegaconf<=2.3.0" ] [project.urls] diff --git a/src/cryo_challenge/_preprocessing/dataloader.py b/src/cryo_challenge/_preprocessing/dataloader.py index 2593c2a..4cc75d6 100644 --- a/src/cryo_challenge/_preprocessing/dataloader.py +++ b/src/cryo_challenge/_preprocessing/dataloader.py @@ -65,6 +65,8 @@ def validate_submission_config(self): raise ValueError(f"Pixel size not found for submission {key}") if "align" not in value.keys(): raise ValueError(f"Align not found for submission {key}") + if "flip" not in value.keys(): + raise ValueError(f"Flip not found for submission {key}") if not os.path.exists(value["path"]): raise ValueError(f"Path {value['path']} does not exist") diff --git a/src/cryo_challenge/_preprocessing/preprocessing_pipeline.py b/src/cryo_challenge/_preprocessing/preprocessing_pipeline.py index 5994e6e..926b2c1 100644 --- a/src/cryo_challenge/_preprocessing/preprocessing_pipeline.py +++ b/src/cryo_challenge/_preprocessing/preprocessing_pipeline.py @@ -107,6 +107,11 @@ def preprocess_submissions(submission_dataset, config): print(" Centering submission") volumes = center_submission(volumes, pixel_size=pixel_size_gt) + # flip handedness + if submission_dataset.submission_config[str(idx)]["flip"] == 1: + print(" Flipping handedness of submission") + volumes = volumes.flip(-1) + # align to GT if submission_dataset.submission_config[str(idx)]["align"] == 1: print(" Aligning submission to ground truth") diff --git a/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json b/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json index 87184aa..354060e 100644 --- a/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json +++ b/tests/data/unprocessed_dataset_2_submissions/submission_x/submission_config.json @@ -11,6 +11,7 @@ "align": 1, "box_size": 244, "pixel_size": 2.146, - "path": "tests/data/unprocessed_dataset_2_submissions/submission_x" + "path": "tests/data/unprocessed_dataset_2_submissions/submission_x", + "flip": 1 } -} \ No newline at end of file +} diff --git a/tutorials/1_tutorial_preprocessing.ipynb b/tutorials/1_tutorial_preprocessing.ipynb index 0c718e4..cc6a459 100644 --- a/tutorials/1_tutorial_preprocessing.ipynb +++ b/tutorials/1_tutorial_preprocessing.ipynb @@ -136,6 +136,7 @@ " 0: {\n", " \"name\": \"submission1\",\n", " \"align\": 0,\n", + " \"flip\": 0,\n", " \"box_size\": 144,\n", " \"pixel_size\": 1.073 * 2,\n", " \"path\": submission1_path.selected_path,\n", @@ -143,6 +144,7 @@ " 1: {\n", " \"name\": \"submission2\",\n", " \"align\": 1,\n", + " \"flip\": 1,\n", " \"box_size\": 288,\n", " \"pixel_size\": 1.073,\n", " \"path\": submission2_path.selected_path,\n",