Skip to content
Snippets Groups Projects
Commit 1613a072 authored by Simon Wittl's avatar Simon Wittl
Browse files

switch header

parent 4e15dee9
No related branches found
No related tags found
No related merge requests found
...@@ -58,7 +58,7 @@ from thd_json.projection import get_projection_validator ...@@ -58,7 +58,7 @@ from thd_json.projection import get_projection_validator
from pathlib import Path from pathlib import Path
FILE = Path("./examples/thd_json/test_thd.json") FILE = Path("./examples/generated/example_projection.json")
def main(): def main():
......
{ {
"timestamp": "2000-01-01T00:00:00Z",
"uuid": "" "uuid": ""
} }
\ No newline at end of file
...@@ -5,14 +5,11 @@ ...@@ -5,14 +5,11 @@
"pixel_pitch_height_mm": 0.001, "pixel_pitch_height_mm": 0.001,
"pixel_pitch_width_mm": 0.001 "pixel_pitch_width_mm": 0.001
}, },
"header": {
"timestamp": "2000-01-01T00:00:00Z",
"uuid": ""
},
"image": { "image": {
"image_path": ".tif", "header": {
"timestamp": "2000-01-01T00:00:00Z", "uuid": ""
"uuid": "" },
"image_path": ".tif"
}, },
"projection_geometry": { "projection_geometry": {
"detector_center_orientation_quat": [ "detector_center_orientation_quat": [
...@@ -30,6 +27,9 @@ ...@@ -30,6 +27,9 @@
0.0, 0.0,
0.0, 0.0,
0.0 0.0
] ],
"header": {
"uuid": ""
}
} }
} }
\ No newline at end of file
{ {
"header": { "header": {
"timestamp": "2000-01-01T00:00:00Z",
"uuid": "" "uuid": ""
}, },
"roi_center_position_mm": [ "roi_center_position_mm": [
......
{ {
"timestamp": "2000-01-01T00:00:00Z", "header": {
"uuid": "", "uuid": ""
},
"volume_path": ".tif" "volume_path": ".tif"
} }
\ No newline at end of file
...@@ -3,7 +3,6 @@ from thd_json.projection import get_projection_validator ...@@ -3,7 +3,6 @@ from thd_json.projection import get_projection_validator
from thd_json.header import get_header_validator from thd_json.header import get_header_validator
from thd_json.source import get_source_validator from thd_json.source import get_source_validator
from thd_json.detector import get_detector_validator from thd_json.detector import get_detector_validator
from thd_json.image import get_image_validator
from thd_json.roi import get_roi_validator from thd_json.roi import get_roi_validator
from thd_json.volume import get_volume_validator from thd_json.volume import get_volume_validator
from hypothesis import given, settings from hypothesis import given, settings
...@@ -20,7 +19,7 @@ def main(): ...@@ -20,7 +19,7 @@ def main():
("header", get_header_validator), ("header", get_header_validator),
("source", get_source_validator), ("source", get_source_validator),
("detector", get_detector_validator), ("detector", get_detector_validator),
("image", get_image_validator), # ("image", get_image_validator),
("roi", get_roi_validator), ("roi", get_roi_validator),
("volume", get_volume_validator), ("volume", get_volume_validator),
]: ]:
......
...@@ -2,7 +2,7 @@ from thd_json.projection import get_projection_validator ...@@ -2,7 +2,7 @@ from thd_json.projection import get_projection_validator
from pathlib import Path from pathlib import Path
FILE = Path("./examples/thd_json/test_thd.json") FILE = Path("./examples/generated/example_projection.json")
def main(): def main():
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
} }
}, },
"required": [ "required": [
"timestamp",
"uuid" "uuid"
], ],
"additionalProperties": false "additionalProperties": false
......
...@@ -5,15 +5,8 @@ ...@@ -5,15 +5,8 @@
"version": 0.6, "version": 0.6,
"date": "19.11.2024", "date": "19.11.2024",
"properties": { "properties": {
"timestamp": { "header": {
"type": "string", "$ref": "../header/header.json"
"description": "Timestamp, e.g. 2018-11-13T20:20:39+00:00",
"format": "date-time"
},
"uuid": {
"type": "string",
"description": "Unique identifier",
"format": "uuid"
}, },
"image_path": { "image_path": {
"type": "string", "type": "string",
...@@ -22,8 +15,7 @@ ...@@ -22,8 +15,7 @@
} }
}, },
"required": [ "required": [
"timestamp", "header",
"uuid",
"image_path" "image_path"
], ],
"additionalProperties": false "additionalProperties": false
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
"version": 0.6, "version": 0.6,
"date": "19.11.2024", "date": "19.11.2024",
"properties": { "properties": {
"header": {
"$ref": "./header/header.json"
},
"image": { "image": {
"$ref": "./image/image.json" "$ref": "./image/image.json"
}, },
"projection_geometry": { "projection_geometry": {
"$ref": "./projection_geometry/projection_geometry.json" "$ref": "./projection_geometry/projection_geometry.json"
}, },
"projection_geometry_nominal": {
"$ref": "./projection_geometry/projection_geometry.json"
},
"detector": { "detector": {
"$ref": "./detector/detector.json" "$ref": "./detector/detector.json"
}, },
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
} }
}, },
"required": [ "required": [
"header",
"projection_geometry", "projection_geometry",
"detector", "detector",
"image" "image"
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
"version": 0.6, "version": 0.6,
"date": "19.11.2024", "date": "19.11.2024",
"properties": { "properties": {
"header": {
"$ref": "../header/header.json"
},
"focal_spot_position_mm": { "focal_spot_position_mm": {
"type": "array", "type": "array",
"description": "Position of the focal spot in millimeters.", "description": "Position of the focal spot in millimeters.",
...@@ -61,6 +64,7 @@ ...@@ -61,6 +64,7 @@
} }
}, },
"required": [ "required": [
"header",
"focal_spot_position_mm", "focal_spot_position_mm",
"detector_center_position_mm", "detector_center_position_mm",
"detector_center_orientation_quat" "detector_center_orientation_quat"
......
...@@ -39,9 +39,10 @@ class Validator: ...@@ -39,9 +39,10 @@ class Validator:
return True return True
def get_schema(self): def get_schema(self):
schema_path = self.json_schema.parent.absolute().as_uri()
with open(str(self.json_schema)) as schema_file: with open(str(self.json_schema)) as schema_file:
schema = json.load(schema_file) schema = json.load(schema_file)
schema_path = self.json_schema.parent.absolute().as_uri()
resolver = RefResolver(base_uri=schema_path, referrer=schema) resolver = RefResolver(base_uri=schema_path, referrer=schema)
return self.resolve_ref(resolver, schema) return self.resolve_ref(resolver, schema)
......
...@@ -5,15 +5,8 @@ ...@@ -5,15 +5,8 @@
"version": 0.6, "version": 0.6,
"date": "20.11.2024", "date": "20.11.2024",
"properties": { "properties": {
"timestamp": { "header": {
"type": "string", "$ref": "./header/header.json"
"description": "Timestamp, e.g. 2018-11-13T20:20:39+00:00",
"format": "date-time"
},
"uuid": {
"type": "string",
"description": "Unique identifier",
"format": "uuid"
}, },
"volume_path": { "volume_path": {
"type": "string", "type": "string",
...@@ -22,8 +15,7 @@ ...@@ -22,8 +15,7 @@
} }
}, },
"required": [ "required": [
"timestamp", "header",
"uuid",
"volume_path" "volume_path"
], ],
"additionalProperties": false "additionalProperties": false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment