gclda.decode.decode_roi

gclda.decode.decode_roi(model, roi, topic_priors=None, prior_weight=1.0)[source]

Perform image-to-text decoding for discrete image inputs (e.g., regions of interest, significant clusters).

Parameters:
model : gclda.model.Model

Model object needed for decoding.

roi : nibabel.Nifti1Image or str

Binary image to decode into text. If string, path to a file with the binary image.

topic_priors : numpy.ndarray of float, optional

A 1d array of size (n_topics) with values for topic weighting. If None, no weighting is done. Default is None.

prior_weight : float, optional

The weight by which the prior will affect the decoding. Default is 1.

Returns:
decoded_df : pandas.DataFrame

A DataFrame with the word-tokens and their associated weights.

topic_weights : numpy.ndarray of float

The weights of the topics used in decoding.

Notes

Notation Meaning
v Voxel
t Topic
w Word type
r Region of interest (ROI)
p(v|t) Probability of topic given voxel (p_topic_g_voxel)
p(t|r) Probability of topic given ROI (topic_weights)
p(w|t) Probability of word type given topic (p_word_g_topic)
  1. Compute p(v|t).

  2. Compute topic weight vector (\tau_{t}) by adding across voxels within ROI.

    • \tau_{t} = \sum_{i} {p(t|v_{i})}
  3. Multiply \tau_{t} by p(w|t).

    • p(w|r) \propto \tau_{t} \cdot p(w|t)
  4. The resulting vector (word_weights) reflects arbitrarily scaled term weights for the ROI.