Skip to content

V2.2.7 - #117

Open
mathrip wants to merge 16 commits into
mainfrom
v2.2.7
Open

V2.2.7#117
mathrip wants to merge 16 commits into
mainfrom
v2.2.7

Conversation

@mathrip

@mathrip mathrip commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Minor changes

🔧 Enable parallelisation of inferences

Changes made over the code to enable robust parallelisation of the inferences. Contribution from Cornelius Kronlage

  • Fixes that allow parallelising 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 parallelised for large cohorts

🧠 Fix QC plotting
This fixes the FLAIR and T1 scans used to visualised Freesurfer surfaces and MELD prediction when using the script new_pt_qc_script.py. The scans are now chosen to be in the same space than Freesurfer outputs to avoid potential misalignment of FLAIR. Fixes issue #113

🧹 Other minor code cleanup : fixes issues #112 #115

Cornelius Kronlage and others added 16 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.
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