Skip to content

Fixes for v2.2.7, mostly parallelization - #116

Closed
ckronlage wants to merge 8 commits into
MELDProject:mainfrom
ckronlage:fixes_v2.2.7
Closed

Fixes for v2.2.7, mostly parallelization#116
ckronlage wants to merge 8 commits into
MELDProject:mainfrom
ckronlage:fixes_v2.2.7

Conversation

@ckronlage

Copy link
Copy Markdown
  • Fixes that allow parallelizing MELD-graph inference (no hardcoded temp file paths, wrapper around open_hdf5_file that just retries it the file can't be opened in parallel)
  • Add --threads argument for calling freesurfer with multiple threads (also useful for parallelizing)
  • --skip-feature-plotting speeds up inference for big cohorts when these plots are not needed
  • Move the MELD-graph prediction outputs in surface space etc. to the predictions_reports/ folder, e.g.:
output/predictions_reports/sub-27/predictions
├── prediction.nii.gz
├── lh.prediction.nii.gz
├── rh.prediction.nii.gz
├── fsaverage_sym
│   ├── lh.prediction.mgh
│   └── rh.prediction.mgh
├── surf_native
│   ├── lh.prediction.mgh
│   └── rh.prediction.mgh
├── vol_freesurfer
│   ├── lh.prediction.mgz
│   └── rh.prediction.mgz
└── vol_native
    ├── lh.prediction.mgz
    └── rh.prediction.mgz

Which makes them easier to find and also avoids conflicts when running multiple predictions (with different harmo parameters) using the same freesurfer outputs.

  • Write the freesurfer expert-options fix for FLAIRpial segmentation to a per-subject file (instead of relying on the output/freesurfer_outputs directory to contain it)
  • Update docs to explain the changes and give an example of how inference can be parallelized for large cohorts

Cornelius Kronlage added 8 commits August 17, 2026 01:57
This is a hack to fix errors when running parallelized predictions (h5py.File() throws OSErrors)
Before, classifier prediction output intermediate files were saved to subfolders of the freesurfer subject folder (surf/, mri/, xhemi/classifier/) which caused conflicts when running parallel predictions using the same freesurfer outputs, e.g., with different harmonisation parameters.

Now, the outputs are saved to:
- predictions/fsaverage_sym/
- predictions/surf_native/
- predictions/vol_freesurfer/
- predictions/vol_native/
- predictions/prediction.nii.gz (final output, unchanged)
This allows separating the preprocessing step (cannot be parallelized) from the prediction step (can be parallelized). --skip_prediction is not the same as --harmo_only: The latter leaves out some feature extraction steps necessary for predictions.
--skip_feature_plotting just speeds the preprocessing, plots take a long time for many subjects and may not be needed.
@mathrip

mathrip commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

thanks for the changes, they're great. I've added this PR to the new version v2.2.7 and created a new PR #117

@mathrip mathrip closed this Aug 25, 2026
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.

2 participants