Visualizing an overlay image nicely in Display (ex. PC weights) - 7jw9/MASc GitHub Wiki

Let's assume you've just done a PCA and want to see how one of the PCs maps back on to your original image. Let's start with the R commands needed to get your PC into the right format:

library(RMINC) #Load the RMINC library
#Store the 1st PC from your analysis in the variable 'pc1'
pc1<-pca_object$rotation[,1]
dim(pc1)<-c(94,116,98) #Force the dimensions of 'pc1' to match the dimensions of your original image array
pc1_vol<-mincIO.asVolume(pc1,likeVolObject) #Turn your 'pc1' array into a MINC object using the RMINC command mincIO.asVolume. likeVolObject is a MINC volume for 'pc1' to use as a template (eg. your original image)
mincWriteVolume(pc1_vol,"pc1.mnc","/directory/filename.mnc") #Write your 'pc1_vol' MINC object out to a .mnc file. 

#In terminal

Display mni_template.mnc pc_image.mnc #mni template in /projects/julie/Masters/bpipe/bpipe_CAMH/mni_icbm152_gm_tal_nlin_sym_09c.mnc

#In Display,

S T - allows to switch between image are looking at

Toggle to mni template and change to greyscale

D D

Change threshold on left-hand bar- move to include all intensities

Toggle to PC image and change to spectral

D S

Change under colour to transparent

D Z, then in terminal type '0 0 0 0'

Change interpolation of PC image

Q S - default is nearest neighbour- change to trilinear

On image (still on PC), change threshold on left-hand bar

To hide cursor (for nice images)

F 4

Then screenshot