-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSpectralPipeline.m
83 lines (61 loc) · 2.6 KB
/
SpectralPipeline.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
%% Pipeline for spectral segmentation analysis
%
% Via this script all major steps of the spectral segmentation pipeline
% for ROI selection and matching can be executed.
% All of the functions can be called without input, the functions will
% ask which file to analyse.
% Be aware that your image sequence needs to be aligned in advance!
% sbx data is required. TIFF can be converted to sbx
%% Convert (multiple) tiff files that have multiple frames (full movie) to as many sbxfiles
TiffStack2Sbx
%% Convert multiple tiff files that have multiple frames to one sbx file
TiffStack2OneSbx
%% Convert a folder full of tiff files, each tif file consisting of 1 frame
TiffImages2Sbx
%% Convert H5 files to sbx
Hdf52Sbx
%% For 1 photon/ miniscope data background subtraction is necessary
BackgroundSubtractSbx
%% Correct for bidirectional scanning misalignment? uneven vs even lines shifted?
% Also decreases really high values (>65500) to something low in the data!!
trans = false; % false: Correct for horizontal lines. True: correct for vertical lines
% Check for shift.
ShiftLinesSbx([], trans, 1)
%% Motion correct sbx data
Showsbx
% Press the A button for the Alignment/motion correction
% Rightclick on main image to adjust color scale etc
%% Transpose the motion corrected sbx file to improve reading speed
% Creates _Trans.dat file
StackTranspose
%% Decimate the Trans.dat file to ~1 Hz, and convert data to double class
% Creates _DecTrans.dat file
DecimateTrans
%% Calculate the cross spectral power for each pixel with 8 surrounding
% pixels. Requires DecTrans.dat file to function
% Creates _SPSIG.mat file
spectral
%% Create calcium fluorescence images (maximum and average projection)
% Projections get saved into SPSIG file (and outputted into the workspace)
FluorescenceImgSbx;
%% Print pngs of fluorescence images & colored spectral (optional)
% Uses images in the SPSIG file created by FLuorescenceImgSbx
PrintBImgs
%% ROI segmentation (neurons, or boutons)
% ROIs, ROI properties and used spectral images get saved into SPSIG file
getSpectrois
%% Remove or add ROIS manually, display and compare roi sets
% If save button is pressed, edits are made in the SPSIG file
RoiManagerGUI
%% Retrieve the signals associated with these rois from the aligned data
% Signals get added to the _SPSIG file
retrievesignals
%% Create a fast Simple Estimate of Activity by Leander (SEAL)
% Seal signal gets added to the _SPSIG file
SealSignals
%% deconvolve signals
% MLspike spike estimation signals get added to the _SPSIG file
DeconvolveSignals
%% Match ROIs of multiple recordings together
% Run this script step by step.
ChronicMatching