nipy / PySurfer

Cortical neuroimaging visualization in Python
https://pysurfer.github.io/
BSD 3-Clause "New" or "Revised" License
239 stars 98 forks source link

How to make split view's image closer to each other? #314

Open yusaiwen opened 2 years ago

yusaiwen commented 2 years ago

Hi.

When I drew brain of split view for lateral and medial views, the horizontal spacing is pretty large after save the image. Is there any method to reduce it?

code:

this_dir = opj(desc_dir, 'indvar')
for i in [1, 2, 3, 4, 5, 'all']:
    brain = Brain('fsaverage', 'split', 'inflated', background='white', size=600, views=['lat', 'med'], offscreen=True)

    lh_tmp = nib.load(opj(this_dir, 'lh'+str(i)+'.indvar.nii.gz')).get_fdata()
    lh = np.squeeze(lh_tmp)

    rh_tmp = nib.load(opj(this_dir, 'rh'+str(i)+'.indvar.nii.gz')).get_fdata()
    rh = np.squeeze(rh_tmp)

    brain.add_morphometry("curv", colormap="binary", min=-.8, max=.8, colorbar=False)
    brain.add_data(lh, hemi='lh', max=4, min=min, name='lh', transparent=True, colormap = 'PuRd', colorbar=False)
    brain.add_data(rh, hemi='rh', max=4, min=min, name='rh', transparent=True, colormap = 'PuRd', colorbar=False)
    desc_fname = opj(this_dir, 'indvar'+str(i)+'.png')
    brain.save_image(desc_fname)
    brain.close()

Image:

image

Many thanks Saiwen Yu