Skip to content

Fix/qsm gui nifti filter and lambda slider - #135

Merged
kschan0214 merged 2 commits into
masterfrom
fix/qsm-gui-nifti-filter-and-lambda-slider
Sep 20, 2026
Merged

kschan0214 merged 2 commits into
masterfrom
fix/qsm-gui-nifti-filter-and-lambda-slider

Conversation

@kschan0214

Copy link
Copy Markdown
Owner

No description provided.

Kwok Shing Chan and others added 2 commits September 19, 2026 21:46
The single semicolon-separated pattern '*.nii;*.nii.gz' in one filter
string is unreliable in newer MATLAB, particularly with the native
Linux file dialog, which doesn't handle a multi-extension list (and
especially the double extension *.nii.gz) the same way the old dialog
did. Split each filter into separate rows (combined pattern first as
the default, then individual *.nii and *.nii.gz entries), which works
consistently across MATLAB versions and platforms.
Three separate bugs prevented the MGF lambda parameter (a fractional
threshold, default 0.7) from being set to non-integer values:

- SliderStep was specified as a fraction of the slider range without
  accounting for Max-Min=4, so each step moved the value by a whole
  integer.
- PopupTwoPassMasking_Callback set the lambda slider's Value to the
  two-pass masking popup's own Value (its selected item's index)
  instead of the actual lambda value, causing the slider to jump to
  an unrelated integer whenever the MGF option was selected.
- The lambda edit field's callback was registered with
  isIntegerInput=true and bounds 0-10, rounding any typed value to
  the nearest integer and not matching the slider's 0-4 range.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@kschan0214
kschan0214 merged commit df0befb into master Sep 20, 2026
1 check passed
kschan0214 added a commit that referenced this pull request Sep 20, 2026
* Bump version to v1.3.0.1

Patch release covering the uigetfile NIfTI filter cross-platform fix
and the QSM MGF lambda slider/edit field integer-only bug fix merged
in #135.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix NIfTI filter not working on macOS uigetfile dialogs

The semicolon-separated combined pattern '*.nii;*.nii.gz' in a single
filter-spec string is not reliably filtered by macOS's native Cocoa
file dialog (unlike Windows/Linux), so having it as the default first
filter row broke file selection on Mac.

Replace it with the single wildcard pattern '*.nii*', which matches
both *.nii and *.nii.gz as one plain extension pattern and is filtered
consistently across Windows, Linux, and macOS.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Default NIfTI file dialogs to All Files to fix macOS .nii.gz visibility

macOS's native uigetfile dialog filters by a file's literal last
extension only, so it cannot match compound extensions like *.nii.gz
through any filter-string pattern (semicolon list or embedded
wildcard) - both previously tried approaches failed there.

Make 'All Files' the default filter row so every file is visible
regardless of platform, keeping *.nii and *.nii.gz as secondary,
explicit filter options for platforms where they do work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Use a plain '*.*' filter instead of a multi-row cell array for NIfTI dialogs

A multi-row filter cell array makes uigetfile show a file-type selector
popup on macOS. Reports show .nii.gz files appearing grayed out/
unselectable there, meaning the popup was defaulting to a more
restrictive row (e.g. *.nii) rather than the intended 'All Files' row,
regardless of row order.

Passing a single plain string ('*.*') instead of a cell array avoids
the type-selector popup entirely on every platform, so there's no
default row for the OS to pick incorrectly - all files are always
shown and selectable.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Use plain All-Files filter only on macOS; keep descriptive filters on Windows/Linux

Confirmed on Mac hardware: macOS's uigetfile file-type popup grays out
*.nii.gz when given the multi-row filter cell array, regardless of row
order or pattern used (semicolon list, '*.nii*' wildcard, or explicit
'All Files' row) - only a plain string filter with no type-selector
popup avoids this. But that plain filter loses the descriptive
*.nii/*.nii.gz filter options that already work correctly on
Windows/Linux.

New sepia_get_nifti_uigetfile_filter() centralises the platform check:
returns '*.*' on macOS, and the descriptive multi-row filter (combined
*.nii;*.nii.gz pattern first, then individual *.nii and *.nii.gz rows)
on other platforms. All 16 uigetfile call sites for NIfTI selection now
call this helper instead of hardcoding a filter spec.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Kwok Shing Chan <kc020@linen.nmr.mgh.harvard.edu>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant