Skip to content

Conversation

@ebrahimebrahim
Copy link
Collaborator

@ebrahimebrahim ebrahimebrahim commented Feb 13, 2025

Closes #179

Session.virtual_fit_results

Virtual fit results take the form of a dictionary mapping target IDs
to pairs (approval, transforms), where:

  • approval is a boolean indicating whether the virtual fit for that target has been approved, and
  • transforms is a list of transducer transforms resulting from the virtual fit for that target.

The idea is that the list of transforms would be ordered from best to worst, and should of course
contain at least one transform.

standardize_database

This is a utility script for developers to read in and write back out the dvc database. It is useful for standardizing the format of the example dvc data, and also for checking that the database mostly still works.

I have been using this on my own to help catch little discrepancies that pop up between the example data and the openlifu library -- I figured it's probably good to version control it here under a scripts/ folder since it needs to evolve alongside the library.

To use this script, install openlifu to a python environment and then run the script providing the database folder as an argument:

python standardize_database.py db_dvc/

Parallel SlicerOpenLIFU PR

(todo)

Remaining to-do

@ebrahimebrahim ebrahimebrahim linked an issue Feb 13, 2025 that may be closed by this pull request
@ebrahimebrahim ebrahimebrahim force-pushed the 179-add-virtual-fit-transform-to-session-definition branch from 7d74ce1 to 094c651 Compare February 13, 2025 04:58
@ebrahimebrahim ebrahimebrahim marked this pull request as ready for review February 13, 2025 05:28
@ebrahimebrahim
Copy link
Collaborator Author

@arhowe00 This PR is coming in parallel to OpenwaterHealth/SlicerOpenLIFU#179 which probably @sadhana-r will end up reviewing. But this one should be merged first and is completed, so you can start reviewing it. Besides the new virtual fit result format, I lumped in a script I've been using from time to time to make sure we haven't broken the database. LMK if you have any questions or if you want to have a quick meeting to clarify what's going on with virtual fitting and all that. TY!

@arhowe00
Copy link
Contributor

Great job, I had just a few minor comments and questions. Also suggested adding checking the users table in your script.

@ebrahimebrahim ebrahimebrahim force-pushed the 179-add-virtual-fit-transform-to-session-definition branch 3 times, most recently from c890f29 to 8e18343 Compare February 17, 2025 22:20
@ebrahimebrahim
Copy link
Collaborator Author

(The rebase required merging the dvc data changes in main -- it was just the stuff you added in #214 -- should be good now)

[1.1, 0, 0, 0],
[0, 1.2, 0, 0],
[0, 0, 1.3, 0],
[0, 0.05, 0, 1.4]
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious -- why did you make the 4th row of this matrix like this, just to test, or is this an extra scaling transformation across all dimensions? I assume you apply this like $matrix@(x,y,z,1)^T$. I take it that in this case, you would then divide everything by $0.05y + 1.4$ after the scale and translation (in this case, no translation)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct, you would apply it like that. I think typically you would want to make the last row [0,0,0,1] which is probably what you were expecting. In this case I wasn't thinking anything fancy... I just want to stick any old 4x4 array in here and have tests that the array data is handled correctly -- not caring about the interpretation as an "affine transform".

@ebrahimebrahim
Copy link
Collaborator Author

Note to self: Do not merge yet please! I want to finish off OpenwaterHealth/SlicerOpenLIFU#179 first since this is a breaking change for SlicerOpenLIFU, and I don't want to cause trouble for other work you guys are doing on SlicerOpenLIFU

@ebrahimebrahim
Copy link
Collaborator Author

@arhowe00 I found a small issue and just pushed a fix, the commit message should explain it. Letting you know since you had already approved. Thanks!

ebrahimebrahim and others added 6 commits February 28, 2025 10:23
Virtual fit results take the form of a dictionary mapping target IDs
to pairs `(approval, transforms)`, where:

  `approval` is a boolean indicating whether the virtual fit for that target has been approved, and
  `transforms` is a list of transducer transforms resulting from the virtual fit for that target.

The idea is that the list of transforms would be ordered from best to worst, and should of course
contain at least one transform.
This is a follow up to #179 updating all sessions in the dvc data
to match the new format for virtual fit results
This is part of the ongoing example data curation, Issue #121

The script is pretty useful for catching little discrepancies between
the DVC data and the openlifu library, so I am adding it under scripts/
Co-authored-by: Andrew Howe <arhowe00@gmail.com>
Virtual fit transforms were being read in as lists and not properly
converted to arrays. Fixed, and added a test that would have caught
the issue.
@ebrahimebrahim ebrahimebrahim force-pushed the 179-add-virtual-fit-transform-to-session-definition branch from 9914dbc to 324603e Compare February 28, 2025 15:23
@ebrahimebrahim ebrahimebrahim enabled auto-merge (rebase) February 28, 2025 15:24
@ebrahimebrahim ebrahimebrahim merged commit eefe927 into main Feb 28, 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.

Add virtual fit transform to session definition

3 participants