schnitzer-lab / EXTRACT-public

EXTRACT is a tractable and robust automated cell extraction tool for calcium imaging, which extracts the activities of cells as time series from both one-photon and two-photon calcium imaging movies.
MIT License
62 stars 16 forks source link

Error loading certain HDF5 dataset names #20

Closed bahanonu closed 2 years ago

bahanonu commented 2 years ago

@fatihdinc Going to open an issue here so the HDF5 dataset name input can be updated/resolved.

As I'd mentioned previously, would be great if users had the option to input the HDF5 dataset name using config.h5dataset = '/testData'; notation as an alternative to the filepath:dataset string passed to extractor, e.g. for the below example

config = get_defaults(config);
config.h5dataset = '/test:1';
output = extractor('extractTest.h5',config); 

Calling a movie with a dataset name that contains : leads EXTRACT to fail to load the movie. This can be replicated as below.

% Create HDF5 file and add data
fileNameTmp = 'extractTest.h5';
h5DsTmp = '/test:1';
tmpData = rand([10 10 10]);
h5create(fileNameTmp,h5DsTmp,size(tmpData));
h5write(fileNameTmp,h5DsTmp,tmpData);

% Get config
config = get_defaults(config);

% Perform the extraction
output = extractor([fileNameTmp ':' h5DsTmp],config); 

The following error occurs:

Error using h5infoc
Unable to access 'extractTest.h5:/test'. The specified URL scheme is invalid.

Error in h5info (line 125)
    hinfo = h5infoc(filename,location, useUtf8);

Error in get_movie_size (line 4)
        movie_info = h5info(path, dataset);

Error in extractor (line 130)
[h, w, ~] = get_movie_size(M);
fatihdinc commented 2 years ago

This issue is now resolved and the README file is accordingly updated. M can now be inputted as a cell, which contains both the path and dataset names without any restrictions on the naming conventions.