Skip to content

Commit

Permalink
Add 3rd order support (#68)
Browse files Browse the repository at this point in the history
* FSLeyes is not updated to support numpy 2.0

* Add support for 3rd order, fix bug with scanner orders for rt shimming, add test for rt

* Switch to indicate python 3.10
  • Loading branch information
po09i authored Jun 18, 2024
1 parent a832250 commit c580658
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- 'ubuntu-22.04'
- 'ubuntu-20.04'
python-version:
- '3.9'
- '3.10'

steps:
- name: Get home directory
Expand Down
16 changes: 8 additions & 8 deletions fsleyes_plugin_shimming_toolbox/components/run_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,21 @@ def get_run_args(self, st_function):
msg = "Running "
# Split is necessary if we have grouped commands (st_mask threshold)
command = st_function.split(' ')
for component in self.list_components:

for component in self.list_components:

cmd, output, load_in_overlay = component.get_command()
command.extend(cmd)
if st_function.split(' ')[-1] == "realtime-dynamic" and cmd[0] == "--coil":

if st_function.split(' ')[-1] == "realtime-dynamic" and cmd and cmd[0] == "--coil":
cmd_riro = ['--coil-riro' if i == '--coil' else i for i in cmd]
command.extend(cmd_riro)

self.load_in_overlay.extend(load_in_overlay)

if output:
self.output = output

msg += ' '.join(command) + '\n'

return command, msg
Expand Down
43 changes: 30 additions & 13 deletions fsleyes_plugin_shimming_toolbox/tabs/b0shim_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def create_sizer_dynamic_shim(self, metadata=None):
{
"label": "2",
"option_value": "2"
},
{
"label": "3",
"option_value": "3"
}
]

Expand All @@ -241,8 +245,8 @@ def create_sizer_dynamic_shim(self, metadata=None):
label="Scanner Order",
checkbox_metadata=checkbox_scanner_order_metadata,
option_name='scanner-coil-order',
components_dict=[{'object': dropdown_scanner_format, 'checkbox': ['f0', '1', '2']},
{'object': component_scanner, 'checkbox': ['f0', '1', '2']}],
components_dict=[{'object': dropdown_scanner_format, 'checkbox': ['f0', '1', '2', '3']},
{'object': component_scanner, 'checkbox': ['f0', '1', '2', '3']}],
)

dropdown_ovf_metadata = [
Expand Down Expand Up @@ -283,6 +287,10 @@ def create_sizer_dynamic_shim(self, metadata=None):
"label": "Mean Absolute Error",
"option_value": "mae",
},
{
"label": "Root Mean Squared Error",
"option_value": "rmse",
}
]

dropdown_crit = DropdownComponent(
Expand Down Expand Up @@ -520,7 +528,7 @@ def create_sizer_realtime_shim(self, metadata=None):
panel=self,
dropdown_metadata=dropdown_scanner_format_metadata,
label="Scanner Output Format",
option_name = 'output-file-format-scanner',
option_name='output-file-format-scanner',
cli=realtime_cli
)

Expand All @@ -531,12 +539,17 @@ def create_sizer_realtime_shim(self, metadata=None):
},
{
"label": "1",
"option_value": "0,1"
"option_value": "1"
},
{
"label": "2",
"option_value": "0,1,2"
}
"option_value": "2"
},
{
"label": "3",
"option_value": "3"
},

]

input_text_box_metadata_scanner = [
Expand All @@ -547,14 +560,14 @@ def create_sizer_realtime_shim(self, metadata=None):
},
]
component_scanner = InputComponent(self, input_text_box_metadata_scanner, cli=realtime_cli)

self.checkbox_scanner_order_rt = CheckboxComponent(
panel=self,
label="Scanner Order",
checkbox_metadata=checkbox_scanner_order_metadata,
option_name='scanner-coil-order',
components_dict=[{'object': dropdown_scanner_format, 'checkbox': ['f0', '1', '2']},
{'object': component_scanner, 'checkbox': ['f0', '1', '2']}],
components_dict=[{'object': dropdown_scanner_format, 'checkbox': ['f0', '1', '2', '3']},
{'object': component_scanner, 'checkbox': ['f0', '1', '2', '3']}],
additional_sizer_dict={'info text': None, 'label': 'Scanner Order RIRO',
'option name': 'scanner-coil-order-riro',
'checkbox metadata': checkbox_scanner_order_metadata}
Expand All @@ -575,7 +588,7 @@ def create_sizer_realtime_shim(self, metadata=None):
panel=self,
dropdown_metadata=dropdown_ovf_metadata,
label="Output Value Format",
option_name = 'output-value-format',
option_name='output-value-format',
cli=realtime_cli
)

Expand All @@ -598,6 +611,10 @@ def create_sizer_realtime_shim(self, metadata=None):
"label": "Mean Absolute Error",
"option_value": "mae",
},
{
"label": "Root Mean Squared Error",
"option_value": "rmse",
}
]

dropdown_crit = DropdownComponent(
Expand Down Expand Up @@ -659,7 +676,7 @@ def create_sizer_realtime_shim(self, metadata=None):
panel=self,
dropdown_metadata=dropdown_slice_metadata,
label="Slice Ordering",
option_name = 'slices',
option_name='slices',
list_components=[self.create_empty_component(),
component_slice_seq,
component_slice_int,
Expand All @@ -686,7 +703,7 @@ def create_sizer_realtime_shim(self, metadata=None):
panel=self,
dropdown_metadata=dropdown_fatsat_metadata,
label="Fat Saturation",
option_name = 'fatsat',
option_name='fatsat',
cli=realtime_cli
)

Expand All @@ -705,7 +722,7 @@ def create_sizer_realtime_shim(self, metadata=None):
panel=self,
dropdown_metadata=dropdown_coil_format_metadata,
label="Custom Coil Output Format",
option_name = 'output-file-format-coil',
option_name='output-file-format-coil',
cli=realtime_cli,
list_components=[self.create_empty_component(),
dropdown_fatsat]
Expand Down
2 changes: 1 addition & 1 deletion installer/install_shimming_toolbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rm -rf "${ST_DIR}/shimming-toolbox"

print info "Downloading Shimming-Toolbox"

ST_VERSION="7701d3ae54f1335c101b7d197b002a46a2e569d2"
ST_VERSION="cf28d353240fd510de1e8aa492c6c23ae57e66bd"

curl -L "https://github.com/shimming-toolbox/shimming-toolbox/archive/${ST_VERSION}.zip" > "shimming-toolbox-${ST_VERSION}.zip"

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
name='fsleyes-plugin-shimming-toolbox',
install_requires=[
"imageio",
'pre-commit>=2.10.0'
'pre-commit>=2.10.0',
'numpy<2.0'
],
packages=find_packages(exclude=['.git']),
include_package_data=True,
Expand Down
Loading

0 comments on commit c580658

Please sign in to comment.