I am trying to create a plot using HCP workbench instead of using matplotlib. here is the base code snippet. would it be possible to swap the plotting section of the code to one that uses HCP workbench and nipype’s WBCommand() instead?
from nilearn import plotting, datasets, image
from nilearn.maskers import NiftiLabelsMasker
import matplotlib.pyplot as plt
# Load example atlas with labels
atlas = datasets.fetch_atlas_schaefer_2018(n_rois=100, yeo_networks=7)
atlas_filename = atlas['maps']
labels = atlas['labels']
# Load the Z map
z_map_filename = '/path/to/file/zmap_example_image.nii'
z_map_img = image.load_img(z_map_filename)
# Initialize the NiftiLabelsMasker with the atlas
labels_masker = NiftiLabelsMasker(labels_img=atlas_filename, standardize=True, memory='nilearn_cache')
# Extract the time series data (or in this case, the Z values) for each region
z_scores = labels_masker.fit_transform(z_map_img)
# Inverse transform to get the Z map back in image space
inverse_z_map_img = labels_masker.inverse_transform(z_scores)
# Plotting the inverse Z map with ROI labels
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
plotting.plot_roi(atlas_filename, bg_img=z_map_img, display_mode='ortho', draw_cross=True, title='ROIs with Z map overlay', axes=ax)
plt.show()