Skip to content

Conversation

@peterhollender
Copy link
Contributor

Closes #347

@peterhollender peterhollender linked an issue Jun 13, 2025 that may be closed by this pull request
Copy link
Collaborator

@ebrahimebrahim ebrahimebrahim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This would have been caught by the test

@pytest.mark.parametrize("compact_representation", [True, False])
def test_serialize_deserialize_protocol(example_protocol : Protocol, compact_representation: bool):
assert example_protocol.from_json(example_protocol.to_json(compact_representation)) == example_protocol

but I am guessing it didn't get caught because the protocol used for testing doesn't have any target constraints:

Can you add some target constraints to tests/resources/example_db/protocols/example_protocol/example_protocol.json in this PR? Or I can, lmk

@peterhollender
Copy link
Contributor Author

Thank you! This would have been caught by the test

@pytest.mark.parametrize("compact_representation", [True, False])
def test_serialize_deserialize_protocol(example_protocol : Protocol, compact_representation: bool):
assert example_protocol.from_json(example_protocol.to_json(compact_representation)) == example_protocol

but I am guessing it didn't get caught because the protocol used for testing doesn't have any target constraints:

Can you add some target constraints to tests/resources/example_db/protocols/example_protocol/example_protocol.json in this PR? Or I can, lmk

This actually actually raises another issue, which is that by default Point objects have x, y, and z dims, but when we create solutions, we give those DataArrays lat, ele, and ax dims in transducer coordinate space. Similarly, when SlicerOpenLIFU converts and RAS point into transducer space, it makes that point use x, y, and z. So when I define target_constraints, I need to use x, y and z to be compatible with Slicer (as well as generic Point objects in scripts`, even though "transducer coordinates" will use lat, ele, ax...

@ebrahimebrahim
Copy link
Collaborator

This actually actually raises another issue, which is that by default Point objects have x, y, and z dims, but when we create solutions, we give those DataArrays lat, ele, and ax dims in transducer coordinate space. Similarly, when SlicerOpenLIFU converts and RAS point into transducer space, it makes that point use x, y, and z. So when I define target_constraints, I need to use x, y and z to be compatible with Slicer (as well as generic Point objects in scripts`, even though "transducer coordinates" will use lat, ele, ax...

Is this something we can fix in SlicerOpenLIFU? We can make it us lat, ele, ax if it is mis-using x,y,z somewhere

Copy link
Collaborator

@ebrahimebrahim ebrahimebrahim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty for updating the test data!

@ebrahimebrahim ebrahimebrahim merged commit 987b932 into main Jun 13, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protocols do not serialize TargetConstraints

3 participants