Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
some bug fixing in readTiff, Binning..
Browse files Browse the repository at this point in the history
  • Loading branch information
MPIBR-vollrathf committed Jul 29, 2016
1 parent 2d6c23c commit bb5cc17
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
7 changes: 5 additions & 2 deletions CellSortTemporalBinning.m
Original file line number Diff line number Diff line change
@@ -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
25 changes: 9 additions & 16 deletions main.m
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions readTiff.m
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit bb5cc17

Please sign in to comment.