diff --git a/CellSortTemporalBinning.m b/CellSortTemporalBinning.m index 0e6844c..ac371bd 100644 --- a/CellSortTemporalBinning.m +++ b/CellSortTemporalBinning.m @@ -1,4 +1,7 @@ function [data_g, data_r] = CellSortTemporalBinning(data_g, data_r, binningFactor) -data_g = binning(data_g, bininngFactor, 'mean'); -data_r = binning(data_r, bininngFactor, 'mean'); +class_g = class(data_g); +class_r = class(data_r); + +data_g = cast(binning(data_g, binningFactor, 'mean'), class_g); +data_r = cast(binning(data_r, binningFactor, 'mean'), class_r); end diff --git a/main.m b/main.m index 1d08362..3bedbee 100644 --- a/main.m +++ b/main.m @@ -1,29 +1,22 @@ %% load and prepare all single tiffs %importing [data_g,data_r] = CellSortLoadSingleFiles('ChanA*.tif', 'ChanB*.tif'); -%% shiftCorrection +%shiftCorrection %generates shift corrected files for the green and red channels, needs %DIPlib (available for free) -[data_g, data_r] = CellSortShiftCorrection(data_g,data_r); +[data_g, data_r] = CellSortShiftCorrection(data_g, data_r); %temporal binning binningFactor = [1 1 2]; %x, y, t [data_g, data_r] = CellSortTemporalBinning(data_g, data_r, binningFactor); %% export -fileName_g = 'green.tif'; -fileName_r = 'red.tif'; -CellSortExportTifStack(data_g, fileName_g); -CellSortExportTifStack(data_r, fileName_r); -%% merge files -fn_green = 'merged_green.tiff'; -fn_red = 'merged_red.tiff'; -fileList = {'green_13.tiff', 'green_14.tiff','green_15.tiff','green_1.tiff','green_2.tiff','green_3.tiff'}; -CellSortMergeTiff(fileList, fn_green); -fileList = {'red_13.tiff', 'red_14.tiff','red_15.tiff','red_1.tiff','red_2.tiff','red_3.tiff'}; -CellSortMergeTiff(fileList, fn_red); +fn_green = 'green.tif'; +fn_red = 'red.tif'; +CellSortExportTifStack(data_g, fn_green); +CellSortExportTifStack(data_r, fn_red); %% load files -%if you haven't used the shiftCorrection you have to load the files extra -fn_green = 'green_13_corr.tif'; -fn_red = 'red_13_corr.tif'; +%if you haven't used the shiftCorrection you have to load the already processed files +fn_green = 'green.tif'; +fn_red = 'red.tif'; data_g = readTiff(fn_green); data_r = readTiff(fn_red); %% 1. PCA diff --git a/readTiff.m b/readTiff.m index b7a8e05..6daa658 100644 --- a/readTiff.m +++ b/readTiff.m @@ -1,9 +1,9 @@ function data = readTiff(filename) info = imfinfo(filename); -if info.BitDepth == 16 || info.BitDepth == 12 +if info(1).BitDepth == 16 || info(1).BitDepth == 12 filetype = 'uint16'; -elseif info.BitDepth == 8 +elseif info(1).BitDepth == 8 filetype = 'uint8'; else filetype = 'uint16';