Fork me on GitHub

pyhrf.jde.nrl.bigaussian module

class pyhrf.jde.nrl.bigaussian.BiGaussMixtureParamsSampler(do_sampling=True, use_true_value=False, val_ini=None, hyper_prior_type='Jeffreys', activ_thresh=4.0, var_ci_pr_alpha=2.04, var_ci_pr_beta=0.5, var_ca_pr_alpha=2.01, var_ca_pr_beta=0.5, mean_ca_pr_mean=5.0, mean_ca_pr_var=20.0)

Bases: pyhrf.xmlio.Initable, pyhrf.jde.samplerbase.GibbsSamplerVariable

#TODO : comment

I_MEAN_CA = 0
I_VAR_CA = 1
I_VAR_CI = 2
L_CA = 1
L_CI = 0
NB_PARAMS = 3
PARAMS_NAMES = ['Mean_Activ', 'Var_Activ', 'Var_Inactiv']
checkAndSetInitValue(variables)
computeWithJeffreyPriors(j, cardCIj, cardCAj)
computeWithProperPriors(j, cardCIj, cardCAj)
finalizeSampling()
getCurrentMeans()
getCurrentVars()
getOutputs()
get_string_value(v)
linkToData(dataInput)
parametersComments = {'activ_thresh': 'Threshold for the max activ mean above which the region is considered activating', 'hyper_prior_type': "Either 'proper' or 'Jeffreys'"}
parametersToShow = []
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

updateObsersables()
class pyhrf.jde.nrl.bigaussian.BiGaussMixtureParamsSamplerWithRelVar(do_sampling=True, use_true_value=False, val_ini=None, hyper_prior_type='Jeffreys', activ_thresh=4.0, var_ci_pr_alpha=2.04, var_ci_pr_beta=0.5, var_ca_pr_alpha=2.01, var_ca_pr_beta=0.5, mean_ca_pr_mean=5.0, mean_ca_pr_var=20.0)

Bases: pyhrf.jde.nrl.bigaussian.BiGaussMixtureParamsSampler

computeWithProperPriorsWithRelVar(nrlsj, j, cardCIj, cardCAj, wj)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.nrl.bigaussian.BiGaussMixtureParamsSamplerWithRelVar_OLD(do_sampling=True, use_true_value=False, val_ini=None, hyper_prior_type='Jeffreys', activ_thresh=4.0, var_ci_pr_alpha=2.04, var_ci_pr_beta=0.5, var_ca_pr_alpha=2.01, var_ca_pr_beta=0.5, mean_ca_pr_mean=5.0, mean_ca_pr_var=20.0)

Bases: pyhrf.jde.nrl.bigaussian.BiGaussMixtureParamsSampler

computeWithProperPriorsWithRelVar(nrlsj, j, cardCIj, cardCAj, wj)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.nrl.bigaussian.MixtureWeightsSampler(do_sampling=True, use_true_value=False, val_ini=None)

Bases: pyhrf.xmlio.Initable, pyhrf.jde.samplerbase.GibbsSamplerVariable

#TODO : comment

checkAndSetInitValue(variables)
getOutputs()
linkToData(dataInput)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

class pyhrf.jde.nrl.bigaussian.NRLSampler(do_sampling=True, val_ini=None, contrasts={}, do_label_sampling=True, use_true_nrls=False, use_true_labels=False, labels_ini=None, ppm_proba_threshold=0.05, ppm_value_threshold=0, ppm_value_multi_threshold=array([ 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2., 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3., 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4. ]), mean_activation_threshold=4, rescale_results=False, wip_variance_computation=False)

Bases: pyhrf.xmlio.Initable, pyhrf.jde.samplerbase.GibbsSamplerVariable

Class handling the Gibbs sampling of Neural Response Levels with a prior bi-gaussian mixture model. It handles independent and spatial versions.

  • Vincent, T., Risser, L., & Ciuciu, P. (2010). Spatially Adaptive Mixture Modeling for Analysis of fMRI Time Series. IEEE Transactions on Medical Imaging, 29(4), 1059–1074. https://doi.org/10.1109/TMI.2010.2042064
  • Makni, S., Idier, J., Vincent, T., Thirion, B., Dehaene-Lambertz, G., & Ciuciu, P. (2008). A fully Bayesian approach to the parcel-based detection-estimation of brain activity in fMRI. NeuroImage, 41(3), 941–969. https://doi.org/10.1016/j.neuroimage.2008.02.017
  • Sockel 2009 ICASSP (TODO: Complete reference)
CLASSES = array([0, 1])
CLASS_NAMES = ['inactiv', 'activ']
FALSE_NEG = 3
FALSE_POS = 2
L_CA = 1
L_CI = 0
PPMcalculus(apost_mean_activ, apost_var_activ, apost_mean_inactiv, apost_var_inactiv, labels_activ, labels_inactiv)

Function to calculate the probability that the nrl in voxel j, condition m, is superior to a given hreshold_value

ThresholdPPM(threshold_pval)
calcFracLambdaTilde(cond, c1, c2, variables)
checkAndSetInitLabels(variables)
checkAndSetInitNRL(variables)
checkAndSetInitValue(variables)
cleanMemory()
cleanObservables()
computeAA(nrls, destaa)
computeComponentsApost(variables, j, gTQg)
computeContrasts()
computeVarXhtQ(h, varXQ)
computeVarYTildeOpt(varXh)
compute_summary_stats()
countLabels(labels, voxIdx, cardClass)
finalizeSampling()
getClassifRate()
getFinalLabels(thres=None)
getOutputs()
getRocData(dthres=0.005)
get_final_summary()
initObservables()
init_contrasts()
linkToData(dataInput)
markWrongLabels(labels)
parametersComments = {'contrasts': 'Define contrasts as arithmetic expressions.\nCondition names used in expressions must be consistent with those specified in session data above'}
parametersToShow = ['contrasts']
printState(_)
reportDetection()
sampleLabels(cond, variables)
sampleNextAlt(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated.

sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

sampleNrlsParallel(varXh, rb, h, varLambda, varCI, varCA, meanCA, gTQg, variables)
sampleNrlsSerial(rb, h, varCI, varCA, meanCA, gTQg, variables)
samplingWarmUp(variables)

#TODO : comment

saveCurrentValue(it)
saveObservables(it)
updateObsersables()
class pyhrf.jde.nrl.bigaussian.NRLSamplerWithRelVar(do_sampling=True, val_ini=None, contrasts={}, do_label_sampling=True, use_true_nrls=False, use_true_labels=False, labels_ini=None, ppm_proba_threshold=0.05, ppm_value_threshold=0, ppm_value_multi_threshold=array([ 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2., 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3., 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4. ]), mean_activation_threshold=4, rescale_results=False, wip_variance_computation=False)

Bases: pyhrf.jde.nrl.bigaussian.NRLSampler

calcFracLambdaTildeWithIRRelCond(cond, c1, c2, variables, nbVox, moyqvoxj, t1, t2)
calcFracLambdaTildeWithRelCond(l, nbVox, moyqvoxj, t1, t2)
computeComponentsApostWithRelVar(variables, j, gTQg, w)
computeSumWAxh(wa, varXh)
computeVarYTildeOptWithRelVar(varXh, w)
computeWA(a, w, wa)
computemoyqvox(cardClass, nbVox)

Compute mean of labels in ROI (without the label of voxel i)

createWAxh(aXh, w)
deltaWCorr0(nbVox, moyqvoxj, t1, t2)
deltaWCorr1(nbVox, moyqvoxj, t1, t2)
sampleLabelsWithRelVar(cond, variables)
sampleNextInternal(variables)

Define the behaviour of the variable at each sampling step when its sampling is not activated. Must be overriden in child classes.

sampleNrlsParallelWithRelVar(varXh, rb, h, varLambda, varCI, varCA, meanCA, gTQg, variables, w)
sampleNrlsSerialWithRelVar(rb, h, gTQg, variables, w, t1, t2)
samplingWarmUp(variables)

#TODO : comment

subtractYtildeWithRelVar()
class pyhrf.jde.nrl.bigaussian.NRL_Multi_Sess_Sampler(parameters=None, xmlHandler=None, xmlLabel=None, xmlComment=None)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable

P_OUTPUT_NRL = 'writeResponsesOutput'
P_SAMPLE_FLAG = 'sampleFlag'
P_TrueNrlFilename = 'TrueNrlFilename'
P_USE_TRUE_NRLS = 'useTrueNrls'
P_VAL_INI = 'initialValue'
checkAndSetInitValue(variables)
cleanMemory()
computeAA(nrls, destaa)
computeComponentsApost(variables, m, varXh, s)
computeVarYTildeSessionOpt(varXh, s)
defaultParameters = {'TrueNrlFilename': None, 'initialValue': None, 'sampleFlag': True, 'useTrueNrls': False, 'writeResponsesOutput': True}
finalizeSampling()
getOutputs()
linkToData(dataInput)
parametersComments = {'TrueNrlFilename': 'Define the filename of simulated NRLs.\nIt is taken into account when NRLs is not sampled.'}
parametersToShow = ['writeResponsesOutput']
sampleNextAlt(variables)
sampleNextInternal(variables)
samplingWarmUp(variables)

#TODO : comment

saveCurrentValue(it)
class pyhrf.jde.nrl.bigaussian.Variance_GaussianNRL_Multi_Sess(parameters=None, xmlHandler=None, xmlLabel=None, xmlComment=None)

Bases: pyhrf.jde.samplerbase.GibbsSamplerVariable

P_SAMPLE_FLAG = 'sampleFlag'
P_USE_TRUE_VALUE = 'useTrueValue'
P_VAL_INI = 'initialValue'
checkAndSetInitValue(variables)
defaultParameters = {'initialValue': array([ 1.]), 'sampleFlag': False, 'useTrueValue': False}
linkToData(dataInput)
parametersToShow = ['useTrueValue']
sampleNextInternal(variables)