Closed HagaiHargil closed 7 years ago
Thanks for the heads up @HagaiHargil I hadn't encountered this bug so far. Do you think that would also be resolved by leaving the files
struct as is, but change the name
variable to filename
, i.e., filename = files(i).name
?
Thanks also for suggesting uipickfiles. I'll look into it.
I think your suggestion will help, but won't resolve this issue completely. The name
variable in lines 24 and 29 can either hold a pointer to a .tif
file (for example) or hold the actual data (i.e. it would be a 3D matrix). The same name
variable in lines 26 and 31 should be just the filename and in case.
So your proposed filename
variable should come in place of lines 26 and 31, but I'd change the name
variable of lines 24 and 29 to data
, to signify its different use cases and contents. It's a bit of a "patchy" solution, since you're currently acquiring this variable from the files
struct, but it's a good first step.
I made some changes in how the filename is specified and changed when calling normcorre. From my understanding, the problem you mentioned only arises if you have multiple files already loaded in memory which is not what the file assumes (although it can appear into a pipeline). Feel free to reopen this issue if you think that there are still issues.
I stumbled upon a bug when trying to run
run_pipeline.m
on variables that were already loaded into the memory.It revolves around the handling the
name
variable in thefor
loop starting at line 19: When the variable is already loaded in memory,name = files(i).name;
is a full 3D matrix ("tensor"). Thus, when in line 24 you write:'h5_filename',[name(1:end-4),'_nr.h5']
, it actually takes the values of the matrix as the filename.We solved it on our end by keeping
name
a 3D matrix, and adding a.filename
field for thefiles
struct. Thus, lines 24, 26, 29, and 31 have been changed to look something like[files(i).filename,'_nr.h5']
(that's line 24, for example).The reason this is not a pull request is that we're actually using a different module to create the
files
variable, which is calleduipickfiles
. It's much easier to work with, and allows you to choose specific files from specific folders without any issues. It requires changing a couple of other lines throughoutrun_pipeline.m
andnormcorre_batch.m
, though, and so it's not a full drop-in replacement as of yet. If we'll integrate it completely into our code and you'll be interested in having it, I'd gladly submit a full pull request for it.