using spec file to load surface in DriveSuma

Hi afni group,

I am showing data in surface world with suma_MNI152_2009.

What I usually do is to use the spec file std.141.MNI152_2009_lh.spec, and switch to the inflated surface.
command:


suma -spec std.141.MNI152_2009_lh.spec

When I tried to using DriveSuma to replicate what I did manaully,
with command :


DriveSuma -com show_surf -i std.141.lh.inflated.gii

It did show the inflated surface, but the sulcus and gyrus were not as what it looked like when using spec file manually. I checked the spec file, seems like there are other manipulations when you use spec file to choose the surface you want.

I wonder if there is one way to replicate the behaviors with DriveSuma?

Thanks!

best,
Meng

Hi Meng,

DriveSuma -com show_surf will actually send a new surface to suma. If you switch to that surface in suma before running DriveSuma, it shows it correctly. Otherwise, it does not.

The difference is probably that when using -com show_surf, with DriveSuma sending suma a new surface, suma then computes a new curvature colorization based on the inflated surface. But you want the colorization to be based on the parent, the smoothwm surface (which is stated in the spec file).

Note that if you switch to the inflated surface in suma before sending it via DriveSuma, the curvature is displayed as you hope. That is because suma already knows that surface, and has already connected the curvature to the smoothwm. But this is clearly not what you are hoping to need to do.

The solution is to not send it to suma as a new surface. Instead, just tell suma to switch to it, as you do with ‘.’ in the controller.

DriveSuma -com surf_cont -switch_surf inflated

Of course, run that after a clean start of suma, so it doesn’t still have the old curvature.

  • rick

Thanks for your reply! Got it worked!

While another bug of my code is that it does not save the image with the prefix that I defined with


export SUMA_AutoRecordPrefix="./${image_dir}/${image_pre}"

It still saved with the default prefix, which is /SUMA_Recordings/autorecord.jpg
Here is the full codes.


#!/bin/bash

#start a suma and wait it for 3 seconds
suma -spec std.141.MNI152_2009_lh.spec -niml &
sleep 3
echo "\n### load inflated surface"
DriveSuma -com viewer_cont -key:r2:d period 

# Remove crosshair and axes
DriveSuma -com viewer_cont -key F3 -key F4 -key F5

# Change viewer size to 400*400 pixels
DriveSuma -com viewer_cont -viewer_size 1200 1200

# zoom out and have the left lateral view 
DriveSuma -com viewer_cont -key:r2:d z -key 'Ctrl+left' -key a

# load dataset 
DriveSuma -com surf_cont -load_dset PPI.MVM.lh.niml.dset -surf_label inflated

# generate an array to store the index of the subbricks we need from MVM data
image_dir='PPI_img'
index=(`seq 4 2 12`)   # only have the beta value subbricks
subbrickLabel=("Liste_NS" "Listen_CS" "Listen_US" "Listen_SW" "Listen_CS-NS")
len=${#index[li]} # get the length of the conditions
[/li]
for ((i=0; i<=$len; i++))
do
	image_pre="${subbrickLabel[$i]}"
	Iindex="${index[$i]}" 			# set the index of intensity subbrick
	Tindex=$((Iindex + 1 ))			# set the index of t value subbrick
	
	# set the prefix of the images you save for each condition
	export SUMA_AutoRecordPrefix="./${image_dir}/${image_pre}"
	sleep 5
	echo $SUMA_AutoRecordPrefix
	sleep 5
	DriveSuma -com surf_cont -surf_label inflated \
		-I_sb $Iindex -T_sb $Tindex -I_range -0.9 \
			-switch_cmap "Spectrum:red_to_blue+gap"
	for pose in 'Ctrl+left' 'Ctrl+right' 'Ctrl+down'
	do
	# get view and snap
		DriveSuma -com viewer_cont -key "$pose" -com viewer_cont -key 'Ctrl+r'
	done
done

As you can see in the stdout in terminal:


.Done.
./PPI_img/Liste_NS
++ Environment variable SUMA_AutoRecordPrefix already set to './PPI_img/Liste_NS'. Value of './SUMA_Recordings/autorecord.jpg' from /home/mengxing/.sumarc is ignored. 
To kill such warnings Set AFNI_ENVIRON_WARNINGS to NO
SUMA_niml_call: Contacting on tcp:127.0.0.1:53219 (6), maximum wait 300.000 sec 
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)


Waiting for SUMA to close stream .++     Notice SUMA_niml_workproc (SUMA_niml.c:303 @21:11:31):
++ NIML connection opened from 127.0.0.1 on port 53219 (6th stream)
SUMA_niml_hangup: stream index 6
.Done.
++ Environment variable SUMA_AutoRecordPrefix already set to './PPI_img/Liste_NS'. Value of './SUMA_Recordings/autorecord.jpg' from /home/mengxing/.sumarc is ignored. 
To kill such warnings Set AFNI_ENVIRON_WARNINGS to NO
SUMA_niml_call: Contacting on tcp:127.0.0.1:53219 (6), maximum wait 300.000 sec 
(You can change max. wait time with env. SUMA_DriveSumaMaxWait)


Waiting for SUMA to close stream .++     Notice SUMA_niml_workproc (SUMA_niml.c:303 @21:11:31):
++ NIML connection opened from 127.0.0.1 on port 53219 (6th stream)
++     Notice SUMA_PixelsToDisk (SUMA_display.c:1802 @21:11:31):
Wrote image to ./SUMA_Recordings//autorecord.A.190405_211131.570.jpg

Even I commentted the line which defines the prefix and hope some magic would show up, but it did’t.

Have no idea why.

This is the afni version. My OS is Ubuntu 18.10

Precompiled binary linux_ubuntu_16_64: Mar 8 2019 (Version AFNI_19.0.24 ‘Tiberius’)

Thanks!
Meng

Hi Meng,

That prefix is used by suma, not by DriveSuma. DriveSuma just sends suma the commands.

You need to set that prefix variable before suma is started.

  • rick