Skip to main content
. 2019 Jan 17;8:e38173. doi: 10.7554/eLife.38173
Algorithm 3: SeededInitialization
Require: Input data matrix Y, matrix of binary masks M, number of background components nb.
1: p=find(M1==0) Find the pixels not covered by any component.
2: [,f]NNMF(Y[p,:],nb) Run NMF on these pixels just to get temporal backgrounds f
3: bargminb0Ybf Obtain spatial background b.
4: Cmax((MM)1M(Ybf),0) Initialize temporal traces.
5: AargminA0,A(M)==0YbfAC. Initialize spatial footprints constrained within the masks.
6: repeat Optionally keep updating A,C,𝐛,𝐟 using HALS
7: [b,f]NNMF(YAC,nb)
8: CargminC0YbfAC
9: AargminA0,A(M)==0YbfAC
10: until Convergence
11: return A,C,𝐛,𝐟