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

Turboreg issue in CIAtah 4.0.0 #92

Closed omidm7 closed 2 years ago

omidm7 commented 2 years ago

Hi Biafra,

I'm running CIAtah 4.0 on MATLAB R2020b, on a mac. So far, the speed of the functions and UI are a huge improvement from the previous version! Things run a lot more smoothly. In the preprocessing step, after the videos are cropped for motion correction, I get the following error:

image

Omid

bahanonu commented 2 years ago

Hi Omid, glad to hear about speed/UI! For that error looks like MATLAB can't find the turboreg MEX file:

omidm7 commented 2 years ago

Thanks, indeed the turboreg C folder was not included in the MATLAB path. However, when I added all external programs to the path, I get this error when trying to initialize:

image

omidm7 commented 2 years ago

^^ Ok, I was able to get around this issue by adding turboreg to the path after initializing CIAtah. I might have to do the same with cnmfe. Will let you know if I encounter anything else along the pipeline. Thanks Biafra!

bahanonu commented 2 years ago

If you remove the _external_programs sub-directories from your path and run ciapkg.loadBatchFxns(); before running obj = ciatah(); do you still get that error?

For cnmfe, it is on purpose not loaded into the path by default (since the repo is not inside a package and want to avoid namespace conflicts with CNMF, etc.) unless you are running cell extraction via modelExtractSignalsFromMovie. Same with EXTRACT, CNMF, etc.

I'll push an update that should eliminate the diverging_map error (i.e. by try-catching calls to _external_programs functions while ciatah class is being initialized). I'm not getting that error with a fresh repo pull on MATLAB 2020b in Windows 10 but since it's not required, better to minimize the chance of any cross-OS issues.

omidm7 commented 2 years ago

When I remove _external_programs sub-directories from the path and run ciapkg.loadBatchFxns():, I do not get that error. I attached the output below.

Ok, so in the future, I add turboreg to the path manually, but CNMFe will be loaded through modelExtractSignalsFromMovie.

image

bahanonu commented 2 years ago

Sounds good, and I assume obj = ciatah(); loads without error now?

Turboreg should be loaded automatically (so no need for manual path adding), but I'll add an additional check within modelPreprocessMovie and ciapkg.api.turboregMovie to ensure that it is (in case user changes matlab path between loading ciatah and calling either function/method).

omidm7 commented 2 years ago

Great! And yes, obj = ciatah loads without error when I haven't added the entire _external_programs sub-directory to the path.

omidm7 commented 2 years ago

Hey Biafra, I was able to successfully get through the entire pipeline, including cross-session alignment, on CIAtah 4.0. Very fast and smooth! One issue in signal processing: Has something changed with 'computeSignalPeaks'? I get the following error when trying to extract traces from cnmfe output: Undefined function 'computeSignalPeaks' for input arguments of type 'double'.

image

I see computeSignalPeaks.m under +ciapkg > +signalprocessing, and all folders seem to be in the matlab path!

bahanonu commented 2 years ago

Great! That's good to hear.

For all ciatah functions now, if you want to access them using just their names, need to run

import ciapkg.api.* % import CIAtah functions in ciapkg package API.

at the start of your script or function to import the ciatah API package. Else you can call the functions with ciapkg.api.FUNCTION_NAME, e.g. in your case ciapkg.api.computeSignalPeaks. See https://github.com/bahanonu/ciatah#quick-start-command-line-or-gui-less-batch-analysis.

This was done for namespace reasons to make it so that my functions/methods did not have naming clashes with other package/MathWorks functions.