gallantlab / pycortex

Pycortex is a python-based toolkit for surface visualization of fMRI data
https://gallantlab.github.io/pycortex
BSD 2-Clause "Simplified" License
581 stars 137 forks source link

(vertexroi branch) One pass of ROIpack.to_svg() makes broken rois, a second pass fixes them #71

Open andrewolaughlin opened 10 years ago

andrewolaughlin commented 10 years ago

I was testing out how to draw rois from vertexdata so I translated from svg to vertexdata back to svg. Eventually I'll be making my own masks

first I make a copy of db/AH to AH2 and AH3 in ipython I run:

import cortex
from cortex.rois import *

rp = ROIpack('AH','./pycortex/db/AH/rois.svg')
rp.to_npz('testnpz')

rpAH2 = ROIpack('AH2','testnpz.npz')

rpAH2.to_svg()
#will give a svg file in the /tmp directory

I move the svg from temp into AH2/rois.svg then I do another pass of the same code where AH-> AH2 and AH2 -> AH3

The first pass gives this image. Note RSC on the RH selection_002

The second pass gives this selection_001

And for comparison, this was the original selection_003

I realize this is fairly benign but would there be any benefit to always running it twice automatically or is this just a weird edge-case? Anyway, RSC still doesn't look quite right the second time

And while I have your attention may I ask how you draw those rois? It appears they've been set before you flatten the image, so I'm guessing they're not drawn in inkscape by hand

alexhuth commented 10 years ago

Hey Andrew -- Yeah this is a problem. This post nicely illustrates some of the issues of converting between SVG and vertex-based ROI definitions. The problem that you're seeing here arises from ROIs that either exit the flatmap (as right hem. RSC is doing ever so slightly in this case) or cross over a cut. So yeah, this is just a weird (literally) edge case. I tried to fix these problems earlier but obviously was not successful. I'll fix this bug and get back to you.

And to answer your last question: these ROIs were all drawn in by hand in inkscape (or omnigraffle) on this flatmap. They were based on retinotopic maps, object localizers, motor localizers, etc.