Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ env*
*.pyc
.vscode
docs/_build/
docs/_autosummary/
docs/_autosummary/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -657,4 +657,4 @@ the specific requirements.
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU AGPL, see <https://www.gnu.org/licenses/>.
the GNU AGPL, see <https://www.gnu.org/licenses/>.
46 changes: 35 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
****
Home
****
========

Open-pyFUS is a toolbox for planning and controlling focused ultrasound treatments. It generally replicates the functionality developed in the MATLAB `open-TFUS toolbox <https://github.com/OpenwaterHealth/opw_neuromod_sw>`_.
``openlifu`` is a toolbox for planning and controlling focused
ultrasound treatments. It generally replicates the functionality
developed in the MATLAB `open-TFUS
toolbox <https://github.com/OpenwaterHealth/opw_neuromod_sw>`__.

Installation
------------

Requirements
^^^^^^^^^^^^
~~~~~~~~~~~~

Python 3.11

Create Virtual Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^
``cd open_pyfus``
``C:\Users\<uname>\AppData\Local\Programs\Python\Python311\python.exe -m venv env``
~~~~~~~~~~~~~~~~~~~~~~~~~~

Windows:

.. code:: sh

C:\Users\<uname>\AppData\Local\Programs\Python\Python311\python.exe -m venv env
.\env\Scripts\activate

Linux:

.. code:: sh

python3.11 -m venv env

Install project (editable)
^^^^^^^^^^^^^^^^^^^^^^^^^^
``.\env\Scripts\activate``
``pip install -e .``
~~~~~~~~~~~~~~~~~~~~~~~~~~

With this repo as the working directory:

.. code:: sh

pip install -e .

Disclaimer
----------
CAUTION - Investigational device. Limited by Federal (or United States) law to investigational use. The system described here has *not* been evaluated by the FDA and is not designed for the treatment or diagnosis of any disease. It is provided AS-IS, with no warranties. User assumes all liability and responsibility for identifying and mitigating risks associated with using this software.

CAUTION - Investigational device. Limited by Federal (or United States)
law to investigational use. The system described here has *not* been
evaluated by the FDA and is not designed for the treatment or diagnosis
of any disease. It is provided AS-IS, with no warranties. User assumes
all liability and responsibility for identifying and mitigating risks
associated with using this software.
1 change: 0 additions & 1 deletion __init__.py

This file was deleted.

Empty file added docs/_static/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions docs/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:show-inheritance:
:members:
:show-inheritance:
4 changes: 2 additions & 2 deletions docs/_templates/custom-module-template.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes
Expand Down Expand Up @@ -63,4 +63,4 @@
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% endblock %}
7 changes: 3 additions & 4 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
API Reference
=============

The top-level module containing most of the code is `pyfus`
The top-level module containing most of the code is ``openlifu``

.. autosummary::
.. autosummary::
:toctree: _autosummary
:template: custom-module-template.rst
:recursive:

pyfus

openlifu
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Open-pyFUS'
project = 'OpenLIFU-Python'
copyright = '2023, Openwater'
author = 'Openwater'
release = '0.1'
Expand Down
2 changes: 1 addition & 1 deletion docs/includeme.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.. include:: ../README.rst
.. include:: ../README.rst
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Welcome to open-PYFUS's documentation!
=========================================
Welcome to openlifu's documentation!
=========================================

.. toctree::
:maxdepth: 2
:caption: Contents:

includeme
api

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions test_notebooks/test_first.ipynb → notebooks/test_first.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"If you have my modified version of k-wave-python, install it with `pip install -e .` from the `k-wave-python` directory. If you don't have my modified version, you can install the original version with `pip install k-wave-python`. If you are using the original version, be sure to set `USE_GRIDWEIGHTS` to `False` in order to prevent `open_pyfus` from trying to use a nonexistent interface for loading the gridweights. \n",
"\n",
"Also, if you are using the original version, import `pyfus` takes _way_ longer (45s on my PC), presumably hanging on `import kwave`. For some reason, it wants to re-download the binaries every time, even though they are already present in the the installation directory. I've opened an issue on this: https://github.com/waltsims/k-wave-python/issues/366."
"Also, if you are using the original version, import `openlifu` takes _way_ longer (45s on my PC), presumably hanging on `import kwave`. For some reason, it wants to re-download the binaries every time, even though they are already present in the the installation directory. I've opened an issue on this: https://github.com/waltsims/k-wave-python/issues/366."
]
},
{
Expand All @@ -28,7 +28,7 @@
"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n",
"handler.setFormatter(formatter)\n",
"root.addHandler(handler)\n",
"import pyfus\n",
"import openlifu\n",
"import numpy as np"
]
},
Expand All @@ -55,7 +55,7 @@
"metadata": {},
"outputs": [],
"source": [
"arr = pyfus.Transducer.gen_matrix_array(nx=8, ny=8, pitch=4, kerf=.5, units=\"mm\", impulse_response=1e5)\n",
"arr = openlifu.Transducer.gen_matrix_array(nx=8, ny=8, pitch=4, kerf=.5, units=\"mm\", impulse_response=1e5)\n",
"arr.draw()"
]
},
Expand All @@ -72,11 +72,11 @@
"metadata": {},
"outputs": [],
"source": [
"pulse = pyfus.Pulse(frequency=400e3, duration=3/400e3)\n",
"sequence = pyfus.Sequence()\n",
"focal_pattern = pyfus.focal_patterns.Wheel(center=True, spoke_radius=5, num_spokes=5)\n",
"sim_setup = pyfus.SimSetup(dt=2e-7, t_end=100e-6)\n",
"protocol = pyfus.Protocol(\n",
"pulse = openlifu.Pulse(frequency=400e3, duration=3/400e3)\n",
"sequence = openlifu.Sequence()\n",
"focal_pattern = openlifu.focal_patterns.Wheel(center=True, spoke_radius=5, num_spokes=5)\n",
"sim_setup = openlifu.SimSetup(dt=2e-7, t_end=100e-6)\n",
"protocol = openlifu.Protocol(\n",
" pulse=pulse,\n",
" sequence=sequence,\n",
" focal_pattern=focal_pattern,\n",
Expand All @@ -96,7 +96,7 @@
"metadata": {},
"outputs": [],
"source": [
"pt = pyfus.Point(position=(0,0,30), units=\"mm\", radius=2)\n",
"pt = openlifu.Point(position=(0,0,30), units=\"mm\", radius=2)\n",
"pts = protocol.focal_pattern.get_targets(pt)\n",
"coords = protocol.sim_setup.get_coords()\n",
"params = protocol.seg_method.ref_params(coords)\n",
Expand All @@ -116,7 +116,7 @@
"metadata": {},
"outputs": [],
"source": [
"ds = pyfus.sim.run_simulation(arr=arr, \n",
"ds = openlifu.sim.run_simulation(arr=arr, \n",
" params=params, \n",
" delays=delays,\n",
" apod= apod,\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"import sys\n",
"sys.path.append(R'C:\\Users\\pjh7\\git\\k-wave-python')\n",
"import pyfus\n",
"import openlifu\n",
"from typing import List, Dict, Any, Tuple\n",
"import logging\n",
"import matplotlib.pyplot as plt\n",
Expand Down Expand Up @@ -40,7 +40,7 @@
],
"source": [
"\n",
"db = pyfus.database.Database(path=R'C:/Users/pjh7/Documents/dom/')\n",
"db = openlifu.database.Database(path=R'C:/Users/pjh7/Documents/dom/')\n",
"arr = db.load_transducer('vermon')\n",
"trans_matrix = np.array(\n",
" [[-1, 0, 0, 0],\n",
Expand All @@ -49,7 +49,7 @@
" [0, 0, 0, 1]])\n",
"arr.rescale(\"mm\")\n",
"arr.matrix = trans_matrix\n",
"pt = pyfus.geo.Point(position=(5,-60,-8), units=\"mm\", radius=2)\n",
"pt = openlifu.geo.Point(position=(5,-60,-8), units=\"mm\", radius=2)\n",
"plan = db.load_plan('example_plan')\n",
"plan.sim_grid.dt = 2e-7\n",
"plan.sim_grid.t_end = 100e-6\n",
Expand Down Expand Up @@ -107,7 +107,7 @@
}
],
"source": [
"ds, output = pyfus.sim.run_simulation(arr=arr, \n",
"ds, output = openlifu.sim.run_simulation(arr=arr, \n",
" params=params, \n",
" delays=delays,\n",
" apod= apod,\n",
Expand Down Expand Up @@ -411,12 +411,12 @@
"outputs": [],
"source": [
"\n",
"focal_pattern = pyfus.bf.RadialPattern(center=True, spoke_radius=5, num_spokes=5)\n",
"sim_grid = pyfus.bf.SimulationGrid(dt=2e-7, t_end=100e-6)\n",
"pulse = pyfus.bf.Pulse(frequency=400e3, duration=3/400e3)\n",
"sequence = pyfus.bf.Sequence()\n",
"bfp = pyfus.bf.BeamformingPlan()\n",
"plan = pyfus.plan.Plan(pulse=pulse,\n",
"focal_pattern = openlifu.bf.RadialPattern(center=True, spoke_radius=5, num_spokes=5)\n",
"sim_grid = openlifu.bf.SimulationGrid(dt=2e-7, t_end=100e-6)\n",
"pulse = openlifu.bf.Pulse(frequency=400e3, duration=3/400e3)\n",
"sequence = openlifu.bf.Sequence()\n",
"bfp = openlifu.bf.BeamformingPlan()\n",
"plan = openlifu.plan.Plan(pulse=pulse,\n",
" sequence=sequence,\n",
" focal_pattern=focal_pattern,\n",
" sim_grid=sim_grid,\n",
Expand Down
18 changes: 9 additions & 9 deletions test_notebooks/test_nifti.ipynb → notebooks/test_nifti.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"slicer_exe = R\"C:\\Users\\pjh7\\AppData\\Local\\NA-MIC\\Slicer 5.2.2\\Slicer.exe\"\n",
"import sys\n",
"sys.path.append(modified_kwave_path)\n",
"import pyfus\n",
"import openlifu\n",
"from typing import List, Dict, Any, Tuple\n",
"import logging\n",
"root = logging.getLogger()\n",
Expand Down Expand Up @@ -39,15 +39,15 @@
],
"source": [
"\n",
"arr = pyfus.Transducer.gen_matrix_array(nx=8, ny=8, pitch=4, kerf=.5, units=\"mm\", impulse_response=1e5)\n",
"arr = openlifu.Transducer.gen_matrix_array(nx=8, ny=8, pitch=4, kerf=.5, units=\"mm\", impulse_response=1e5)\n",
"trans_matrix = np.array(\n",
" [[-1, 0, 0, 0],\n",
" [0, .05, np.sqrt(1-.05**2), -105],\n",
" [0, np.sqrt(1-.05**2), -.05, 5],\n",
" [0, 0, 0, 1]])\n",
"arr.rescale(\"mm\")\n",
"arr.matrix = trans_matrix\n",
"pt = pyfus.Point(position=(5,-60,-8), units=\"mm\", radius=2)"
"pt = openlifu.Point(position=(5,-60,-8), units=\"mm\", radius=2)"
]
},
{
Expand All @@ -56,11 +56,11 @@
"metadata": {},
"outputs": [],
"source": [
"pulse = pyfus.Pulse(frequency=400e3, duration=3/400e3)\n",
"sequence = pyfus.Sequence()\n",
"focal_pattern = pyfus.focal_patterns.Wheel(center=True, spoke_radius=5, num_spokes=5)\n",
"sim_setup = pyfus.SimSetup(dt=2e-7, t_end=100e-6)\n",
"protocol = pyfus.Protocol(\n",
"pulse = openlifu.Pulse(frequency=400e3, duration=3/400e3)\n",
"sequence = openlifu.Sequence()\n",
"focal_pattern = openlifu.focal_patterns.Wheel(center=True, spoke_radius=5, num_spokes=5)\n",
"sim_setup = openlifu.SimSetup(dt=2e-7, t_end=100e-6)\n",
"protocol = openlifu.Protocol(\n",
" pulse=pulse,\n",
" sequence=sequence,\n",
" focal_pattern=focal_pattern,\n",
Expand Down Expand Up @@ -112,7 +112,7 @@
}
],
"source": [
"ds = pyfus.sim.run_simulation(arr=arr, \n",
"ds = openlifu.sim.run_simulation(arr=arr, \n",
" params=params, \n",
" delays=delays,\n",
" apod= apod,\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"metadata": {},
"outputs": [],
"source": [
"from pyfus.io.ustx import PulseProfile, DelayProfile, TxModule, Tx7332Registers, print_regs, TxArray, swap_byte_order\n",
"from openlifu.io.ustx import PulseProfile, DelayProfile, TxModule, Tx7332Registers, print_regs, TxArray, swap_byte_order\n",
"import numpy as np"
]
},
Expand Down
6 changes: 0 additions & 6 deletions pyfus/seg/seg_methods/tissue.py

This file was deleted.

6 changes: 0 additions & 6 deletions pyfus/seg/seg_methods/water.py

This file was deleted.

6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "open_pyfus"
name = "openlifu"
version = "0.1.0"
description = "Openwater Focused Ultrasound Toolkit"
dependencies = [
Expand All @@ -19,7 +19,3 @@ dependencies = [

[tool.setuptools]
include-package-data = false

[tool.setuptools.packages.find]
include = ["pyfus*"]
exclude = ["test*", "env*"]
Loading