GliaLab / Begonia

A two-photon imaging analysis pipeline for astrocytic Ca2+ signals.
5 stars 1 forks source link

Unable to convert TIFF to h5, or generate ref image from TIFF file #11

Open ZiTao956 opened 2 years ago

ZiTao956 commented 2 years ago

Hello! My data is a 10mins 30 Hz two-photon imaging, and it is an ~18000 frames TIFF file after using suite2p to correct movement. After I import it into Begonia, I find I am not able to convert TIFF to h5, and it will show error:

Queue has 1 tasks Error during queue execution. Stored in model.action_queue_error

Error using isempty Not enough input arguments.

Error in xylobium.dledit.comps.QueueView/handleRethrowRequest (line 228) if ~isempty(action.err)

Error in xylobium.dledit.comps.QueueView>@(~,~)obj.handleRethrowRequest() (line 120) obj.rethrow_button.Callback = @(~,~) obj.handleRethrowRequest();

Error while evaluating UIControl Callback.

Also, I fail "gener ref images", it shows error:

Unrecognized function or variable 'TIFFStack'.

Error in begonia.scantype.tiff.TSeriesTIFF/get_mat (line 100) mat = TIFFStack(self.path,[],self.channels,true,total_dirs);

Error in begonia.scantype.TSeries/get_avg_img (line 108) mat = self.get_mat(channel,cycle);

Error in dataman.actions.roi.make_reference_images (line 6) ts.get_avg_img(ch, cy);

Error in xylobium.dledit.model.EditorModel/runQueue (line 166) action.callback(action.dloc, obj, action.editor);

Error in xylobium.dledit.comps.QueueView>@(~,~)obj.model.runQueue() (line 96) obj.do_button.Callback = @(~,~) obj.model.runQueue();

Error while evaluating UIControl Callback.

lastis commented 2 years ago

Hey! The second error I think might be because the external libraries are not downloaded. Try: git submodule update --init --recursive

It's hard to say what is the problem with the first error. I have not seen this error before. It seems something is wrong with the action variable in line 228. If you still get the error maybe you can post the value of the action variable here. 🙂

Error in xylobium.dledit.comps.QueueView/handleRethrowRequest (line 228) if ~isempty(action.err)

ZiTao956 commented 2 years ago

Hello! Thank you so much for your reply. I redownload Begonia and also download the external libraries, it still show errors to convert to h5

> Error using TIFFStack (line 490)
> *** TIFFStack: Could not open file [D:\Matlab\test Begonia\unit2-a-30Hz.tif].
> 
> Error in begonia.scantype.tiff.TSeriesTIFF/get_mat (line 100)
>                 mat = TIFFStack(self.path,[],self.channels,true,total_dirs);
> 
> Error in begonia.scantype.h5.tseries_to_h5 (line 24)
> mat = ts.get_mat(1);
> 
> Error in dataman.actions.tools.convert_to_h5 (line 5)
>     begonia.scantype.h5.tseries_to_h5(ts,output_path);
> 
> Error in xylobium.dledit.model.EditorModel/runQueue (line 166)
>                     action.callback(action.dloc, obj, action.editor);
> 
> Error in xylobium.dledit.comps.QueueView>@(~,~)obj.model.runQueue() (line 96)
>             obj.do_button.Callback = @(~,~) obj.model.runQueue();
> 
> Caused by:
>     Unrecognized field name "BytesPerPlane".
>  
> Error while evaluating UIControl Callback.

This file is 9.06GB, I guess it might be too large, so I scale my data to 3Hz and try again, it show another error:

Warning: NOTE: Errors during queue execution

In xylobium.dledit.model/EditorModel/runQueue (line 184) In xylobium.dledit.comps.QueueView>@(~,~)obj.model.runQueue() (line 96) Error using jsonencode In class 'duration', no get method is defined for dependent property 'Format'. A dependent property needs a get method to access its value.

Error in begonia.scantype.h5.tseries_to_h5 (line 69) metadata = jsonencode(metadata);

Error in dataman.actions.tools.convert_to_h5 (line 5) begonia.scantype.h5.tseries_to_h5(ts,output_path);

Error in xylobium.dledit.model.EditorModel/runQueue (line 166) action.callback(action.dloc, obj, action.editor);

Error in xylobium.dledit.comps.QueueView>@(~,~)obj.model.runQueue() (line 96) obj.do_button.Callback = @(~,~) obj.model.runQueue();

Error while evaluating UIControl Callback.

I check the ans.actions and ans.cust_actions_panel.actions, it's 1X49 matrix, each element show 1X1 Action

lastis commented 2 years ago

Hey!

Yes, it looks like there is some problem with code and the tiff file, but I'm not sure exactly what. If you send me a tiff file I think I can fix it. 🙂

ZiTao956 commented 2 years ago

Hey, lastis!

Sorry for the late reply. Since my file is large, I cut a 40s recording. Here is the tiff file (512x512 pixels; 40s; 3Hz two-photon imaging): https://drive.google.com/file/d/1XDQ4sc_6HeCKi47nAhP9iUYplvnszJiJ/view?usp=sharing

I have checked that this file has the same problem converting to h5. By redownload Begonia, "gener ref images" problem is already fixed, but when I go to "Mark Rols" or "Threshold", the "Opening TSeries-type data" progress bar does not move and does not show my file, I think this might also because of the tiff file. Could you please also check whether this file can go through these steps after you fixed it?

Thank you again for your time:)