openlifu.db.session.Session¶
- class openlifu.db.session.Session(id: ~typing.Annotated[str | None, OpenLIFUFieldData(name='Session ID', description='ID of this session')] = None, subject_id: ~typing.Annotated[str | None, OpenLIFUFieldData(name='Subject ID', description='ID of the parent subject of this session')] = None, name: ~typing.Annotated[str | None, OpenLIFUFieldData(name='Session name', description='Session name')] = None, date_created: ~typing.Annotated[~datetime.datetime, OpenLIFUFieldData(name='Date created', description='Date of creation of the session')] = <factory>, date_modified: ~typing.Annotated[~datetime.datetime, OpenLIFUFieldData(name='Date modified', description='Date of modification of the session')] = <factory>, protocol_id: ~typing.Annotated[str | None, OpenLIFUFieldData(name='Protocol ID', description='ID of the protocol used for this session')] = None, volume_id: ~typing.Annotated[str | None, OpenLIFUFieldData(name='Volume ID', description='ID of the subject volume associated with this session')] = None, transducer_id: ~typing.Annotated[str | None, OpenLIFUFieldData(name='Transducer ID', description='ID of the transducer associated with this session')] = None, array_transform: ~typing.Annotated[~openlifu.geo.ArrayTransform, OpenLIFUFieldData(name='Array transform', description='The transducer affine transform matrix with units, situating the transducer in space')] = <factory>, targets: ~typing.Annotated[~typing.List[~openlifu.geo.Point], OpenLIFUFieldData(name='Targets', description='Targets saved to this session')] = <factory>, markers: ~typing.Annotated[~typing.List[~openlifu.geo.Point], OpenLIFUFieldData(name='Markers', description='Registration markers saved to this session')] = <factory>, attrs: ~typing.Annotated[dict, OpenLIFUFieldData(name='Custom attributes', description='Dictionary of additional custom attributes to save to the session')] = <factory>, virtual_fit_results: ~typing.Annotated[~typing.Dict[str, ~typing.List[~typing.Tuple[bool, ~openlifu.geo.ArrayTransform]]], OpenLIFUFieldData(name='Virtual fit results', description='Virtual fit results. This is a dictionary mapping target IDs to a list of (approval, transform) pairs')] = <factory>, transducer_tracking_results: ~typing.Annotated[~typing.List[~openlifu.db.session.TransducerTrackingResult], OpenLIFUFieldData(name='Tracking results', description='List of any transducer tracking results')] = <factory>)[source]¶
Bases:
objectClass representing an openlifu session, which consists essentially of a patient scan, a protocol to use, potential targets for sonication, and a transducer situated in the patient space.
- array_transform: Annotated[ArrayTransform, OpenLIFUFieldData(name='Array transform', description='The transducer affine transform matrix with units, situating the transducer in space')]¶
The transducer affine transform matrix with units, situating the transducer in space
- attrs: Annotated[dict, OpenLIFUFieldData(name='Custom attributes', description='Dictionary of additional custom attributes to save to the session')]¶
Dictionary of additional custom attributes to save to the session
- date_created: Annotated[datetime, OpenLIFUFieldData(name='Date created', description='Date of creation of the session')]¶
Date of creation of the session
- date_modified: Annotated[datetime, OpenLIFUFieldData(name='Date modified', description='Date of modification of the session')]¶
Date of modification of the session
- static from_dict(d: Dict)[source]¶
Create a session from a dictionary
- Parameters:
d – Dictionary of session parameters
- Returns:
Session object
- static from_file(filename)[source]¶
Create a Session from a file
- Parameters:
filename – Name of the file to read
- Returns:
Session object
- id: Annotated[str | None, OpenLIFUFieldData(name='Session ID', description='ID of this session')] = None¶
ID of this session
- markers: Annotated[List[Point], OpenLIFUFieldData(name='Markers', description='Registration markers saved to this session')]¶
Registration markers saved to this session
- name: Annotated[str | None, OpenLIFUFieldData(name='Session name', description='Session name')] = None¶
Session name
- protocol_id: Annotated[str | None, OpenLIFUFieldData(name='Protocol ID', description='ID of the protocol used for this session')] = None¶
ID of the protocol used for this session
- subject_id: Annotated[str | None, OpenLIFUFieldData(name='Subject ID', description='ID of the parent subject of this session')] = None¶
ID of the parent subject of this session
- targets: Annotated[List[Point], OpenLIFUFieldData(name='Targets', description='Targets saved to this session')]¶
Targets saved to this session
- to_json(compact: bool) str[source]¶
Serialize a Session to a json string
- Parameters:
compact – if enabled then the string is compact (not pretty). Disable for pretty.
Returns: A json string representing the complete Session object.
- transducer_id: Annotated[str | None, OpenLIFUFieldData(name='Transducer ID', description='ID of the transducer associated with this session')] = None¶
ID of the transducer associated with this session
- transducer_tracking_results: Annotated[List[TransducerTrackingResult], OpenLIFUFieldData(name='Tracking results', description='List of any transducer tracking results')]¶
List of any transducer tracking results
- virtual_fit_results: Annotated[Dict[str, List[Tuple[bool, ArrayTransform]]], OpenLIFUFieldData(name='Virtual fit results', description='Virtual fit results. This is a dictionary mapping target IDs to a list of (approval, transform) pairs')]¶
Virtual fit results. This is a dictionary mapping target IDs to a list of (approval, transform) pairs, where:
approval is a boolean indicating whether the specific virtual fit transform has been approved for sonication, and transform is a transducer transform generated by 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. The “approval” associated with each transform indicates whether the transform has been approved for sonication.
- volume_id: Annotated[str | None, OpenLIFUFieldData(name='Volume ID', description='ID of the subject volume associated with this session')] = None¶
ID of the subject volume associated with this session