Skip to content

Commit

Permalink
oops, some places we have REMODP instead of REMOPD, corrected now
Browse files Browse the repository at this point in the history
  • Loading branch information
spichardo committed Apr 5, 2024
1 parent 8754856 commit 12fab5a
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions BabelBrain/BabelBrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ def load_ui(self):
from Babel_H246.Babel_H246 import H246 as WidgetAcSim
elif self.Config['TxSystem'] =='BSonix':
from Babel_SingleTx.Babel_BSonix import BSonix as WidgetAcSim
elif self.Config['TxSystem'] =='REMODP':
from Babel_REMODP.Babel_REMODP import REMODP as WidgetAcSim
elif self.Config['TxSystem'] =='REMOPD':
from Babel_REMOPD.Babel_REMOPD import REMOPD as WidgetAcSim
elif self.Config['TxSystem'] =='I12378':
from Babel_I12378.Babel_I12378 import I12378 as WidgetAcSim
elif self.Config['TxSystem'] =='ATAC':
Expand Down
4 changes: 2 additions & 2 deletions BabelBrain/BabelBrain.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ commonDatas=[('Babel_H317/default.yaml','./Babel_H317'),
('Babel_CTX500/default.yaml','./Babel_CTX500'),
('Babel_SingleTx/default.yaml','./Babel_SingleTx'),
('Babel_SingleTx/defaultBSonix.yaml','./Babel_SingleTx'),
('Babel_REMODP/default.yaml','./Babel_REMODP'),
('Babel_REMOPD/default.yaml','./Babel_REMOPD'),
('Babel_I12378/default.yaml','./Babel_I12378'),
('Babel_ATAC/default.yaml','./Babel_ATAC'),
('default.yaml','./'),
Expand All @@ -23,7 +23,7 @@ commonDatas=[('Babel_H317/default.yaml','./Babel_H317'),
('Babel_CTX500/form.ui','./Babel_CTX500'),
('Babel_SingleTx/form.ui','./Babel_SingleTx'),
('Babel_SingleTx/formBx.ui','./Babel_SingleTx'),
('Babel_REMODP/form.ui','./Babel_REMODP'),
('Babel_REMOPD/form.ui','./Babel_REMOPD'),
('Babel_I12378/form.ui','./Babel_I12378'),
('Babel_ATAC/form.ui','./Babel_ATAC'),
('GUIComponents/scrollbars.ui','./GUIComponents'),
Expand Down
3 changes: 0 additions & 3 deletions BabelBrain/Babel_REMODP/Babel_REMODP.pyproject

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ def resource_path(): # needed for bundling
return os.path.split(Path(__file__))[0]

if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
bundle_dir = Path(sys._MEIPASS) / 'Babel_REMODP'
bundle_dir = Path(sys._MEIPASS) / 'Babel_REMOPD'
else:
bundle_dir = Path(__file__).parent

return bundle_dir

class REMODP(BabelBasePhaseArray):
class REMOPD(BabelBasePhaseArray):
def __init__(self,parent=None,MainApp=None):
super().__init__(parent=parent,MainApp=MainApp,formfile=os.path.join(resource_path(), "form.ui"))

Expand Down Expand Up @@ -98,11 +98,11 @@ def UpdateDistanceFromSkin(self):


def DefaultConfig(self):
#Specific parameters for the REMODP - to be configured later via a yaml
#Specific parameters for the REMOPD - to be configured later via a yaml

with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),'default.yaml'), 'r') as file:
config = yaml.safe_load(file)
print("REMODP configuration:")
print("REMOPD configuration:")
print(config)

self.Config=config
Expand Down Expand Up @@ -197,7 +197,7 @@ def RunSimulation(self):
self.UpdateAcResults()

def GetExport(self):
Export=super(REMODP,self).GetExport()
Export=super(REMOPD,self).GetExport()
Export['Refocusing']=self.Widget.RefocusingcheckBox.isChecked()
def dict_to_string(d, separator=', ', equals_sign='='):
return separator.join(f'{key}:{value*1000.0}' for key, value in d.items())
Expand Down Expand Up @@ -346,6 +346,6 @@ def run(self):

if __name__ == "__main__":
app = QApplication([])
widget = REMODP()
widget = REMOPD()
widget.show()
sys.exit(app.exec_())
3 changes: 3 additions & 0 deletions BabelBrain/Babel_REMOPD/Babel_REMOPD.pyproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"files": ["Babel_REMOPD.py","form.ui","default.yaml"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMODP</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMOPD</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
Expand Down Expand Up @@ -156,15 +156,15 @@
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Babel_REMODP.py</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">PythonEditor.RunConfiguration./Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMODP/Babel_REMODP.py</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMODP/Babel_REMODP.py</value>
<value type="QString" key="PythonEditor.RunConfiguation.Script">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMODP/Babel_REMODP.py</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Babel_REMOPD.py</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">PythonEditor.RunConfiguration./Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMOPD/Babel_REMOPD.py</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMOPD/Babel_REMOPD.py</value>
<value type="QString" key="PythonEditor.RunConfiguation.Script">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMOPD/Babel_REMOPD.py</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMODP</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Users/spichardo/Documents/GitHub/BabelBrain/BabelBrain/Babel_REMOPD</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions BabelBrain/CalculateFieldProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ def __del__(self):
from TranscranialModeling.BabelIntegrationH317 import RUN_SIM
elif TxSystem =='H246':
from TranscranialModeling.BabelIntegrationH246 import RUN_SIM
elif TxSystem =='REMODP':
from TranscranialModeling.BabelIntegrationREMODP import RUN_SIM
elif TxSystem =='REMOPD':
from TranscranialModeling.BabelIntegrationREMOPD import RUN_SIM
elif TxSystem =='I12378':
from TranscranialModeling.BabelIntegrationI12378 import RUN_SIM
elif TxSystem =='ATAC':
from TranscranialModeling.BabelIntegrationATAC import RUN_SIM
else:
raise ValueError("TX system " + TxSystem + " is not yet supported")

if TxSystem in ['H317','REMODP','I12378','ATAC']:
if TxSystem in ['H317','REMOPD','I12378','ATAC']:
if kargs['bDryRun']==False:
stdout = InOutputWrapper(queue,True)
else:
Expand All @@ -67,7 +67,7 @@ def __del__(self):
if 'bDryRun' in kargs:
bDryRun=kargs['bDryRun']
if kargs['bUseRayleighForWater']==False or bDryRun:
if TxSystem in ['H317','REMODP','I12378','ATAC']:
if TxSystem in ['H317','REMOPD','I12378','ATAC']:
kargs['bDoRefocusing']=False
if kargs['XSteering']==0.0:
kargs['XSteering']=1e-6
Expand Down Expand Up @@ -112,7 +112,7 @@ def __del__(self):
finalName=fnames[0].split('__Steer_X')[0]+send
combinedNifti.to_filename(finalName)

if TxSystem in ['H317','REMODP','I12378','ATAC']:
if TxSystem in ['H317','REMOPD','I12378','ATAC']:
kargs['bDryRun'] = True
FilesWater=R.RunCases(targets=Target,
bTightNarrowBeamDomain=True,
Expand Down
2 changes: 1 addition & 1 deletion BabelBrain/SelFiles/form.ui
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@
</item>
<item>
<property name="text">
<string>REMODP</string>
<string>REMOPD</string>
</property>
</item>
<item>
Expand Down
2 changes: 1 addition & 1 deletion BabelBrain/SelFiles/ui_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def retranslateUi(self, Dialog):
self.TransducerTypecomboBox.setItemText(2, QCoreApplication.translate("Dialog", u"H317", None))
self.TransducerTypecomboBox.setItemText(3, QCoreApplication.translate("Dialog", u"H246", None))
self.TransducerTypecomboBox.setItemText(4, QCoreApplication.translate("Dialog", u"BSonix", None))
self.TransducerTypecomboBox.setItemText(5, QCoreApplication.translate("Dialog", u"REMODP", None))
self.TransducerTypecomboBox.setItemText(5, QCoreApplication.translate("Dialog", u"REMOPD", None))
self.TransducerTypecomboBox.setItemText(6, QCoreApplication.translate("Dialog", u"I12378", None))
self.TransducerTypecomboBox.setItemText(7, QCoreApplication.translate("Dialog", u"ATAC", None))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,10 @@
" print(\"*\"*40)\n",
" raise RuntimeError(\"Error when running transcranial simulation!!\")\n",
"\n",
"def RunAcousticSimREMODP(T1W,\n",
"def RunAcousticSimREMOPD(T1W,\n",
" ID,\n",
" Frequency=300e3,\n",
" TxSystem='REMODP',\n",
" TxSystem='REMOPD',\n",
" deviceName='M1',\n",
" XSteering=0.0,\n",
" YSteering=0.0,\n",
Expand Down Expand Up @@ -630,7 +630,7 @@
"https://doi.org/10.5281/zenodo.7894431\n",
"\n",
"# Simulation settings\n",
"Simulations are run for four transducers available in BabelBrain: single element concave (with differnt focal lengths, apertures, and frequencies), CTX_500 (annular array), H317 (large 128-element concave phased array) and REMODP (256-element flat array).\n",
"Simulations are run for four transducers available in BabelBrain: single element concave (with differnt focal lengths, apertures, and frequencies), CTX_500 (annular array), H317 (large 128-element concave phased array) and REMOPD (256-element flat array).\n",
"\n",
"We keep only the Nifti files for the results of Rayleigh alone and FDTD.\n",
"\n",
Expand Down Expand Up @@ -1061,7 +1061,7 @@
"id": "23",
"metadata": {},
"source": [
"## Run Simulations for REMODP\n",
"## Run Simulations for REMOPD\n",
"\n"
]
},
Expand All @@ -1072,7 +1072,7 @@
"metadata": {},
"outputs": [],
"source": [
"TxSystem='REMODP'\n",
"TxSystem='REMOPD'\n",
"FrequenciesPPWs=[[250e3,[6,9]]]\n",
"XSteerings = [0.0, 10e-3,20e-3]\n",
"YSteerings = [0.0, 10e-3,20e-3]\n",
Expand Down Expand Up @@ -1147,7 +1147,7 @@
" PrevDate=time.ctime(os.path.getmtime(FDTDResults))\n",
" if os.path.isfile(RayleighResults):\n",
" PrevDateRayleigh=time.ctime(os.path.getmtime(RayleighResults))\n",
" RunAcousticSimREMODP(BasePath+T1W,\n",
" RunAcousticSimREMOPD(BasePath+T1W,\n",
" ID,\n",
" TxSystem=TxSystem,\n",
" deviceName=ComputingDevice,\n",
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ doi: [10.1109/TUFFC.2023.3274046](https://doi.org/10.1109/TUFFC.2023.3274046). E
- Improvement. No more need for Blender. We finally found a native Python CSG library that is robust enough to perform the geometry tasks we have been using with Blender until now. This has only a minor implication for those users running BabelBrain in their own Python environment (see details above about installing the `pycork` library). For those using the stand-alone applications, there is no impact other than Blender can be safely uninstalled if there is no more need for it.
- New: Support to new transducers. We added three new phased array devices: Two concave arrays and one flat 2D array. The I12378 transducer is a 128-element device operating at 650 kHz with a focal length of 72 mm and a diameter of 103 mm. The ATAC transducer is a 128-element device operating at 1 MHz with a focal length 53.2 mm and a diameter of 58 mm. The REMOPD transducer is a 256-element flat 2D array operating at 300 kHz with a diameter of 58 mm. We thank the team at Vanderbilt University for sharing the transducer definitions of their concave arrays (I12378 and ATAC transducers). We thank the team at Toronto Western Hospital and Fraunhofer IBMT for sharing the transducer definition of their REMOPD transducer.
- New: Automatic calculation for mechanical corrections in X and Y directions. After running a first pass of simulation in Step 2, a new button action is now available to calculate the distance from the target to the center of mass of the focal spot at -6dB and suggest applying the required mechanical corrections in X and Y directions. This action should help to minimize the number of iterations in simulations looking to ensure the focal spot is aligned in the X and Y directions to the intended target.
- New: Possibility to update thermal profile in Step 3. The initial design of BabelBrain assumed that the parameters of the timing of LIFU exposures would vary little in a study. That is why it is asked as initial input when initiating BabelBrain. However, some users have expressed their need to have more flexibility to explore variated settings without having to restart BabelBrain. For this purpose, we added in Step 3 a new action button that can be used to load a update the thermal profile file.
- New: Possibility to update thermal profile in Step 3. The initial design of BabelBrain assumed that the parameters of the timing of LIFU exposures would vary little in a study. That is why it is asked as initial input when initiating BabelBrain. However, some users have expressed their need to have more flexibility to explore variated settings without having to restart BabelBrain. For this purpose, we added in Step 3 a new action button that can be used to load an updated version of the thermal profile file.
- New: Multi-point LIFU exposures. BabelBrain now offers the possibility to execute electronic steering over a list of points if a concave array is selected. In the first dialog, if any of the three concave arrays is selected (H317, I12378 and ATAC), the user can select a new profile definition specific to multi-point steering. You can consult an example in the [Profiles](https://github.com/ProteusMRIgHIFU/BabelBrain/blob/main/Profiles/MultiFocus_Profile1.yaml) subdirectory in BabelBrain. Coordinates in the profile are relative to the user-specified steering in Step 2. Be aware that the selected duty cycle for the thermal simulations is split among all multi-point entries. It is assumed that a single burst is applied per steering location, before steering to the next location. For example, if simulating three-point steering with a duty cycle of 30%, this implies that each point will represent 10% of the duty cycle.
- New: Examples for offline batch processing. We added a couple of Jupyter notebooks in the [OfflineBatchExamples](https://github.com/ProteusMRIgHIFU/BabelBrain/tree/main/OfflineBatchExamples) directory in the BabelBrain repository, along with a README file indicating steps to create an environment ready to run these examples. These notebooks can be very useful when running very large parametric studies. For example, the [CompareRayleightWithFDTD](https://github.com/ProteusMRIgHIFU/BabelBrain/tree/main/OfflineBatchExamples/CompareRayleightWithFDTD) case is the one we used to study the acoustic simulations in water-only conditions that facilitate reducing the computational costs in Step 2.
- Fix: Occasionally, Step 1 would produce incomplete tissue masks when using high PPW values (9 and higher) or with high frequency ( 1 MHz) when using Metal-based devices. The GPU filtering functions were rewritten to cover better these cases or at least provide a more meaningful error message to notify the users.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ZDistance=-1.2e-3 #distance from Tx elements to outplane


def computeREMODPGeometry():
def computeREMOPDGeometry():
TxPos=loadmat(os.path.join(os.path.dirname(os.path.realpath(__file__)),'REMOPD_ElementPosition.mat'))['REMOPD_ElementPosition']
return TxPos

Expand Down Expand Up @@ -92,7 +92,7 @@ def GenerateREMOPDTx(subsetLimit=128,RotationZ=0.0):
TxElem=GenerateSingleElem()


transLoc = computeREMODPGeometry()
transLoc = computeREMOPDGeometry()

rotateMatrixZ = np.array([[-np.cos(RotationZ),np.sin(RotationZ),0],
[-np.sin(RotationZ),-np.cos(RotationZ),0],[0,0,1]])
Expand Down

0 comments on commit 12fab5a

Please sign in to comment.