Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete data upload during CNMF-E cell extraction #65

Open
miguelvmc opened this issue Feb 25, 2021 · 7 comments
Open

Incomplete data upload during CNMF-E cell extraction #65

miguelvmc opened this issue Feb 25, 2021 · 7 comments

Comments

@miguelvmc
Copy link

Hi Biafra,

I am a new user of your analysis pipeline for calcium imaging. First, a big thank you developing this great tool.

We are currently using the pipeline to analyse calcium imaging data acquired with UCLA miniscopes. The data acquisition system saves the miniscope videos in separate files, each with 1000 frames. The videos we want to analyse correspond to a 20min session during wich calcium signals were acquired at 30fps. The initial videos were saved with GREY compression and we had to convert them to .TIF in order to run them through the pipeline.

We successfully managed to run modelPreprocessMovie with a downsampling factor of 4 and got the expected output. Our issue came when running modelExtractSignalsFromMovie with CNMF-E. Apparently out of 37 videos, each with 1000 frames the pipeline only uploaded 1000 frames, leading to the error copied below.

information at the beginning of modelExtractSignalsFromMovie
The data has 608 X 608 pixels X 1000 frames.
Loading all data (double precision) requires 2.754 GB RAM

error message during modelExtractSignalsFromMovie
@@@@@@@
Error using calciumImagingAnalysis/modelExtractSignalsFromMovie/saveRunTimes (line 587)
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-37.
Error in calciumImagingAnalysis/modelExtractSignalsFromMovie (line 365)
saveRunTimes('cnmfe');
Error in calciumImagingAnalysis/runPipeline (line 202)
obj.(thisFxn{1});
Error in calciumImagingAnalysis/display (line 817)
obj.runPipeline;
@@@@@@@

Any idea why the pipeline might be skipping the upload of the rest of the data?

All the best,
Miguel

@bahanonu
Copy link
Owner

@miguelvmc

Hope all's well and glad you-all are finding the tool useful.

It looks like CNMF-e ran correctly but the post cell-extraction step to save the runtimes to a file ran into an issue. A couple quick questions to help debug:

  • Can you clarify what file format (and/or codec) you were originally saving the videos in (e.g. the extension of the GREY compression files)? I can potentially add support for that format so you can skim the TIF conversion step.
  • Which version of CIAtah are you using (disp(ciapkg.version))?
  • After running modelPreprocessMovie do you have a single HDF5 movie with crop or manualCut in the name and 9250 frames (e.g. the combined movie after processing)?
  • Do you have a file ending in _cnmfeAnalysis.mat or _cnmfeAnalysis.nwb after running modelExtractSignalsFromMovie?
  • Is the regular expression at the start of modelExtractSignalsFromMovie pointing to the correctly processed movie? e.g., see below.
    image

@miguelvmc
Copy link
Author

Hi Biafra,

Thanks for the quick reply!

  • The videos are originally saved as .avi, with 8 bit greyscale compression. The possibility to skip the conversion would be great.
  • Currently I am running version v3.21.2.
  • After running modelPreprocessMovie I end up with 4 HDF5 files:
    image
    I did not perform any cropping of the procssed movies.
  • I do have a .mat file named cnmfeAnalysis.mat.
  • When I ran the modelExtractSignalsFromMovie i believe I made the mistake of calling the wrong videos by using the same regular expression that I initially used to select the videos for preprocessing. If I should have used manual cut, or crop, or another expression that points to the correct movie of the screenshot I sent, then this might be the source of the problem.

@bahanonu
Copy link
Owner

bahanonu commented Feb 26, 2021

Sure thing!

  • If you re-run cnmf-e using dfof as the file filter, should run fine. I can see about making this clearer for users. I'll push an update anyways to deal with the error you saw to lessen user confusion in the future.
    • Also, unless you need the output at each step, you can skip selecting each stage for output in modelPreprocessMovie to save HDD space. e.g.
  • Even with your current output, should be able to run modelVarsFromFiles followed by viewObjmaps to get example cell map and activity traces.
    image

re: greyscale videos, CIAtah should be able to read 8-bit compressed grayscale AVIs, what error do you get when you try to run the processing pipeline on those movies?

@miguelvmc
Copy link
Author

Hi Biafra,

Thanks for the quick reply. Turns out I did choose the incorrect files based on the regular expression I passed (duh!). Having chosen the dfof HDF5 output file I managed to run cell extraction all the way to the end.

After that I restarted MATLAB and tried to upload extraction results in order to run viewCellExtractionOnMovie but got a message that there were no files, even though the .mat file with extraction results was present:

image

Is there any addtional file I should have saved?

Finally, regarding the .avi issue I mentioned. I tried uploading the original greyscale compressed .avi movies and got the following error message:

@@@@@@@
Error using VideoReader/initReader (line 734)
Unable to determine the required codec.

Error in audiovideo.internal.IVideoReader (line 136)
initReader(obj, fileName, currentTime);

Error in VideoReader (line 104)
obj@audiovideo.internal.IVideoReader(varargin{:});

Error in loadMovieList (line 269)
xyloObj = VideoReader(thisMoviePath);

Error in calciumImagingAnalysis/modelPreprocessMovieFunction>turboregCropSelection (line 1962)
thisFrame = loadMovieList(inputFilePath,'convertToDouble',0,'frameList',options.refCropFrame,'inputDatasetName',options.datasetName,'treatMoviesAsContinuous',options.turboreg.treatMoviesAsContinuousSwitch,'loadSpecificImgClass','single');

Error in calciumImagingAnalysis/modelPreprocessMovieFunction (line 466)
[turboRegCoords] = turboregCropSelection(options,folderList);

Error in calciumImagingAnalysis/modelPreprocessMovie (line 37)
obj.modelPreprocessMovieFunction('folderListPath',folderListInfo,'fileFilterRegexp',options.fileFilterRegexp,'datasetName',options.datasetName,'frameList',[]);

Error in calciumImagingAnalysis/runPipeline (line 202)
obj.(thisFxn{1});

Error in calciumImagingAnalysis/display (line 817)
obj.runPipeline;
@@@@@@@
Warning: User likely did not give calciumImagingAnalysis a proper raw input file regular expression or incorrect HDF5 input
dataset name!

In calciumImagingAnalysis/modelPreprocessMovieFunction (line 471)
In calciumImagingAnalysis/modelPreprocessMovie (line 37)
In calciumImagingAnalysis/runPipeline (line 202)
In calciumImagingAnalysis/display (line 817)

Best,
Miguel

@bahanonu
Copy link
Owner

@miguelvmc

Hope all is well, see below.

re: viewCellExtractionOnMovie, is the absolute path input into "modelAddNewFolders" pointing to the correct folder or is the mat file the expected size (e.g. if it is <1 MB there might have been a save issue with modelExtractSignalsFromMovie)? Another possibility is that you need to select CNMF from the main CIAtah interface, e.g. see below.

image

re: greyscale compressed movies, that looks like it is an outside codec issue that may involve checking that your system/MATLAB has access to the right codec. Do you know how the file was compressed? And which OS are you running? If you can email me a link to one of the videos, I can likely take a look to see if there is a way to resolve this.

cheers,
-Biafra

@miguelvmc
Copy link
Author

Hi Biafra,

Sorry for the delay following up on this and thanks for the reply. Indeed Iwasnæt selectig the correct cell extraction method.

Regarding the greyscale movie. I don't know how the specifics of how the movie is compressed, but I can get in contact with the develpers of the miniscopes to get more details. Regardless, I will email you a link to one of my videos.

Best,
Miguel

@bahanonu
Copy link
Owner

@miguelvmc
Try loading one of your greyscale videos after installing https://codecguide.com/download_k-lite_codec_pack_standard.htm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants