Page 1 of 1

pyanatomist / palette / load transformation

Posted: Fri Feb 14, 2014 11:01 am
by denghien
Hi Denis,

I have written a pyanatomist script in order to create many fusions between anatomy and map activation.
It works but :

1) I have a problem with the settings of palette. The value min and max (set in the script) are not the same
when the GUI of Anatomist is launched, I suppose that Anatomist set again the min and the max.
How can I keep the intial values ?
In the script, I use this line :
#palette and options
map_activation.setPalette("tvalues100-100-100", minVal=0.35, maxVal=0.65)

2) Data are in the "Talairach-MNI template-SPM". So I use the loadReferentialFromHeader() function, I'm looking for the ref of
Talairach-MNI template-SPM, then I load manually an identity tranformation between both referentials. I don't know wholly the API,
so is there a best way to do that ?


Re: pyanatomist / palette / load transformation

Posted: Fri Feb 14, 2014 2:07 pm
by riviere
Hi Isa,

1) By default setPalette() interprets minVal and maxVal parameters as relative values, which are mapped to the whole range of values of the object it is used for, so here it is 35% and 65% of the image min/max. But maybe you meant "absolute" values corresponding directly to image values. In this case you just have to add the additional optional parameter absoluteMode=True:

Code: Select all

map_activation.setPalette("tvalues100-100-100", minVal=0.35, maxVal=0.65, absoluteMode=True)

2) I don't know what you exactly load manually, but it depends wheter referential information is actually present in the image file or not. For instance if the image file (NIFTI file for instance) has the MNI referential code in its transforms, loadReferentialFromHeader() should be enough and you should not have anything to set manually. If the info is not present, you have to know that one of the referentials is actually the MNI one. You can set referentials and transformations in pyanatomist (using assignReferential(), mniTemplateRef, createTransformation() etc). If it's not enough you may show me your problem.


Re: pyanatomist / palette / load transformation

Posted: Thu Feb 20, 2014 12:15 pm
by denghien
Thanks Denis,
1) It's exactly what I need.

2) My user case is the second. I want to load an identity transformation between 2 referentials as in the anatomist GUI by using "Ctrl + left button". So I wonder if there
is a magic parameter or function instead of using something like

Code: Select all

 a.loadTransformation([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], ref_template, a.mniTemplateRef)