8000 Add PET volume processing: SUVR, ROI masking, projection to surface, SPM-petpve plugin by DiellorBasha · Pull Request #798 · brainstorm-tools/brainstorm3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add PET volume processing: SUVR, ROI masking, projection to surface, SPM-petpve plugin #798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

DiellorBasha
Copy link
Contributor

PET processing functionalities, extending the previously integrated PET import pipeline.

Features:

  • Atlas-based ROI masking, using existing '_volatlas' files in Brainstorm
  • Intensity rescaling (SUVR)
  • Volume-to-surface projection
  • GUI/dialog for collecting user input for PET processing
  • PETPVE plugin as an SPM toolbox

New functions:

  • process_pet.m: scriptable entry point for PET processing - used to chain together PET processing functions
  • panel_process_pet.m: GUI for collecting user input for PET processing - works with process_pet.m
  • mri_rescale.m: rescale intensity values (e.g. SUV/SUVR) using the mean value of a reference regions - works with panel_process_pet.m and mri_mask.m
  • mri_mask.m: bilateral ROI-based volume masking using atlas labels from supported atlases: "aseg", "Desikan-Killiany" and so on.
  • mri_interp_vol2tess.m: interpolates 3D PET volumes onto cortical surfaces

Please let me know if further modularization or code cleanup is needed. Thanks for reviewing!

DiellorBasha and others added 16 commits May 22, 2025 02:19
…_plugin

- Added PETPVE12 as a supported plugin in GetSupported(), with download URL, test file, and documentation.
- Extended LinkSpmToolbox (formerly LinkCatSpm) to handle both CAT12 and PETPVE12 using action codes:
    - 0/1/2 for CAT12 (delete/create/check link)
    - 3/4/5 for PETPVE12 (delete/create/check link)
- Updated InstalledFcn, UninstalledFcn, and LoadedFcn for both CAT12 and PETPVE12 to use the new LinkSpmToolbox action codes.
- Ensured plugin installation, linking, and uninstallation workflows are consistent for both toolboxes.
- Maintained backward compatibility for CAT12 and verified no regression/breaking in its functionality.
…alues in volume files. Primarily intended for calculating standardized uptake value ratios in PET volumes.

- Rescales volumes by the mean value of a specified ROI from an atlas.
- Supports both file and structure input, with optional subject context for structure input.
- Uses atlas region labels (from bst_get) for robust and consistent ROI selection.
- Handles output as either a new file (with unique file tag inserted before the last underscore-tag) or as a structure.
- Returns atlas labels, output file/struct, error message, and file tag for downstream processing.
- Designed to integrate with mri_mask and Brainstorm's subject/anatomy management.
- Enables flexible atlas-based PET/MRI SUVR normalization.
…pting/pipelines

- Iprocess_pet, a pipeline function for PET volume processing, for sequencing atlas-based SUVR rescaling and/or masking in a single workflow.
- process_pet minimizes redundant file saving by chaining operations in memory and saving the final result, with proper file tagging and history.
- Displays the processed PET volume on the subject's default MRI for immediate visualization.
-  panel_process_pet GUI to collect user options and call process_pet, enabling  user-friendly PET processing from the Brainstorm interface.
-  mri_interp_vol2tess projects MRI/PET/CT volumes onto cortical surfaces (pial, mid, white) using weighted interpolation,
- Enhanced panel_process_pet GUI: added "Project to surface" option
- Updated process_pet pipeline to accept and pass projection command to mri_interp_vol2tess.
- Added logic in bst_get to retrieve subject's atlas structures, including support for atlas label queries and subject context.
Added a new function, mri_mask, which enables masking of MRI volumes based on existing atlas regions. mri_mask uses atlas label lists from bst_get to obtain ROIs.
- mri_mask supports both file and structure input, outputs the masked MRI (file or struct), the file tag, and the binary mask used.
- mri_mask can be used to list available atlas regions in a given atlas file for the subject, generate a binary mask for a selected region, or save a masked MRI volume to disk, with full subject and atlas context.
- These changes add ROI-based masking functions and flexibility for atlas-based workflows in Brainstorm volumes
…UI for masking, SUVR calculation and surface projection
- Same action number regardless the Toolbox
- Toolbox name as argument
- Delete link when Unloading Toolbox (in case SPM is still loaded)
- Test installation wint `TestFile`
- Remove duplicated callback
- Remove unused arg in AtlasChanged_Callback
- Align for easier reading
e.g:
From:
`18Fflortaucipir_pet_spm_reslice_rescaled_aseg_cerebellum_masked_aseg_cerebellum_rescaled_aseg_cerebellum_masked_aseg_brainmask`
To:
`18Fflortaucipir_pet_spm_reslice_masked_aseg_cerebellum_rescaled_aseg_cerebellum_masked_aseg_brainmask`
Copy link
Member
@rcassani rcassani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DiellorBasha, everything looks fine

Just some questions to address before merging

Comment on lines +9 to +13
% - MriFileSrc : Source MRI file
% - MriFileRef : Reference MRI file
% - Condition : Condition name for the projection
% - TimeVector : Time vector for the results
% - DisplayUnits:
Copy link 10000
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description for DisplayUnits and ProjFrac are missing

vol2tess_mat = cell2mat(vol2tess);
map = vol2tess_mat * ProjFrac';
else
error('Surface vertex counts do not match. Cannot combine projections.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only consider the option of one "time" sample.
Why do we even have Time vector as input?

gui_component('MenuItem', jMenu, [], 'Realign frames', IconLoader.ICON_VOLPET, [], @(h,ev)PetImportProcess_Callback(PetFile));
% === PET PROCESSING ===
AddSeparator(jMenu);
gui_component('MenuItem', jMenu, [], 'Process volume', IconLoader.ICON_VOLPET, [], @(h,ev)bst_call(@gui_show_dialog, 'PET processing options', @panel_process_pet, 1, [], sSubject, PetFile));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a more specific name such as Compute SUVR values be ok?
Process volume is quite vague

% === PET PROCESSING ===
AddSeparator(jMenu);
gui_component('MenuItem', jMenu, [], 'Process volume', IconLoader.ICON_VOLPET, [], @(h,ev)bst_call(@gui_show_dialog, 'PET processing options', @panel_process_pet, 1, [], sSubject, PetFile));
gui_component('MenuItem', jMenu, [], 'Project to surface', IconLoader.ICON_SURFACE_CORTEX, [], @(h,ev)bst_call(@mri_interp_vol2tess, PetFile, [], 'PET'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Project volume to surface as option name?

Comment on lines +204 to +221

% === ANATOMY: PETPVE12 ===
PlugDesc(end+1) = GetStruct('petpve12');
PlugDesc(end).Version = 'latest';
PlugDesc(end).Category = 'Anatomy';
PlugDesc(end).AutoUpdate = 1;
PlugDesc(end).URLzip = 'https://github.com/GGonEsc/petpve12/archive/refs/heads/master.zip';
PlugDesc(end).URLinfo = 'https://multimodalneuroimaging.wordpress.com/software/';
PlugDesc(end).TestFile = 'tbx_cfg_petpve12.m';
PlugDesc(end).ReadmeFile = 'Contents.m';
PlugDesc(end).CompiledStatus = 0;
PlugDesc(end).RequiredPlugs = {'spm12'};
PlugDesc(end).InstalledFcn = 'LinkSpmToolbox(1, ''petpve12'');';
PlugDesc(end).UninstalledFcn = 'LinkSpmToolbox(0, ''petpve12'');';
PlugDesc(end).LoadedFcn = 'LinkSpmToolbox(2, ''petpve12'');';
PlugDesc(end).UnloadedFcn = 'LinkSpmToolbox(0, ''petpve12'');';
PlugDesc(end).ExtraMenus = {'Online tutorial', 'web(''https://github.com/GGonEsc/petpve12/blob/master/help/PETPVE12_manual.pdf'', ''-browser'')'};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPM toolbox PETPVE12 is added as Brainstorm plugin.
However, this is never used, does this belongs to a future development?

@rcassani
Copy link
Member

Ping @DiellorBasha

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
0