bahanonu / ciatah

CIAtah (pronounced cheetah): a software package for calcium imaging analysis of one- and two-photon imaging datasets. Documentation: https://git.io/ciatah_docs. Formerly known as calciumImagingAnalysis (ciapkg).
https://git.io/ciatah_docs
MIT License
80 stars 20 forks source link

Cross-session cell alignment, signalSorter, and misc updates #19

Closed bahanonu closed 5 years ago

bahanonu commented 5 years ago
bahanonu commented 5 years ago

@omidm7

See this update, tested on the data you sent me and worked fine.

omidm7 commented 5 years ago

Thanks Biafra. I'm trying to run preprocessing with the new function updates but keep running into this error: image

It results in Fiji closing down, and no cropped output files.

bahanonu commented 5 years ago

@omidm7, refresh with most recent commit; tested on example data and don't run into that problem.

omidm7 commented 5 years ago

Awesome, I made it all the way through the pipeline. I even made it mostly through cross-session alignment, but hit this error near the end:

image

bahanonu commented 5 years ago

What settings are you inputting to computeMatchObjBtwnTrials (e.g. see below)? And if I recall correctly, you are using 2017b on OSX?

image

bahanonu commented 5 years ago

Also, if you run on the same dataset of 3 sessions you sent me previously, do you run into any issues?

omidm7 commented 5 years ago

I am using the default settings (1 round, 5 px, 0.4 threshold, blank, 2). I'm actually trying to align between two of the three data sets I sent you. (See folders below.)

image

bahanonu commented 5 years ago

@omidm7

Found the issue, appears some CNMF-E images during registration end up containing all zeros, causing a divide by zero issue (didn't encounter on Windows, but testing 2017a/2018b there, so might be specific to a low-level Matlab function in OSX 2017b). Fixed.

Check again with most recent pull request, ran it on that dataset using 2017b on OSX 10.10 and worked fine.

omidm7 commented 5 years ago

Do I need to run CNMF-e again for the fix to work? I tried cross-session alignment with the latest pull request and still got the same error. image

bahanonu commented 5 years ago

Odd, and you are running this on OSX Matlab 2017b with the same data that you sent me via Box? I could do a quick remote desktop session to check if there is something else if that'd be easier.

omidm7 commented 5 years ago

Yup! I just downloaded teamviewer. Lmk when you want to hop on!

bahanonu commented 5 years ago

Sounds good! Busy today, I'll shoot you an email when I'm free.

bahanonu commented 5 years ago

@omidm7

Checked code on your computer via Teamviewer and runs fine through computeMatchObjBtwnTrials and viewMatchObjBtwnSessions. I'll close this pull request pending no other issues on your side.

omidm7 commented 5 years ago

Thank you. Everything works fine on my end now.

omidm7 commented 5 years ago

Hey Biafra, question. In viewMatchObjbtwSessions there is a Global ID followed by 5 numbers. I assume those are the cell numbers in their respective sessions. (See below.) Is this information available as an output somewhere? I tried modelSaveMatchObjBtwnTrials to see if that would create an output file, but got the following error:

image

image

bahanonu commented 5 years ago

@omidm7

Can find the matrix with matching session IDs for the same cell across sessions at obj.globalIDs.m01. See below for description.

[M N] matrix with M = number of global IDs and N = each session. Each m,n pair specifies the index of that global obj m in the data of session n. If .globalIDs(m,n)==0, means no match was found.

modelSaveMatchObjBtwnTrials isn't supported yet (making it so users can more easily export the cross-session information), will add it in the next pull request.

omidm7 commented 5 years ago

Hey Biafra, all is working well. Thanks. One suggestion: A 'go to global ID' feature in viewMatchObjectsBetweenTrials would be super useful! Similar to the 'go to signal' feature you have in computeManualSortSignal. Right now I am using the left/right cursor to move through signals, but with 475 global IDs, it gets tough. :)

Omid

omidm7 commented 5 years ago

Also, there seems to be a disconnect between the global ID index given by obj.globalIDs.m01 vs the global ID index given by viewMatchObjectsBetweenTrials. For example, in the variables section below, global ID 3 should be assigned to cells in sessions 1, 3 and 4. But in the figure, the global ID list assigns global ID 3 to all five sessions. image

bahanonu commented 5 years ago

@omidm7

Great to hear. Yep! Will update that interface at some point to make more user friendly, been meaning to add some features/more information.

The interface sorts globalIDs by the maximum number of objects aligned, so it won't necessarily match that in obj.globalIDs.m01. I can change this as this may be confusing to some users