diff --git a/src/thd_json/load_json.py b/src/thd_json/load_json.py index 56f91b2cda8ce539c432caf48b272d1b5cd0ede8..d76f1af0e6da9786092dcd12a45d258811983e39 100644 --- a/src/thd_json/load_json.py +++ b/src/thd_json/load_json.py @@ -6,4 +6,4 @@ def load_thd_meta_data(json_path: Path): if not json_path.suffix.endswith("json"): raise ValueError("Wrong data type. Input must be `.json`file.") meta_data = json.load(json_path.open()) - return meta_data \ No newline at end of file + return meta_data diff --git a/src/thd_json/load_projection.py b/src/thd_json/load_projection.py index 5e63117fc494066676c689d1003f947b8c588d5f..57ec531182f75a7cfcd835103ff6de2395e6872b 100644 --- a/src/thd_json/load_projection.py +++ b/src/thd_json/load_projection.py @@ -1,12 +1,11 @@ import numpy as np from PIL import Image -import json from pathlib import Path +from .load_json import load_thd_meta_data + def load_thd_projection(json_path: Path): - if not json_path.suffix.endswith("json"): - raise ValueError("Wrong data type. Input must be `.json`file.") - meta_data = json.load(json_path.open()) + meta_data = load_thd_meta_data(json_path) image = np.asarray(Image.open(json_path.parent / meta_data["image"]["image_path"])) return meta_data, image