cortex-lab / Suite2P

Tools for processing 2P recordings
Other
121 stars 66 forks source link

Tiff-files. #109

Closed Student213 closed 6 years ago

Student213 commented 6 years ago

Is there a script in Suite2P which makes tiffstack or files which can be used for Suite2P-pipeline?

for creating a tiffstack now I use this code (which was given to me by my tutor):

%% load files
load('mouse10depth200green.mat')
%% scale factors
FileTifgreen='/home/mattijskuiper/PROPS/mouse10depth200green.tif'; %destination mane
chafa=zeros(numel(green),1);
chofo=zeros(numel(green),1);
for i=1:numel(green)
            chafa(i)=min(green{i}(:));
            chofo(i)=max(green{i}(:));
        end
mgreen=min(chafa);
magreen=max(chofo);
%%
tic
imwrite(uint16(green{1}+mgreen), FileTifgreen)
for k = 2:numel(green)
                imwrite(uint16(green{k}+mgreen), FileTifgreen, 'writemode', 'append');
end
toc

and the result looks like this: image

I think this isn't good. A reason for this thought is, when it is running through the script 'eigs' it gets stuck in a loop and doesn't do anything besides looping around in eigs (between the lines 900 and 950). This probably due to the information it gets from 'get_svdForROI', because here:

mov             = bsxfun(@rdivide, mov, sdmov(:));

it get a lot of NAN's which makes it impossible to continue in eigs, I think. I have the feeling it is the above script, for creating a tiffstack, that is messing up my data.

another question. how do i figure out what my diameter is supposed to be?

with kind regards.

carsen-stringer commented 6 years ago

I think your tiff writing script is writing tiffs in the correct format. However, the scaling may not be good. If the image values are very small, they may all be rounded to zero (uint16 is integers from 0-2^16). Our tiffs from scanimage are from 0-2^13. You may want to try rescaling your images before converting them to uint16 (e.g. divide by the max across all frames and multiply by 2^13).

The diameter should be what you think the diameter of the cell is in pixels. You can look at the mean image of in one of these tiffs and see approximately how big your cells are, it doesn't have to be exact.

carsen-stringer commented 6 years ago

Instead of just adding the minimum try adding a bit more to the baseline, so you don't have zeros everywhere? In addition to scaling the pixels more to the 1-8000 range